mirror of
https://github.com/danog/phpseclib.git
synced 2025-01-22 04:51:19 +01:00
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:
parent
ec5aead746
commit
6686e203e7
@ -510,10 +510,8 @@ class Crypt_RSA {
|
||||
$publickey = openssl_pkey_get_details($rsa);
|
||||
$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)));
|
||||
$publickey = call_user_func_array(array($this, '_convertPublicKey'), array_values($this->_parseKey($publickey, CRYPT_RSA_PUBLIC_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)));
|
||||
|
||||
// clear the buffer of error strings stemming from a minimalistic openssl.cnf
|
||||
while (openssl_error_string() !== false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user