@Test public void testEncodeAsOpenSSH() throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { String ecdsa = Strings2.toStringAndClose(getClass().getResourceAsStream("/ssh-ecdsa.pub")); ECPublicKeySpec spec = ECDSAKeys.publicKeySpecFromOpenSSH(ecdsa); ECPublicKey key = (ECPublicKey) KeyFactory.getInstance("EC").generatePublic(spec); assertTrue(ecdsa.startsWith(ECDSAKeys.encodeAsOpenSSH(key))); }
public static String encodeAsOpenSSH(ECPublicKey key) { String curveName = null; try { curveName = getCurveName(key.getParams()); } catch (IOException e) { propagate(e); } String keyFormat = ECDSA_SHA2_PREFIX + curveName; byte[] keyBlob = keyBlob(key); return keyFormat + " " + base64().encode(keyBlob); }
ECDSAKeys { public static String encodeAsOpenSSH(ECPublicKey key) { String curveName = null; try { curveName = getCurveName(key.getParams()); } catch (IOException e) { propagate(e); } String keyFormat = ECDSA_SHA2_PREFIX + curveName; byte[] keyBlob = keyBlob(key); return keyFormat + " " + base64().encode(keyBlob); } }
ECDSAKeys { public static String encodeAsOpenSSH(ECPublicKey key) { String curveName = null; try { curveName = getCurveName(key.getParams()); } catch (IOException e) { propagate(e); } String keyFormat = ECDSA_SHA2_PREFIX + curveName; byte[] keyBlob = keyBlob(key); return keyFormat + " " + base64().encode(keyBlob); }  }
ECDSAKeys { public static String encodeAsOpenSSH(ECPublicKey key) { String curveName = null; try { curveName = getCurveName(key.getParams()); } catch (IOException e) { propagate(e); } String keyFormat = ECDSA_SHA2_PREFIX + curveName; byte[] keyBlob = keyBlob(key); return keyFormat + " " + base64().encode(keyBlob); }  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 encodeAsOpenSSH(ECPublicKey key) { String curveName = null; try { curveName = getCurveName(key.getParams()); } catch (IOException e) { propagate(e); } String keyFormat = ECDSA_SHA2_PREFIX + curveName; byte[] keyBlob = keyBlob(key); return keyFormat + " " + base64().encode(keyBlob); }  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; }