1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-14 12:49:39 +02:00

Add support for OpenPGP v5 fingerprints.

Obviously we need support for key.getFingerprint() in BC, but once
that is there, this should magically start working.
This commit is contained in:
Paul Schaub 2022-03-10 12:01:12 +01:00
parent 0824bbd37c
commit 8f473b513f
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
4 changed files with 185 additions and 40 deletions

View file

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.key;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class OpenPgpV5FingerprintTest {
@Test
public void testFingerprintFormatting() {
String pretty = "76543210 ABCDEFAB 01AB23CD 1C0FFEE1 1EEFF0C1 DC32BA10 BAFEDCBA 01234567";
String fp = pretty.replace(" ", "");
OpenPgpV5Fingerprint fingerprint = new OpenPgpV5Fingerprint(fp);
assertEquals(fp, fingerprint.toString());
assertEquals(pretty, fingerprint.prettyPrint());
long id = fingerprint.getKeyId();
assertEquals("76543210abcdefab", Long.toHexString(id));
}
}