Skip to content

Commit

Permalink
Tests/RSA: add unit test for PuTTY public keys
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Jan 19, 2020
1 parent bed8be2 commit b65bad4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Unit/Crypt/RSA/LoadKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -980,4 +980,18 @@ public function testOpenSSHPrivate()

$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'));
}
}

0 comments on commit b65bad4

Please sign in to comment.