Describe the bug
Exception thrown ('Error while validating MDC') if MDC validation occurs twice, caused by nested InputStreams.
To Reproduce
Wrap the decryptAndVerifyStream in an additional InputStream, reading to the end of that stream can cause MDCValidatingInputStream#read to be called twice. PGPEncryptedData#verify doesn't like being called twice, possibly due to the reuse of the integrityCalculator OutputStream (a guess).
Expected behavior
Exception should not be thrown if MDC is valid, even if nested streams cause the validator to trigger twice.
System (please complete the following information):
Version 2.3.0
Additional context
I've got an example trivial fix, will raise a PR for consideration shortly. Thanks!
Describe the bug Exception thrown ('Error while validating MDC') if MDC validation occurs twice, caused by nested InputStreams.
To Reproduce Wrap the
decryptAndVerifyStream
in an additional InputStream, reading to the end of that stream can causeMDCValidatingInputStream#read
to be called twice.PGPEncryptedData#verify
doesn't like being called twice, possibly due to the reuse of theintegrityCalculator
OutputStream (a guess).Expected behavior Exception should not be thrown if MDC is valid, even if nested streams cause the validator to trigger twice.
System (please complete the following information):
Additional context I've got an example trivial fix, will raise a PR for consideration shortly. Thanks!