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 bug?
Moderator: General Moderators
-
karstensrage
- Forum Newbie
- Posts: 2
- Joined: Thu Mar 08, 2012 11:20 pm
Re: openssl_pkey_export_to_file bug?
You could just... not use the parameter. Since it's optional and all.
Code: Select all
openssl_pkey_export_to_file($privkey, './test.key.pem');
$return = openssl_pkey_get_private('file://./test.key.pem');-
karstensrage
- Forum Newbie
- Posts: 2
- Joined: Thu Mar 08, 2012 11:20 pm
Re: openssl_pkey_export_to_file bug?
Sure, but that creates an un-encrypted key. I'm in a situation where a key was already exported with the empty string password and I'm trying to figure out how to use it.