I\'m trying to decrypt and verify a PGP message using the java BouncyCastle libraries, but am running into issues, complaining about premature ends of PartialInputStream.
You are calling:
encryptedDataGenerator.open(out, 4096)
where you probably meant:
encryptedDataGenerator.open(out, new byte[4096])
The first version is giving a size to open (which is wrong), the second version is giving a byte buffer.
(I know this is old, but came here because I had the same problem with some example code and so might others)