Error message:
Caused by: java.security.InvalidKeyException: Illegal key size or default parameters
Cause of the problem:
Java almost every common encryption algorithm can find the corresponding implementation. Due to export restrictions in the United States, Sun has imposed restrictions on access files (Local_policy.jar, Us_export_policy.jar). So there are some problems:
The key length does not meet the requirements (for example: Java.security.InvalidKeyException:Illegal key size or default parameters);
Some algorithms do not support, such as MD4, SHA-224 and other algorithms;
API is not very convenient to use, some of the commonly used conversion aids are not available, such as Base64 encoding conversion, hex encoding conversion tools.
Oracle provides policy-free file access on its official website (Unlimited Strength Jurisdiction policy files), and we can address the limitations by simply deploying it in the JRE environment.
Workaround:
Http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters
JDK8 Jar Package:
Http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
JDK7 Jar Package:
Http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
JDK6 Jar Package:
Http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html
Replace the two jar packages: Local_policy.jar and Us_export_policy.jar with the original JDK installation directory C:\Program files\java\jre6\lib\security two jar package.
AES 256 algorithm in Java encounters illegal key size or default parameters wrong solution