Bouncy Castle is a free provider for JCE. These following steps will explain how to add this security provider.
- Download the latest release for your JDK version at http://www.bouncycastle.org/latest_releases.html
- Extract the zip file in your home directory
- BouncyCastle doens’t come with a JAR file. In order to add it to the bootclasspath, create one:
c:jce-jdk12-107classes> jar cvf bouncycastle.jar * c:jce-jdk12-107classes> copy bouncycastle.jar c:jdk1.2.2jrelibext
- Go to your JAVA_HOME/jre/lib/security directory and edit the file java.security. Look at the configuration, in my case it says something like:
Add the line security.provider.3=org.bouncycastle.jce.provider.BouncyCastleProvider
- Run one of the examples to see if it is working (eg. How do I crypt/decrypt a message with the Blowfish algorithm?)
This information is outdated. Now, you can download JAR versions for your JDK version.
For 1.3.1, I downloaded jce-jdk13-118.jar and bcprov-jdk13-118.jar and added them to my classpath (you can also put them in jdk1.3.1/jre/lib/ext and NOT add them to your classpath).
You can add a static provider to jdk1.3.1/jre/lib/security/java.security as described above or you can do this programmatically in your code:
... java.security.Provider provider = new org.bouncycastle.jce.provider.BouncyCastleProvider(); Security.addProvider(provider);