GPG and Java - Encryption and Decryption!
Hi,
I need to do encryption using a GPG Public Key.
This i understand cannot be used in Java Key Store which accepts only X.509 Certificates.
I see from some docs which states Bouncy Castle support s GPG encryption.
I am unable to get the exampel to work.
This is what i want to do:
Given a string, encrypt using a GPG public key.
I would want to do the decryption too using it's corresponding private key.
This is what i see when i run the ByteArrayHandler (BouncyCastle Sample - open
"The provider BC may not be signed by a trusted party"
Starting PGP test
Exception in thread "main" org.bouncycastle.openpgp.PGPException: Exception creating cipher
at org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(PGPEncryptedDataGenerator.java:451)
at org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(PGPEncryptedDataGenerator.java:475)
at org.bouncycastle.openpgp.examples.ByteArrayHandler.encrypt(ByteArrayHandler.java:170)
at org.bouncycastle.openpgp.examples.ByteArrayHandler.main(ByteArrayHandler.java:190)
Some of the other samples like , SingedFileProcessor works and generates the key files.
Appreciate if somebody could assist me in getting this to work or any other sample that allows me to work with GPG.
Thanks,
Manglu