Can PHP OpenSSL generate private / public key / certificate pairs?

I wonder if the PHP OpenSSL extension can generate private / public key / certificate pairs?

+3
source share
1 answer

Of course, use openssl_pkey_new :

 $privateKey = openssl_pkey_new(array('private_key_bits' => 2048)); $details = openssl_pkey_get_details($privateKey); $publicKey = $details['key']; 

You can export keys using openssl_pkey_export or openssl_pkey_export_to_file .

+9
source

All Articles