Bouncycastle PGP decrypt and verify

后端 未结 3 1108
忘掉有多难
忘掉有多难 2020-12-31 11:24

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.

3条回答
  •  离开以前
    2020-12-31 12:03

    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)

提交回复
热议问题