Skip to content
Advertisement

Bouncy Castle Java PGP encryption & decryption

I am trying to implement PGP encryption in Java using Bouncy Castle, also using some of the examples provided by them.

But if I try and decrypt the message I just encrypted, it does not work. The keys and the decryption method seem to be ok, because I can encrypt using an external tool (link) and then successfully decrypt it here.

JavaScript

I think the problem is on the encryption side, but I cannot figure out what exactly it is. Does anyone have any ideas?

JavaScript

Advertisement

Answer

Here is the encryption method that eventually worked for me. It helped debugging together with the examples provided by the BCFipsIn100 book.

JavaScript
Advertisement