### Question:
SshKeys { public static boolean privateKeyHasSha1(RSAPrivateCrtKeySpec privateKey, String fingerprint) { return sha1(privateKey).equals(fingerprint); }  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);  }### Answer:
@Test public void testPrivateKeyMatchesSha1Typed() throws IOException { String privKey = Strings2.toStringAndClose(getClass().getResourceAsStream("/test")); RSAPrivateCrtKeySpec privateKey = (RSAPrivateCrtKeySpec) Pems.privateKeySpec(privKey); assert privateKeyHasSha1(privateKey, expectedSha1); }
@Test public void testPrivateKeyMatchesSha1String() throws IOException { String privKey = Strings2.toStringAndClose(getClass().getResourceAsStream("/test")); assert privateKeyHasSha1(privKey, expectedSha1); }