Home >Java >javaTutorial >How to Fix the 'Illegal Key Size or Default Parameters' Exception in Java After a JVM Update?
Java Security: Resolving Illegal Key Size Exception
In Java, the use of encryption algorithms with strong key sizes may require additional permissions or policy files. The exception "Illegal key size or default parameters" typically arises when attempting to utilize a key size that exceeds the default or permitted limits.
In your case, after upgrading to Java 1.6.0.26, you encountered this issue when running code that previously executed flawlessly in Java 1.6.0.12. This suggests that something has changed in the Java installation configuration.
Solution:
The most probable explanation is the absence of the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. These files are necessary for enabling strong encryption algorithms in Java.
To resolve this, you need to obtain the Unlimited Strength Policy files for your Java version:
Once downloaded, extract the JAR files from the ZIP archive and place them in the following directory:
${java.home}/jre/lib/security/
Restart your Java application, and the "Illegal key size or default parameters" exception should be resolved.
The above is the detailed content of How to Fix the 'Illegal Key Size or Default Parameters' Exception in Java After a JVM Update?. For more information, please follow other related articles on the PHP Chinese website!