Re: RECOVERING FROM A BAD PASSPHRASE: PGPPBEEncryptedData.getDataStream(...)

David Hook <dgh-rTAZ0PM/[email protected]> Fri, 21 Dec 2018 11:04:42 +1100
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <[email protected]>
The issue here is that the PGP API is a streaming one, so having started
decryption and failed, the data is already partially read. You need to
reset the stream to recover from an incorrect passphrase.

Regards,

David

On 12/12/18 5:01 pm, William Swartzendruber wrote:
> Hello:
>
> I am encountering an issue where attempting to unlock an encrypted
> data stream via PGPPBEEncryptedData.getDataStream(...) will leave the
> instance in a bad state if the passphrase is incorrect.  Attempting to
> get the data stream again results in:
>
> PGPDataValidationException("data check failed")
>
> Is there a way to recover from someone entering the incorrect passphrase?
>
> This is bcpg-jdk15on-1.60
>
> I appreciate any assistance or clarification in this manner.