I am trying to achieve PGP encryption/decryption with Apache Camel (XML DSL).
I created an OpenPGP key set with Kleoptra (and tested to validate keys work for encryption and decryption)
Now, in my camel context, I have the following:
<dataFormats>
<pgp id="encrypt" keyFileName="party2public.pgp" keyUserid="party2"/>
<pgp id="decrypt" keyFileName="party2private.pgp"/>
</dataFormats>
<route id="encrypter">
<from uri="file:ToEncrypt"/>
<marshal ref="encrypt"/>
<to uri="file:Encrypted"/>
</route>
<route id="decrypter">
<from uri="file:ToDecrypt"/>
<unmarshal ref="decrypt"/>
<to uri="file:Decrypted"/>
</route>
When encrypting a file, it works as expected, file end up encrypted in the Encrypted folder. But when trying to decrypt it, I get the following error:
org.bouncycastle.openpgp.PGPException: PGP message is encrypted with a key which could not be found in the Secret Keyring.
Any idea why is this happening?
I think you just need to add password="" on your pgp decrypt bean.
I'm fixing that upstream by the way: https://issues.apache.org/jira/browse/CAMEL-12897