mirror of
https://github.com/danog/tgseclib.git
synced 2025-01-22 14:01:20 +01:00
Merge remote-tracking branch 'lukas/fingerprint' into rsa-fingerprint-2.0
Conflicts: phpseclib/Crypt/RSA.php tests/Unit/Crypt/RSA/LoadKeyTest.php
This commit is contained in:
commit
895caa706d
@ -1730,7 +1730,7 @@ class RSA
|
|||||||
switch($algorithm)
|
switch($algorithm)
|
||||||
{
|
{
|
||||||
case 'sha256':
|
case 'sha256':
|
||||||
$hash = new Crypt_Hash('sha256');
|
$hash = new Hash('sha256');
|
||||||
$base = base64_encode($hash->hash($RSAPublicKey));
|
$base = base64_encode($hash->hash($RSAPublicKey));
|
||||||
return substr($base, 0, strlen($base) - 1);
|
return substr($base, 0, strlen($base) - 1);
|
||||||
case 'md5':
|
case 'md5':
|
||||||
|
@ -241,16 +241,17 @@ ZQIDAQAB
|
|||||||
$this->assertFalse($rsa->getPrivateKey());
|
$this->assertFalse($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testSSHPubKeyFingerprint()
|
public function testSSHPubKeyFingerprint()
|
||||||
{
|
{
|
||||||
$rsa = new Crypt_RSA();
|
$rsa = new RSA();
|
||||||
|
|
||||||
$key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD9K+ebJRMN10kGanhi6kDz6EYFqZttZWZh0'.
|
$key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD9K+ebJRMN10kGanhi6kDz6EYFqZttZWZh0'.
|
||||||
'YoEbIbbere9N2Yvfc7oIoCTHYowhXND9WSJaIs1E4bx0085CZnofWaqf4NbZTzAh18iZup08ec'.
|
'YoEbIbbere9N2Yvfc7oIoCTHYowhXND9WSJaIs1E4bx0085CZnofWaqf4NbZTzAh18iZup08ec'.
|
||||||
'COB5gJVS1efpgVSviDF2L7jxMsBVoOBfqsmA8m0RwDDVezyWvw4y+STSuVzu2jI8EfwN7ZFGC6'.
|
'COB5gJVS1efpgVSviDF2L7jxMsBVoOBfqsmA8m0RwDDVezyWvw4y+STSuVzu2jI8EfwN7ZFGC6'.
|
||||||
'Yo8m/Z94qIGzqPYGKJLuCeidB0TnUE0ZtzOJTiOc/WoTm/NOpCdfQZEJggd1MOTi+QUnqRu4Wu'.
|
'Yo8m/Z94qIGzqPYGKJLuCeidB0TnUE0ZtzOJTiOc/WoTm/NOpCdfQZEJggd1MOTi+QUnqRu4Wu'.
|
||||||
'b6wYtY/q/WtUFr3nK+x0lgOtokhnJfRR/6fnmC1CztPnIT4BWK81VGKWONAxuhMyQ5XChyu6S9'.
|
'b6wYtY/q/WtUFr3nK+x0lgOtokhnJfRR/6fnmC1CztPnIT4BWK81VGKWONAxuhMyQ5XChyu6S9'.
|
||||||
'mWG5tUlUI/5';
|
'mWG5tUlUI/5';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertSame($rsa->getPublicKeyFingerprint('md5'), 'bd:2c:2f:31:b9:ef:b8:f8:ad:fc:40:a6:94:4f:28:82');
|
$this->assertSame($rsa->getPublicKeyFingerprint('md5'), 'bd:2c:2f:31:b9:ef:b8:f8:ad:fc:40:a6:94:4f:28:82');
|
||||||
$this->assertSame($rsa->getPublicKeyFingerprint('sha256'), 'N9sV2uSNZEe8TITODku0pRI27l+Zk0IY0TrRTw3ozwM');
|
$this->assertSame($rsa->getPublicKeyFingerprint('sha256'), 'N9sV2uSNZEe8TITODku0pRI27l+Zk0IY0TrRTw3ozwM');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user