我在使用平台提供的SDK 进行开发的时候
初始化cofig时
Resource resource = resourceLoader.getResource(wechatPayProperties.getPrivateKey());
Config config = new RSAAutoCertificateConfig.Builder()
.merchantId(wechatPayProperties.getMchId())
.privateKeyFromPath(resource.getFile().getPath())
.merchantSerialNumber(wechatPayProperties.getMchSerialNo())
.apiV3Key(wechatPayProperties.getApiV3Key())
.build();
报错入下:
java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
at com.wechat.pay.java.core.cipher.AbstractAeadCipher.decrypt(AbstractAeadCipher.java:83)
at com.wechat.pay.java.core.certificate.AbstractAutoCertificateProvider.decryptCertificate(AbstractAutoCertificateProvider.java:157)
at com.wechat.pay.java.core.certificate.AbstractAutoCertificateProvider.downloadAndUpdate(AbstractAutoCertificateProvider.java:122)
at com.wechat.pay.java.core.certificate.AbstractAutoCertificateProvider.<init>(AbstractAutoCertificateProvider.java:89)
at com.wechat.pay.java.core.certificate.AbstractAutoCertificateProvider.<init>(AbstractAutoCertificateProvider.java:49)
at com.wechat.pay.java.core.certificate.RSAAutoCertificateProvider.<init>(RSAAutoCertificateProvider.java:32)
at com.wechat.pay.java.core.certificate.RSAAutoCertificateProvider.<init>(RSAAutoCertificateProvider.java:21)
at com.wechat.pay.java.core.certificate.RSAAutoCertificateProvider$Builder.build(RSAAutoCertificateProvider.java:111)
at com.wechat.pay.java.core.RSAAutoCertificateConfig$Builder.build(RSAAutoCertificateConfig.java:114)
初始化config前加上Security.setProperty("crypto.policy","unlimited");去除限制代码行后,验证第二种方法无效