1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-11 16:49:42 +01:00

Tests/RSA: add unit test for PuTTY public keys

This commit is contained in:
terrafrost 2020-01-18 21:58:48 -06:00
parent bed8be26d7
commit b65bad4a1d

View File

@ -980,4 +980,18 @@ Vyaqr/WTPzxdXJAAAADHJvb3RAdmFncmFudAECAwQFBg==
$this->assertTrue($key->verify('zzz', $sig));
}
public function testPuTTYPublic()
{
$orig = '---- BEGIN SSH2 PUBLIC KEY ----
Comment: "phpseclib-generated-key"
AAAAB3NzaC1yc2EAAAADAQABAAAAQQCo9+BpMRYQ/dL3DS2CyJxRF+j6ctbT3/Qp
84+KeFhnii7NT7fELilKUSnxS30WAvQCCo2yU1orfgqr41mM70MB
---- END SSH2 PUBLIC KEY ----';
$orig = preg_replace('#(?<!\r)\n#', "\r\n", $orig);
$key = PublicKeyLoader::load($orig);
$this->assertSame($orig, $key->toString('PuTTY'));
}
}