@Test public void testEncodeAsOpenSSH() throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { String encoded = SshKeys.encodeAsOpenSSH((RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic( SshKeys.publicKeySpecFromOpenSSH(Resources.asByteSource(Resources.getResource(getClass(), "/test.pub"))))); assertEquals(encoded, Strings2.toStringAndClose(getClass().getResourceAsStream("/test.pub")).trim()); }
public static String encodeAsOpenSSH(RSAPublicKey key) { byte[] keyBlob = keyBlob(key.getPublicExponent(), key.getModulus()); return "ssh-rsa " + base64().encode(keyBlob); }
SshKeys { public static String encodeAsOpenSSH(RSAPublicKey key) { byte[] keyBlob = keyBlob(key.getPublicExponent(), key.getModulus()); return "ssh-rsa " + base64().encode(keyBlob); } }
SshKeys { public static String encodeAsOpenSSH(RSAPublicKey key) { byte[] keyBlob = keyBlob(key.getPublicExponent(), key.getModulus()); return "ssh-rsa " + base64().encode(keyBlob); }  }
SshKeys { public static String encodeAsOpenSSH(RSAPublicKey key) { byte[] keyBlob = keyBlob(key.getPublicExponent(), key.getModulus()); return "ssh-rsa " + base64().encode(keyBlob); }  static RSAPublicKeySpec publicKeySpecFromOpenSSH(String idRsaPub); static RSAPublicKeySpec publicKeySpecFromOpenSSH(ByteSource supplier); static KeyPair generateRsaKeyPair(KeyPairGenerator generator, SecureRandom rand); static Map<String, String> generate(); static Map<String, String> generate(KeyPairGenerator generator, SecureRandom rand); static String encodeAsOpenSSH(RSAPublicKey key); static boolean privateKeyMatchesPublicKey(String privateKeyPEM, String publicKeyOpenSSH); static boolean privateKeyMatchesPublicKey(RSAPrivateCrtKeySpec privateKey, RSAPublicKeySpec publicKey); static boolean privateKeyHasFingerprint(RSAPrivateCrtKeySpec privateKey, String fingerprint); static boolean privateKeyHasFingerprint(String privateKeyPEM, String fingerprint); static String fingerprintPrivateKey(String privateKeyPEM); static String fingerprintPublicKey(String publicKeyOpenSSH); static boolean privateKeyHasSha1(RSAPrivateCrtKeySpec privateKey, String fingerprint); static boolean privateKeyHasSha1(String privateKeyPEM, String sha1HexColonDelimited); static String sha1PrivateKey(String privateKeyPEM); static String sha1(RSAPrivateCrtKeySpec privateKey); static boolean publicKeyHasFingerprint(RSAPublicKeySpec publicKey, String fingerprint); static boolean publicKeyHasFingerprint(String publicKeyOpenSSH, String fingerprint); static String fingerprint(BigInteger publicExponent, BigInteger modulus); }
SshKeys { public static String encodeAsOpenSSH(RSAPublicKey key) { byte[] keyBlob = keyBlob(key.getPublicExponent(), key.getModulus()); return "ssh-rsa " + base64().encode(keyBlob); }  static RSAPublicKeySpec publicKeySpecFromOpenSSH(String idRsaPub); static RSAPublicKeySpec publicKeySpecFromOpenSSH(ByteSource supplier); static KeyPair generateRsaKeyPair(KeyPairGenerator generator, SecureRandom rand); static Map<String, String> generate(); static Map<String, String> generate(KeyPairGenerator generator, SecureRandom rand); static String encodeAsOpenSSH(RSAPublicKey key); static boolean privateKeyMatchesPublicKey(String privateKeyPEM, String publicKeyOpenSSH); static boolean privateKeyMatchesPublicKey(RSAPrivateCrtKeySpec privateKey, RSAPublicKeySpec publicKey); static boolean privateKeyHasFingerprint(RSAPrivateCrtKeySpec privateKey, String fingerprint); static boolean privateKeyHasFingerprint(String privateKeyPEM, String fingerprint); static String fingerprintPrivateKey(String privateKeyPEM); static String fingerprintPublicKey(String publicKeyOpenSSH); static boolean privateKeyHasSha1(RSAPrivateCrtKeySpec privateKey, String fingerprint); static boolean privateKeyHasSha1(String privateKeyPEM, String sha1HexColonDelimited); static String sha1PrivateKey(String privateKeyPEM); static String sha1(RSAPrivateCrtKeySpec privateKey); static boolean publicKeyHasFingerprint(RSAPublicKeySpec publicKey, String fingerprint); static boolean publicKeyHasFingerprint(String publicKeyOpenSSH, String fingerprint); static String fingerprint(BigInteger publicExponent, BigInteger modulus);  }