You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
com.github.binarywang.wxpay.exception.WxPayException: 发生异常,解密退款通知加密信息时出错
at com.github.binarywang.wxpay.service.impl.WxPayServiceAbstractImpl.parseRefundNotifyResult(WxPayServiceAbstractImpl.java:135) ~[weixin-java-pay-2.9.0.jar:na]
at com.xhlcgy.weixin.controller.WxPayController.parseRefundNotifyResult(WxPayController.java:290) ~[classes/:na]
at
Caused by: java.security.InvalidKeyException: Invalid AES key length: 31 bytes
at com.sun.crypto.provider.AESCrypt.init(AESCrypt.java:87) ~[sunjce_provider.jar:1.8.0_112]
at com.sun.crypto.provider.ElectronicCodeBook.init(ElectronicCodeBook.java:94) ~[sunjce_provider.jar:1.8.0_112]
at com.sun.crypto.provider.CipherCore.init(CipherCore.java:591) ~[sunjce_provider.jar:1.8.0_112]
at com.sun.crypto.provider.CipherCore.init(CipherCore.java:467) ~[sunjce_provider.jar:1.8.0_112]
at com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:313) ~[sunjce_provider.jar:1.8.0_112]
at javax.crypto.Cipher.implInit(Cipher.java:802) ~[na:1.8.0_121]
at javax.crypto.Cipher.chooseProvider(Cipher.java:864) ~[na:1.8.0_121]
at javax.crypto.Cipher.init(Cipher.java:1249) ~[na:1.8.0_121]
at javax.crypto.Cipher.init(Cipher.java:1186) ~[na:1.8.0_121]
at com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult.fromXML(WxPayRefundNotifyResult.java:53) ~[weixin-java-pay-2.9.0.jar:na]
... 74 common frames omitted
在退款成功的通知消息的解析中的WxPayRefundNotifyResult.fromXML(xmlData, this.getConfig().getMchKey())方法中一直出现这个异常,最后发现是mchKey,经过加密之后的字符串是0xxxxxx,开头的,在通过
final String keyMd5String = new BigInteger(1, md5.digest()).toString(16).toLowerCase();
上面的bigInteger构造自动将 首位的0省略掉,所以字符串是31位,AES才会报错,所以建议更换其他方式转换成32位字符串
The text was updated successfully, but these errors were encountered:
异常:
在退款成功的通知消息的解析中的WxPayRefundNotifyResult.fromXML(xmlData, this.getConfig().getMchKey())方法中一直出现这个异常,最后发现是mchKey,经过加密之后的字符串是0xxxxxx,开头的,在通过
final String keyMd5String = new BigInteger(1, md5.digest()).toString(16).toLowerCase();
上面的bigInteger构造自动将 首位的0省略掉,所以字符串是31位,AES才会报错,所以建议更换其他方式转换成32位字符串
The text was updated successfully, but these errors were encountered: