From f7525dde65532c26127c4c0a66697e0f5e8cabb7 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 10 Jun 2021 13:35:55 +0200 Subject: [PATCH] Add get{,Un}HashedNotationData(sig, notationName) to SignatureSubpacketUtils --- .../subpackets/SignatureSubpacketsUtil.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pgpainless-core/src/main/java/org/pgpainless/signature/subpackets/SignatureSubpacketsUtil.java b/pgpainless-core/src/main/java/org/pgpainless/signature/subpackets/SignatureSubpacketsUtil.java index b74f0c28..7f240a3b 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/signature/subpackets/SignatureSubpacketsUtil.java +++ b/pgpainless-core/src/main/java/org/pgpainless/signature/subpackets/SignatureSubpacketsUtil.java @@ -331,6 +331,17 @@ public class SignatureSubpacketsUtil { return Arrays.asList(notations); } + public static List getHashedNotationData(PGPSignature signature, String notationName) { + List allNotations = getHashedNotationData(signature); + List withName = new ArrayList<>(); + for (NotationData data : allNotations) { + if (data.getNotationName().equals(notationName)) { + withName.add(data); + } + } + return withName; + } + /** * Return the notation data subpackets from the signatures unhashed area. * @@ -342,6 +353,17 @@ public class SignatureSubpacketsUtil { return Arrays.asList(notations); } + public static List getUnhashedNotationData(PGPSignature signature, String notationName) { + List allNotations = getUnhashedNotationData(signature); + List withName = new ArrayList<>(); + for (NotationData data : allNotations) { + if (data.getNotationName().equals(notationName)) { + withName.add(data); + } + } + return withName; + } + /** * Return the revocation key subpacket from the signatures hashed area. *