实在没法了,我这边报错是这个一直报错的签名长度问题Last unit does not have enough valid bits有大佬解决下吗,搜了一下都说是微信什么故意发送的错误签名。。咋可能呢。我是才支付成功后回调报的这错,然后问了下Ai说是密钥错误,支付请求都完成了咋可能是密钥又错了[图片],实在没法啊。我升级支付包还是不行。。
微信支付V3回调解密错误(测试正常,上线失败)引入的SDK版本 <dependency> <groupId>com.github.wechatpay-apiv3</groupId> <artifactId>wechatpay-java</artifactId> <version>0.2.12</version> </dependency> 加密config(pem文件在resources下) private Config getConfig() { if(config == null){ PrivateKey privateKey = getPrivateKey("wechatpay/apiclient_key.pem"); config = new RSAAutoCertificateConfig.Builder() .merchantId(properties.getMch().getMchId()) .privateKey(privateKey) .merchantSerialNumber(properties.getMch().getMchSn()) .apiV3Key(properties.getMch().getApiV3Key()) .build(); } return config; } 解密config(pem文件在resources下) public NotificationConfig getNotificationConfig() { if(notificationConfig == null){ PrivateKey privateKey = getPrivateKey("wechatpay/apiclient_key.pem"); notificationConfig = new RSAAutoCertificateConfig.Builder() .merchantId(properties.getMch().getMchId()) .privateKey(privateKey) .merchantSerialNumber(properties.getMch().getMchSn()) .apiV3Key(properties.getMch().getApiV3Key()) .build(); } return notificationConfig; } ***问题: 测试环境:用natapp内网穿透映射的回调地址,回调解密正常 生产环境:用nginx代理的回调地址,回调解密失败 错误信息(****是我打的码): com.wechat.pay.java.core.exception.ValidationException: Processing WechatPay notification,signature verification failed,signType[WECHATPAY2-SHA256-RSA2048] serial[7D816CEC414164CF1C9899187865763F3******] message[1725464137 1kfL1LvqkBsHt715Tvr54Iz****** {"id":"2954fad7-e7d0-51e9-baf9-6ca*******","create_time":"2024-09-04T23:35:37+08:00","resource_type":"encrypt-resource","event_type":"TRANSACTION.SUCCESS","summary":"鏀粯鎴愬姛","resource":{"original_type":"transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"6zJ+yFafNx+Rr3Z3qn2W1Na4gvhHSMdKl5NlDO1Up5BI1JP7hW0uiJd2EMkq/7Xem3y9b2jteJXxuhDN/aeoss2lXB1WlXHedOVq3W0ZOMbWZp5oqnF/S1fPFgbrPCRe8k2011xUAmTaHZEzjZd9mDm0iuDQTjx4W2Am9hfH8vCNlE9TJPF2yyFji7A6ue0Xf3sWAQJi2Wla1AxtoOOZVRvnH4Ook3cj1lkKOnhDqHQJNyeoDiRvGsHW/I3axTkSGAJUT3UEmhArfqvD5IeubQLCXPVUD2dATmnWtb0HMVdO+ZTlgT62RTMJ0EAmN4xvTQMxqAJW9/YJ/44siBWpT84Wa6P4g427r5KnRtrGK0Lr+Ny6kuV+mEG4RE76jsHbized6YiB1CgKogBG52psX7RTBGg9IdRufQ791yhGXx1frc28k6uCyJUG***********xhyB iI+96+QQ9AXHqKJq0UY+04qfo1Xs7yzXZVPnCiqpv+LN1PY3*******","associated_data":"transaction","nonce":"6uiyqNHQ****"}} ] sign[C1JY8Jf+VeYmbALKx9qcUSBF8Vsj430YK8o+TonodqkNRegv7X**********3RAOd1Gu+K+DCJLg+D847v2pcoF7cv6tm0f+ES2a+86acT3XDELVYFIGV8ZbODg4vKoahLC2BfvKzPPayo+KUh2845nz0N1vhY4SHRUqV3hXbukuLljaaniDljRl24iXtrZkSn1FKH0aq8T1/hIILU6zNxkDjQGcBl8rMktARCRx0JUmAJwkwCZOcGiJ+NyrIO9R++YJGbET9uAm1iOuOJUwLOneeLUh+nDVpL9IvyUlBAtHF1LNtH5sAOWpbTFtLHYD/5+gYPY8IAmDw==]
11-15