Friday, May 25, 2012

Bouncy Castle PGP

I was testing some PGP methods from the Bouncy Castle API. When running their ClearSignedFileProcessor I got the following exception 
...
 java.lang.SecurityException: JCE cannot authenticate the provider BC
...


However steps 1 and 2 are not necessary
1. Find java.security in /path_to_your_jvm/jre/lib/security
2. Add security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider

if you instead explicitly add the Bouncy castle provider, (like is done in the example)
Security.addProvider(new BouncyCastleProvider());

Step 3 proved to be necessary. However, when I ran the program as part of a grails project... Strangely it wasnt' necessary. Not sure why that is

No comments: