private FileKeyProvider buildProvider(final Local identity, final KeyFormat format) throws InteroperabilityException {
switch(format) {
case PKCS5:
return new PKCS5KeyFile.Factory().create();
case PKCS8:
return new PKCS8KeyFile.Factory().create();
case OpenSSH:
return new OpenSSHKeyFile.Factory().create();
case OpenSSHv1:
return new OpenSSHKeyV1KeyFile.Factory().create();
case PuTTY:
return new PuTTYKeyFile.Factory().create();
default:
throw new InteroperabilityException(String.format("Unknown key format for file %s", identity.getName()));
}
}
@Test
public void testFingerprint() throws Exception {
final FileKeyProvider f = new OpenSSHKeyFile.Factory().create();
f.init("", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/71hmi4R+CZqGvZ+aVdaKIt5yb2H87yNAAcdtPAQBJBqKw/vR0iYeU/tnwKWRfnTK/NcN2H6yG/wx0o9WiavUhUaSUPesJo3/PpZ7fZMUk/Va8I7WI0i25XlWJTE8SMFftIuJ8/AVPNSCmL46qy93BlQb8W70O9XQD/yj/Cy6aPb9wlHxdaswrmdoIzI4BS28Tu1F45TalqarqTLm3wY4RpghxHo8LxCgNbmd0cr6XnOmz1RM+rlbkiuSdNphW3Ah2iCHMif/KdRCFCPi5LyUrdheOtQYvQCmFREczb3kyuQPCElQac4DeL37F9ZLLBHnRVi7KxFqDbcbNLadfExx [email protected]");
assertEquals("87:60:23:a3:56:b5:1a:24:8b:63:43:ea:5a:d4:e1:9d",
new SSHFingerprintGenerator().fingerprint(f.getPublic())
);
}