From 31c4570d10a3252dd5e596440af4410e789907fb Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 7 Sep 2022 13:48:59 +0200 Subject: [PATCH] Move finalization of signatures into own method --- .../SignatureInputStream.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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;