From ec611d7c5fde1c9f95e0c09adb2fd58f2599ea83 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 8 May 2021 14:01:42 +0200 Subject: [PATCH] OpenPgpV4Fingerprint: Support pretty print format --- .../pgpainless/key/OpenPgpV4Fingerprint.java | 21 ++++++++++++++++++- .../key/OpenPgpV4FingerprintTest.java | 7 +++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/OpenPgpV4Fingerprint.java b/pgpainless-core/src/main/java/org/pgpainless/key/OpenPgpV4Fingerprint.java index 469f6068..93c0ada3 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/OpenPgpV4Fingerprint.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/OpenPgpV4Fingerprint.java @@ -22,6 +22,7 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import javax.annotation.Nonnull; +import org.bouncycastle.openpgp.PGPKeyRing; import org.bouncycastle.openpgp.PGPPublicKey; import org.bouncycastle.openpgp.PGPPublicKeyRing; import org.bouncycastle.openpgp.PGPSecretKey; @@ -45,7 +46,7 @@ public class OpenPgpV4Fingerprint implements CharSequence, Comparable OpenPgpV4Fingerprint.fromUri(uri)); } + + @Test + public void testFromPrettyPrinted() { + String prettyPrint = "C94B 884B 9A56 7B1C FB23 6999 7DC5 BDAC BBDF BF87"; + OpenPgpV4Fingerprint fingerprint = new OpenPgpV4Fingerprint(prettyPrint); + assertEquals(prettyPrint, fingerprint.prettyPrint()); + } }