mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-13 18:02:58 +00:00
Merge branch '2.0'
This commit is contained in:
commit
6ca7323401
@ -490,6 +490,15 @@ class RSA extends AsymmetricKey
|
||||
|
||||
$components = parent::load($key, $type);
|
||||
if ($components === false) {
|
||||
$this->comment = null;
|
||||
$this->modulus = null;
|
||||
$this->k = null;
|
||||
$this->exponent = null;
|
||||
$this->primes = null;
|
||||
$this->exponents = null;
|
||||
$this->coefficients = null;
|
||||
$this->publicExponent = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -921,4 +921,23 @@ OFLPBrLe4Hw=
|
||||
|
||||
$this->pkcs8tester($key, $pass);
|
||||
}
|
||||
|
||||
public function testGoodBad()
|
||||
{
|
||||
$rsa = new RSA();
|
||||
|
||||
$key = '-----BEGIN RSA PUBLIC KEY-----
|
||||
MIIBCgKCAQEA61BjmfXGEvWmegnBGSuS+rU9soUg2FnODva32D1AqhwdziwHINFa
|
||||
D1MVlcrYG6XRKfkcxnaXGfFDWHLEvNBSEVCgJjtHAGZIm5GL/KA86KDp/CwDFMSw
|
||||
luowcXwDwoyinmeOY9eKyh6aY72xJh7noLBBq1N0bWi1e2i+83txOCg4yV2oVXhB
|
||||
o8pYEJ8LT3el6Smxol3C1oFMVdwPgc0vTl25XucMcG/ALE/KNY6pqC2AQ6R2ERlV
|
||||
gPiUWOPatVkt7+Bs3h5Ramxh7XjBOXeulmCpGSynXNcpZ/06+vofGi/2MlpQZNhH
|
||||
Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB
|
||||
-----END RSA PUBLIC KEY-----';
|
||||
|
||||
$this->assertTrue($rsa->loadKey($key));
|
||||
$this->assertInternalType('string', $rsa->getPublicKey());
|
||||
$this->assertFalse($rsa->loadKey('zzz'));
|
||||
$this->assertFalse($rsa->getPublicKey());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user