mirror of
https://github.com/danog/tgseclib.git
synced 2024-11-27 04:34:45 +01:00
Tests/RSA: add unit test for loading bad key after loading good key
This commit is contained in:
parent
228b60cfe5
commit
f089aa4eb9
@ -400,4 +400,23 @@ AAIBAAIBAAIBAAIBAA==
|
||||
|
||||
$rsa->sign('zzzz');
|
||||
}
|
||||
|
||||
public function testGoodBad()
|
||||
{
|
||||
$rsa = new Crypt_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