收藏
回答

接入V3支付问题?

我在使用平台提供的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)
回答关注问题邀请回答
收藏

2 个回答

  • Memory
    Memory
    2023-06-08

    2023-06-08
    有用 1
    回复 1
    • Eden
      Eden
      2023-07-20
      初始化config前加上Security.setProperty("crypto.policy","unlimited");去除限制代码行后,验证第二种方法无效
      2023-07-20
      回复
  • Eden
    Eden
    2023-07-20
    初始化config前加上Security.setProperty("crypto.policy","unlimited");去除限制代码行后,验证第二种方法无效
    
    2023-07-20
    有用
    回复
登录 后发表内容