2

I'm trying to perform pgp encryption/decryption operations via Camel / Bouncy Castle PGP where I store the used keys in a JKS files and generate PGP keyrings on the fly from the public/private keys in the JKS stores (Camel only works with keyrings - it can't use keys direclty).

The problem comes when I need to perform an PGP encrypt operation where I only get a public key with which I should do the encryption and I don't have/need a private key. I checked the Bouncy Castle PGP API at http://www.bouncycastle.org/docs/pgdocs1.5on/index.html and found no way to generate a PGP public keyring without having at least one private key.

To be more specific - the only way to create a PGP keyring is to use the org.bouncycastle.openpgp.PGPKeyRingGenerator class but all its constructors need a (non null) PGPKeyPair argument which needs a PGP Public Key.

Is it possible at all to have a PGP public key ring without having a private key?

Thank you

vap78
  • 1,029
  • 2
  • 11
  • 26
  • Did you ever find out about this? I also need to generate a public keyring without a private key – Louise Eggleton Jun 13 '14 at 17:50
  • Sorry - no. In the end I had to work-around this by adding a locally generated privte key, but anyway I was using it only for a demo/poc so it was acceptable. – vap78 Jun 16 '14 at 10:49

0 Answers0