public final class KeyFingerprinter extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
md5Fingerprint(KeyPair keyPair)
Prior to version 6.7 used an a hex encoded MD5 of the
serialized public key as a fingerprint.
|
static String |
sha256Fingerprint(KeyPair keyPair)
Starting with version 6.8 OpenSSH used the base64 encoded
SHA256 of the serialized public key as a fingerprint.
|
static boolean |
verifyFingerprint(KeyPair keyPair,
String fingerprint)
Verifies that the given fingerprint matches the key.
|
public static String md5Fingerprint(KeyPair keyPair) throws org.bouncycastle.crypto.CryptoException
keyPair - The KeyPair to calculate the fingerprint of9f:0b:50:ae:e3:da:f6:eb:b5:71:9a:69:ee:79:9e:c2)org.bouncycastle.crypto.CryptoExceptionpublic static String sha256Fingerprint(KeyPair keyPair) throws org.bouncycastle.crypto.CryptoException
keyPair - The KeyPair to calculate the fingerprint ofLP3pWCEhg6rdmE05GhUKbZ7uOZqsJd0sK0AR3sVoMq4)org.bouncycastle.crypto.CryptoExceptionpublic static boolean verifyFingerprint(KeyPair keyPair, String fingerprint) throws org.bouncycastle.crypto.CryptoException
9f:0b:50:ae:e3:da:f6:eb:b5:71:9a:69:ee:79:9e:c2), or 6.8
format prefixed with the algorithm name (MD5:9f:0b:50:ae:e3:da:f6:eb:b5:71:9a:69:ee:79:9e:c2 or SHA256:LP3pWCEhg6rdmE05GhUKbZ7uOZqsJd0sK0AR3sVoMq4).keyPair - The KeyPair to calculate the fingerprint offingerprint - The expected fingerprintorg.bouncycastle.crypto.CryptoExceptionCopyright © 2016–2021. All rights reserved.