From b65bad4a1d9f9ccca1b55a14ec29667f34ffc2e1 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 18 Jan 2020 21:58:48 -0600 Subject: [PATCH] Tests/RSA: add unit test for PuTTY public keys --- tests/Unit/Crypt/RSA/LoadKeyTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Unit/Crypt/RSA/LoadKeyTest.php b/tests/Unit/Crypt/RSA/LoadKeyTest.php index 4c3c3449..9c9173d4 100644 --- a/tests/Unit/Crypt/RSA/LoadKeyTest.php +++ b/tests/Unit/Crypt/RSA/LoadKeyTest.php @@ -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('#(?assertSame($orig, $key->toString('PuTTY')); + } }