diff --git a/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/SignatureInputStream.java b/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/SignatureInputStream.java index 42ca4dc9..275acc17 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/SignatureInputStream.java +++ b/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/SignatureInputStream.java @@ -67,9 +67,7 @@ public abstract class SignatureInputStream extends FilterInputStream { final int data = super.read(); final boolean endOfStream = data == -1; if (endOfStream) { - parseAndCombineSignatures(); - verifyOnePassSignatures(); - verifyDetachedSignatures(); + finalizeSignatures(); } else { byte b = (byte) data; updateOnePassSignatures(b); @@ -84,9 +82,7 @@ public abstract class SignatureInputStream extends FilterInputStream { final boolean endOfStream = read == -1; if (endOfStream) { - parseAndCombineSignatures(); - verifyOnePassSignatures(); - verifyDetachedSignatures(); + finalizeSignatures(); } else { updateOnePassSignatures(b, off, read); updateDetachedSignatures(b, off, read); @@ -94,6 +90,12 @@ public abstract class SignatureInputStream extends FilterInputStream { return read; } + private void finalizeSignatures() { + parseAndCombineSignatures(); + verifyOnePassSignatures(); + verifyDetachedSignatures(); + } + public void parseAndCombineSignatures() { if (objectFactory == null) { return;