`

InvalidKeyException: Illegal key size & SecurityException: The jurisdiction poIn

阅读更多
参考链接:http://www.cnblogs.com/gdayq/p/5919252.html
报错1:
java.security.InvalidKeyException: Illegal key size

报错2:
java.lang.SecurityException: The jurisdiction policy files are not signed by a trusted signer!
	at javax.crypto.JarVerifier.verifyPolicySigned(JarVerifier.java:289)
	at javax.crypto.JceSecurity.loadPolicies(JceSecurity.java:318)
	at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:263)
	at javax.crypto.JceSecurity.access$000(JceSecurity.java:48)
	at javax.crypto.JceSecurity$1.run(JceSecurity.java:78)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:76)
	at javax.crypto.Cipher.getInstance(Cipher.java:499)

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
	at javax.crypto.Cipher.getInstance(Cipher.java:499)
	at com.jd.common.web.DotnetAuthenticationUtil.encrypt(DotnetAuthenticationUtil.java:113)

是jdk不兼容的问题,我本地以及同事的测试环境都是jdk1.7,而我搭建的环境用的是jdk1.8

解决方案如下:

处理办法: 在官方网站下载JCE无限制权限策略文件

JDK7的下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
JDK8的下载地址:
[url]http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html [/url]
下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt
如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件
如果安装了JDK,还要将两个jar文件也放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics