Home » » openssl_pkey_export

openssl_pkey_export

Written By 1 on Tuesday, October 2, 2012 | 10:18 AM

bool openssl_pkey_export ( mixed $key , string &$out [, string $passphrase [, array $configargs ]] )
Gets an exportable representation of a key into a string
openssl_pkey_export() exports key as a PEM encoded string and stores it into out (which is passed by reference).

I kept banging my head against the wall today trying to figure out why the RSA keys I was generating were encrypted (they have this stuff in them)

Proc-Type: 4,ENCRYPTED

DEK-Info: DES-EDE3-CBC,BEA1180EADE1524F



I finally realized that the issue was that I was passing a password into the "openssl_pkey_export" method inadvertently.



So the moral of the story is: you have to use NULL as the password. using an empty string will still cause the key to be encrypted.


0 Comment:

Post a Comment