Reformat keys even if private key format is the same OpenSSL uses

As is private keys weren't being encrypted when a private key was being set and OpenSSL was being used.

Thanks TeigneuX!
This commit is contained in:
terrafrost 2012-09-18 05:17:14 -05:00
parent ec5aead746
commit 6686e203e7

View File

@ -510,10 +510,8 @@ class Crypt_RSA {
$publickey = openssl_pkey_get_details($rsa); $publickey = openssl_pkey_get_details($rsa);
$publickey = $publickey['key']; $publickey = $publickey['key'];
if ($this->privateKeyFormat != CRYPT_RSA_PRIVATE_FORMAT_PKCS1) { $privatekey = call_user_func_array(array($this, '_convertPrivateKey'), array_values($this->_parseKey($privatekey, CRYPT_RSA_PRIVATE_FORMAT_PKCS1)));
$privatekey = call_user_func_array(array($this, '_convertPrivateKey'), array_values($this->_parseKey($privatekey, CRYPT_RSA_PRIVATE_FORMAT_PKCS1))); $publickey = call_user_func_array(array($this, '_convertPublicKey'), array_values($this->_parseKey($publickey, CRYPT_RSA_PUBLIC_FORMAT_PKCS1)));
$publickey = call_user_func_array(array($this, '_convertPublicKey'), array_values($this->_parseKey($publickey, CRYPT_RSA_PUBLIC_FORMAT_PKCS1)));
}
// clear the buffer of error strings stemming from a minimalistic openssl.cnf // clear the buffer of error strings stemming from a minimalistic openssl.cnf
while (openssl_error_string() !== false); while (openssl_error_string() !== false);