From 142d1f6b16779b0ccb48e1d5d5d64723a8e5a701 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 25 Aug 2022 11:41:52 +0200 Subject: [PATCH] Add support for v5 fingerprints --- .../cert_d/backend/FileBasedCertificateDirectoryBackend.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java b/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java index 4d37b0d..89e52ba 100644 --- a/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java +++ b/pgp-cert-d-java/src/main/java/pgp/cert_d/backend/FileBasedCertificateDirectoryBackend.java @@ -386,7 +386,8 @@ public class FileBasedCertificateDirectoryBackend implements PGPCertificateDirec public static class FilenameResolver { private final File baseDirectory; - private final Pattern openPgpV4FingerprintPattern = Pattern.compile("^[a-f0-9]{40}$"); + // matches v4 and v5 fingerprints (v4 = 40 hex chars, v5 = 64 hex chars) + private final Pattern openPgpFingerprint = Pattern.compile("^[a-f0-9]{40}([a-f0-9]{24})?$"); public FilenameResolver(File baseDirectory) { this.baseDirectory = baseDirectory; @@ -435,7 +436,7 @@ public class FileBasedCertificateDirectoryBackend implements PGPCertificateDirec } private boolean isFingerprint(String fingerprint) { - return openPgpV4FingerprintPattern.matcher(fingerprint).matches(); + return openPgpFingerprint.matcher(fingerprint).matches(); } private boolean isSpecialName(String specialName) {