Skip to content

File with valid MDC can fail MDC verification when stream is wrapped #66

Open
@homps

Description

@homps

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions