- InvalidKeyException: Illegal key size
下载平台证书接口成功后,在解密的过程中 Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); SecretKeySpec key = new SecretKeySpec(aesKey, "AES"); GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce); cipher.init(Cipher.DECRYPT_MODE, key, spec); //运行这里报错 java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
2021-04-07 - 实例化verifier过程中报错
AutoUpdateCertificatesVerifier verifier = new AutoUpdateCertificatesVerifier( new WechatPay2Credentials(AppPayController.mchId, new PrivateKeySigner(AppPayController.mchSerialNo, merchantPrivateKey)), AppPayController.apiV3Key.getBytes("utf-8")); 报错 ==============异常开始============= java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:42) at com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier.deserializeToCerts(AutoUpdateCertificatesVerifier.java:138) 已按照网上说的 下载了UnlimitedJCEPolicyJDK8 解压后 覆盖掉了 jre1.8/lib/security 下面的local_policy.jar和US_export_policy.jar 可是并没有解决问题 实例化还是会出现这个报错 求帮助 pom.xml <dependency> <groupId>com.github.wechatpay-apiv3</groupId> <artifactId>wechatpay-apache-httpclient</artifactId> <version>0.2.1</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.12</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4</version> </dependency>
2021-03-24 - java 微信支付 APP V3版 在实例化verifier时报错
AutoUpdateCertificatesVerifier verifier = new AutoUpdateCertificatesVerifier( new WechatPay2Credentials(AppPayController.mchId, new PrivateKeySigner(AppPayController.mchSerialNo, merchantPrivateKey)), AppPayController.apiV3Key.getBytes("utf-8")); 实例化报错 ==============异常开始============= java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size 上网查后 说是jdk 里没有无限制权限策略 重新按照网址在oracle下载了jdk1.8 JCE无限制权限策略文件.zip 并在jre/lib/security中替换掉了local_policy.jar和US_export_policy.jar 但是并没有解决问题
2021-03-24