在微信支付时,如果服务器环境安装的是JDK1.8,支付时会报错误:
Caused by: java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size at com.github.binarywang.wxpay.v3.util.AesUtils.decryptToString(AesUtils.java:74) at com.github.binarywang.wxpay.v3.auth.AutoUpdateCertificatesVerifier.deserializeToCerts(AutoUpdateCertificatesVerifier.java:197) at com.github.binarywang.wxpay.v3.auth.AutoUpdateCertificatesVerifier.autoUpdateCert(AutoUpdateCertificatesVerifier.java:163) at com.github.binarywang.wxpay.v3.auth.AutoUpdateCertificatesVerifier.<init>(AutoUpdateCertificatesVerifier.java:111) at com.github.binarywang.wxpay.config.WxPayConfig.initApiV3HttpClient(WxPayConfig.java:281) ... 118 common frames omitted Caused by: java.security.InvalidKeyException: Illegal key size at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039) at javax.crypto.Cipher.implInit(Cipher.java:805) at javax.crypto.Cipher.chooseProvider(Cipher.java:864) at javax.crypto.Cipher.init(Cipher.java:1396) at javax.crypto.Cipher.init(Cipher.java:1327) at com.github.binarywang.wxpay.v3.util.AesUtils.decryptToString(AesUtils.java:67) ... 122 common frames omitted
由于默认JDK8是不能使用PBEWITHMD5ANDTRIPLEDES等高强度加密算法的,
需要把jce_policy-8.zip中的两个jar包拷贝到<JRE_HOME>\lib\security下面,
替换掉两个原有的同名文件,以开启对高强度加密算法支持
jce_policy-8.zip可以去Oracle官网下载。
0条评论
点击登录参与评论