Subject to class loader constraints the Bouncy Castle Provider can be installed either dynamically or statically.
Note: to make full use of the provider you *must* install the unlimited policy files in the JVM you are using - these can be downloaded from http://java.sun.com. Be careful if you are using Windows as the JDK install will normally install a JRE and a JDK in two separate places - generally both of these will need to have the policy files installed in it.
import org.bouncycastle.jce.provider.BouncyCastleProvider; ... Security.addProvider(new BouncyCastleProvider());
To install the provider statically you need to add it as an entry to the
java.security file which can be found in
$JAVA_HOME/jre/lib/security/java.security for the JRE/JDK you are using. Look for a list of lines with
security.provider.X where X is some number. At the bottom of the list add the line:
where N is one more than the last number in the list.
It is possible to add the provider higher up in the list. If you do this we recommend you don't add it earlier than position 2 as there are occasionally internal dependencies on the provider at position 1 which may cause some operations by your JVM to result in errors.