mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 08:10:55 +03:00
- Test ECDSA fingerprints
This commit is contained in:
@@ -146,7 +146,7 @@ public class OpenSSHKeyFileTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldHaveCorrectFingerprintForECDSA() throws IOException, GeneralSecurityException {
|
public void shouldHaveCorrectFingerprintForECDSA256() throws IOException, GeneralSecurityException {
|
||||||
OpenSSHKeyFile keyFile = new OpenSSHKeyFile();
|
OpenSSHKeyFile keyFile = new OpenSSHKeyFile();
|
||||||
keyFile.init(new File("src/test/resources/keytypes/test_ecdsa_nistp256"));
|
keyFile.init(new File("src/test/resources/keytypes/test_ecdsa_nistp256"));
|
||||||
String expected = "256 MD5:53:ae:db:ed:8f:2d:02:d4:d5:6c:24:bc:a4:66:88:79 root@itgcpkerberosstack-cbgateway-0-20151117031915 (ECDSA)\n";
|
String expected = "256 MD5:53:ae:db:ed:8f:2d:02:d4:d5:6c:24:bc:a4:66:88:79 root@itgcpkerberosstack-cbgateway-0-20151117031915 (ECDSA)\n";
|
||||||
@@ -155,6 +155,26 @@ public class OpenSSHKeyFileTest {
|
|||||||
assertThat(expected, containsString(sshjFingerprintSshjKey));
|
assertThat(expected, containsString(sshjFingerprintSshjKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldHaveCorrectFingerprintForECDSA384() throws IOException, GeneralSecurityException {
|
||||||
|
OpenSSHKeyFile keyFile = new OpenSSHKeyFile();
|
||||||
|
keyFile.init(new File("src/test/resources/keytypes/test_ecdsa_nistp384"));
|
||||||
|
String expected = "384 MD5:ee:9b:82:d1:47:01:16:1b:27:da:f5:27:fd:b2:eb:e2";
|
||||||
|
PublicKey aPublic = keyFile.getPublic();
|
||||||
|
String sshjFingerprintSshjKey = net.schmizz.sshj.common.SecurityUtils.getFingerprint(aPublic);
|
||||||
|
assertThat(expected, containsString(sshjFingerprintSshjKey));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldHaveCorrectFingerprintForECDSA521() throws IOException, GeneralSecurityException {
|
||||||
|
OpenSSHKeyFile keyFile = new OpenSSHKeyFile();
|
||||||
|
keyFile.init(new File("src/test/resources/keytypes/test_ecdsa_nistp521"));
|
||||||
|
String expected = "521 MD5:22:e2:f4:3c:61:ae:e9:85:a1:4d:d9:6c:13:aa:eb:00";
|
||||||
|
PublicKey aPublic = keyFile.getPublic();
|
||||||
|
String sshjFingerprintSshjKey = net.schmizz.sshj.common.SecurityUtils.getFingerprint(aPublic);
|
||||||
|
assertThat(expected, containsString(sshjFingerprintSshjKey));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldHaveCorrectFingerprintForED25519() throws IOException {
|
public void shouldHaveCorrectFingerprintForED25519() throws IOException {
|
||||||
OpenSSHKeyV1KeyFile keyFile = new OpenSSHKeyV1KeyFile();
|
OpenSSHKeyV1KeyFile keyFile = new OpenSSHKeyV1KeyFile();
|
||||||
|
|||||||
1
src/test/resources/keytypes/test_ecdsa_nistp384.pub
Normal file
1
src/test/resources/keytypes/test_ecdsa_nistp384.pub
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBGk0vVkVNYPm6YMwd8G+HtKSFQ6g5CiUPHhuOh7IJQbv521UQ+0A4t82XocxRL4OBkzNZoU76N5PzUDQ0xXWoIXl6w84oPRJ9nHs6iZkJquPLiQR4lkoEGh7Mgh6MdefXw==
|
||||||
1
src/test/resources/keytypes/test_ecdsa_nistp521.pub
Normal file
1
src/test/resources/keytypes/test_ecdsa_nistp521.pub
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHIN0C3k19elYzS8He+vCmZvmaFuzv4akhLBzixbahNDJ+T4MRAtdAyzbyvS275seDct/m/6Ci2Oivm+8l94KfKkQBRJbc8RWuUczzDFgaAu+R65tuLeZaCF6Z/ScaPw2lEdFWN0Vp6bet/J7XGk0muhvXUqVWc/IXhfqJ/YAniRo/WHA==
|
||||||
Reference in New Issue
Block a user