Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

GPG and Java - Encryption and Decryption!

843811Sep 12 2005
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2005
Added on Sep 12 2005
0 comments
2,419 views