@Test public void testCanReadRsaAndCompareFingerprintOnPublicECDSAKey() throws IOException { String ecdsa = Strings2.toStringAndClose(getClass().getResourceAsStream("/ssh-ecdsa.pub")); String fingerPrint = ECDSAKeys.fingerprintPublicKey(ecdsa); assertEquals(fingerPrint, expectedFingerPrint); }
public static String fingerprintPublicKey(String publicKeyOpenSSH) throws IOException { ECPublicKeySpec publicKeySpec = publicKeySpecFromOpenSSH(publicKeyOpenSSH); String fingerprint = null; try { ECPublicKey pk = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(publicKeySpec); fingerprint = fingerprint(pk); } catch (InvalidKeySpecException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return fingerprint; }
ECDSAKeys { public static String fingerprintPublicKey(String publicKeyOpenSSH) throws IOException { ECPublicKeySpec publicKeySpec = publicKeySpecFromOpenSSH(publicKeyOpenSSH); String fingerprint = null; try { ECPublicKey pk = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(publicKeySpec); fingerprint = fingerprint(pk); } catch (InvalidKeySpecException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return fingerprint; } }
ECDSAKeys { public static String fingerprintPublicKey(String publicKeyOpenSSH) throws IOException { ECPublicKeySpec publicKeySpec = publicKeySpecFromOpenSSH(publicKeyOpenSSH); String fingerprint = null; try { ECPublicKey pk = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(publicKeySpec); fingerprint = fingerprint(pk); } catch (InvalidKeySpecException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return fingerprint; }  }
ECDSAKeys { public static String fingerprintPublicKey(String publicKeyOpenSSH) throws IOException { ECPublicKeySpec publicKeySpec = publicKeySpecFromOpenSSH(publicKeyOpenSSH); String fingerprint = null; try { ECPublicKey pk = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(publicKeySpec); fingerprint = fingerprint(pk); } catch (InvalidKeySpecException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return fingerprint; }  static String encodeAsOpenSSH(ECPublicKey key); static ECPublicKeySpec publicKeySpecFromOpenSSH(String ecDsaPub); static ECPublicKeySpec publicKeySpecFromOpenSSH(ByteSource supplier); static String fingerprintPublicKey(String publicKeyOpenSSH); static String fingerprint(ECPublicKey publicKey); static byte[] encodeECPoint(ECPoint group, EllipticCurve curve); static ECPoint decodeECPoint(byte[] M, EllipticCurve curve); }
ECDSAKeys { public static String fingerprintPublicKey(String publicKeyOpenSSH) throws IOException { ECPublicKeySpec publicKeySpec = publicKeySpecFromOpenSSH(publicKeyOpenSSH); String fingerprint = null; try { ECPublicKey pk = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(publicKeySpec); fingerprint = fingerprint(pk); } catch (InvalidKeySpecException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return fingerprint; }  static String encodeAsOpenSSH(ECPublicKey key); static ECPublicKeySpec publicKeySpecFromOpenSSH(String ecDsaPub); static ECPublicKeySpec publicKeySpecFromOpenSSH(ByteSource supplier); static String fingerprintPublicKey(String publicKeyOpenSSH); static String fingerprint(ECPublicKey publicKey); static byte[] encodeECPoint(ECPoint group, EllipticCurve curve); static ECPoint decodeECPoint(byte[] M, EllipticCurve curve); static final String ECDSA_SHA2_PREFIX; }