From f005885318321b397b83371de3e6efc874c09ccd Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Tue, 22 Nov 2022 15:52:04 +0100 Subject: [PATCH] Add MessageMetadata.isVerifiedSigned() and .getVerifiedSignatures() --- .../decryption_verification/MessageMetadata.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageMetadata.java b/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageMetadata.java index da6902c5..7743d32e 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageMetadata.java +++ b/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageMetadata.java @@ -186,6 +186,12 @@ public class MessageMetadata { return isVerifiedInlineSignedBy(keys) || isVerifiedDetachedSignedBy(keys); } + public List getVerifiedSignatures() { + List allVerifiedSignatures = getVerifiedInlineSignatures(); + allVerifiedSignatures.addAll(getVerifiedDetachedSignatures()); + return allVerifiedSignatures; + } + public boolean isVerifiedDetachedSignedBy(@Nonnull PGPKeyRing keys) { return containsSignatureBy(getVerifiedDetachedSignatures(), keys); } @@ -403,6 +409,10 @@ public class MessageMetadata { return firstOrNull(map(getEncryptionLayers(), encryptedData -> encryptedData.decryptionKey)); } + public boolean isVerifiedSigned() { + return !getVerifiedSignatures().isEmpty(); + } + public interface Packet { }