1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-06 20:31:08 +01:00

Add more tests for V6 fingerprints

This commit is contained in:
Paul Schaub 2023-08-01 15:29:24 +02:00
parent 15af265e3f
commit 8cdb7ee4e0
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 85 additions and 0 deletions

View file

@ -10,6 +10,7 @@ import javax.annotation.Nonnull;
import org.bouncycastle.openpgp.PGPKeyRing;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.util.encoders.Hex;
@ -22,6 +23,17 @@ public abstract class OpenPgpFingerprint implements CharSequence, Comparable<Ope
protected static final Charset utf8 = Charset.forName("UTF-8");
protected final String fingerprint;
/**
* Return the fingerprint of the given key.
* This method automatically matches key versions to fingerprint implementations.
*
* @param key key
* @return fingerprint
*/
public static OpenPgpFingerprint of(PGPSecretKey key) {
return of(key.getPublicKey());
}
/**
* Return the fingerprint of the given key.
* This method automatically matches key versions to fingerprint implementations.