IT Certificaions

Google Cloud Platform

Tuesday, October 30, 2012

java.security.InvalidKeyException: Illegal key size or default parameters


java.security.InvalidKeyException: Illegal key size or default parameters
Caused by: java.security.InvalidKeyException: Illegal key size or default parameters
    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6]
    at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6]

--------------------------------------------------------------------------------------

There are key size restrictions with the default crypto files local_policy.jar and US_export_policy.jar comes with JDK – which limits it to 128.

If the security policy you are using has a key size larger than this limit– then the above exception is thrown.

Please follow these instructions...
You need to patch your JDK with Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.

For JDK1.5 visit , download the crypto files and copy the two jar files from the extracted jce directory (local_policy.jar and US_export_policy.jar) to $JAVA_HOME/jre/lib/security.

For  JDK1.6 visit , download these jars and see the installation instructions.

Or
Just you can copy and paste these jars into jdk1.6/jars/lib/security and rebuild your application.