This error occurs when we set the key to be greater than 128 (that is, 192 or 256): illegal key size or default parameters this is because Java defaults cannot handle such a long key.
Java almost all kinds of common encryption algorithms can find the corresponding implementation. Because of the U.S. export restrictions, sun through the permissions file (Local_policy.jar, Us_export_policy.jar) to make the corresponding restrictions. So there are some problems:
The key length can not meet the requirements (such as: Java.security.InvalidKeyException:Illegal key size or default parameters);
Some algorithms are not supported, such as MD4, SHA-224 and so on.
APIs are not very convenient to use, and some common conversion aids are not available, such as Base64 encoding conversion, hexadecimal transcoding, and other tools.
Oracle provides a policy-free file on its official web site (unlimited strength Jurisdiction Policy files), and we can solve the limitation problem by simply deploying it in the JRE environment.
There is only one directory in the downloaded package, which is the JCE directory. The directory contains 4 files: README.txt, copyright.html, Local_policy.jar, and Us_export_policy.jar. The two jar files included are the files used in this configuration.
We can view the above README.txt file and you need to configure both of these jar files in the JDK's JRE environment, or in the JRE environment.
Switch to the%jdk_home%\jre\lib\security directory, covering Local_policy.jar and Us_export_policy.jar two files. Also, you may need to overwrite these two files in the%jre_home%\lib\security directory.
The ultimate goal of configuring a rights file is to enable the application to gain appropriate permissions in the running environment, and to enhance the security of the application. Typically, we install the JRE on the application server, not the JDK. Therefore, it is necessary to overwrite these two rights files in the%jre_home%\lib\security directory of the application server. Many developers tend to overlook this, leading to an accident.
To replace the paths of the Local_policy.jar and Us_export_policy.jar two files:
D:\Java\jre7\lib\security
D:\Java\jdk1.7.0_25\jre\lib\security
Where: D:\Java\jdk1.7.0_25 installation path for JDK