When using AES encryption, when the key is greater than 128, the code throws Java.security.InvalidKeyException:Illegal key size or default parameters
Illegal key size or default parameters means that the key length is restricted, and the Java Runtime environment reads a restricted policy file. Files located in ${java_home}/jre/lib/security
This limitation is due to U.S. control over software exports.
Workaround:
Removing this restriction requires downloading the Java Cryptography Extension (JCE) Unlimited strength Jurisdiction Policy Files.
The Readme.txt of the download package has installation instructions. is to replace the Local_policy.jar and Us_export_policy.jar under ${java_home}/jre/lib/security/.
JDK 5:http://www.oracle.com/technetwork/java/javasebusiness/downloads/ Java-archive-downloads-java-plat-419418.html#jce_policy-1.5.0-oth-jpr
Jdk6:http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html
Reference Http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters
AES encryption when thrown Java.security.InvalidKeyException:Illegal key size or default Parametersillegal key size or default parameters