Exception java.security.InvalidKeyException: illegal Key Size solution

java.security.InvalidKeyException: Illegal key size

at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1024)

 

Will throw java.security.InvalidKeyException: Illegal key size exception. Because the key length is limited, the java runtime environment reads the limited policy file. The file is located in ${java_home}/jre/lib/security, This restriction is because of U.S. controls on software exports.

Solution: Download the JCE unrestricted permission policy file from the official website

JDK7 download address:  http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
JDK8 download address:  http://www.oracle.com/technetwork/java /javase/downloads/jce8-download-2133166.html is 
downloaded and decompressed, you can see local_policy.jar, US_export_policy.jar and readme.txt
If JRE is installed, put the two jar files in the %JRE_HOME%\lib\security directory
If the JDK is installed, the two jar files should also be placed in the %JDK_HOME%\jre\lib\security directory to overwrite the original files .

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326491818&siteId=291194637