Why do I get “java.lang.SecurityException: Unsupported keysize or algorithm parameters” or “java.security.InvalidKeyException: Illegal key size” when I try using the Bouncy Castle Provider?
If you see this it means the unrestricted policy files for the JVM you are using have not been installed. You can find these at http://java.sun.com at the same place as you downloaded the JDK/JRE (they’re normally at the bottom of the page). Download the zip file Sun provide, follow the instructions, making sure you are installing the files into the JVM you are running with, and you should find the exception stops happening. Note: providing maximum key sizes are not exceeded it is possible to use the BC provider without getting this exception. If it suddenly starts happening the first thing to check is the policy files.