openssl_pkey_export_to_file bug?
Posted: Thu Mar 08, 2012 11:26 pm
Im running into an issue that seems non-obvious to me how to address. Basically this works:
openssl_pkey_export_to_file($privkey, './test.key.pem', 'test');
$return = openssl_pkey_get_private('file://./test.key.pem', 'test');
But this, does not:
openssl_pkey_export_to_file($privkey, './test.key.pem', '');
$return = openssl_pkey_get_private('file://./test.key.pem', '');
The call to openssl_pkey_export_to_file in both cases works and creates an encrypted PEM file. Unfortunately you cant decrypt the PEM file in the second case. Is there a way to specify a password of the empty string for decryption since it will take the empty string for encryption?
openssl_pkey_export_to_file($privkey, './test.key.pem', 'test');
$return = openssl_pkey_get_private('file://./test.key.pem', 'test');
But this, does not:
openssl_pkey_export_to_file($privkey, './test.key.pem', '');
$return = openssl_pkey_get_private('file://./test.key.pem', '');
The call to openssl_pkey_export_to_file in both cases works and creates an encrypted PEM file. Unfortunately you cant decrypt the PEM file in the second case. Is there a way to specify a password of the empty string for decryption since it will take the empty string for encryption?