mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-26 00:28:27 +00:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
a7f2a5d9c9
@ -1708,7 +1708,7 @@ class RSA
|
|||||||
function setPrivateKey($key = false, $type = false)
|
function setPrivateKey($key = false, $type = false)
|
||||||
{
|
{
|
||||||
if ($key === false && !empty($this->publicExponent)) {
|
if ($key === false && !empty($this->publicExponent)) {
|
||||||
unset($this->publicExponent);
|
$this->publicExponent = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1716,7 +1716,7 @@ class RSA
|
|||||||
if (!$rsa->loadKey($key, $type)) {
|
if (!$rsa->loadKey($key, $type)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unset($rsa->publicExponent);
|
$rsa->publicExponent = false;
|
||||||
|
|
||||||
// don't overwrite the old key if the new key is invalid
|
// don't overwrite the old key if the new key is invalid
|
||||||
$this->loadKey($rsa);
|
$this->loadKey($rsa);
|
||||||
|
@ -346,4 +346,38 @@ Z2sKniRCcDT1ZP4=
|
|||||||
|
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group github960
|
||||||
|
*/
|
||||||
|
public function testSetLoad()
|
||||||
|
{
|
||||||
|
$key = 'PuTTY-User-Key-File-2: ssh-rsa
|
||||||
|
Encryption: aes256-cbc
|
||||||
|
Comment: phpseclib-generated-key
|
||||||
|
Public-Lines: 4
|
||||||
|
AAAAB3NzaC1yc2EAAAADAQABAAAAgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4
|
||||||
|
eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RK
|
||||||
|
NUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDy
|
||||||
|
R4e9T04ZZw==
|
||||||
|
Private-Lines: 8
|
||||||
|
llx04QMegql0/nE5RvcJSrGrodxt6ytuv/JX2caeZBUyQwQc2WBNYagLHyHPM9jI
|
||||||
|
9OUWz59FLhjFXZMDNMoUXxVmjwQpOAaVPYNxxFM9AF6/NXFji64K7huD9n4A+kLn
|
||||||
|
sHwMLWPR5a/tZA0r05DZNz9ULA3mQu7Hz4EQ8ifu3uTPJuTmL51x6RmudYKysb20
|
||||||
|
fM8VzC3ukvzzRh0pujUVTr/yQdmciASVFnZlt4xQy+ZEOVUAOfwjd//AFfXTvk6x
|
||||||
|
7A45rNlU/uicHwLgoY1APvRHCFxw7F+uVW5L4mSX7NNzqBKkZ+1qpQTAfQvIfEIb
|
||||||
|
444+CXsgIyOpqt6VxJH2u6elAtE1wau3YaFR8Alm8m97rFYzRi3oDP5NZYkTCWSV
|
||||||
|
EOpSeghXSs7IilJu8I6/sB1w5dakdeBSFkIynrlFXkO0uUw+QJJWjxY8SypzgIuP
|
||||||
|
DzduF6XsQrCyo6dnIpGQCQ==
|
||||||
|
Private-MAC: 35134b7434bf828b21404099861d455e660e8740';
|
||||||
|
|
||||||
|
$rsa = new Crypt_RSA();
|
||||||
|
$rsa->setPrivateKey($key);
|
||||||
|
$rsa->loadKey($key);
|
||||||
|
|
||||||
|
$rsa = new Crypt_RSA();
|
||||||
|
$rsa->loadKey($key);
|
||||||
|
$rsa->setPrivateKey();
|
||||||
|
$rsa->loadKey($rsa);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user