Merge branch '3.0'

This commit is contained in:
terrafrost 2020-01-18 22:51:41 -06:00
commit 1dd7278ee1
2 changed files with 15 additions and 1 deletions

View File

@ -125,6 +125,6 @@ abstract class PuTTY extends Progenitor
*/
public static function savePublicKey(BigInteger $n, BigInteger $e)
{
return self::wrapPublicKey(Strings::packSSH2($e, $n), 'ssh-rsa');
return self::wrapPublicKey(Strings::packSSH2('ii', $e, $n), 'ssh-rsa');
}
}

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