{"action":"opened","issue":{"url":"https://api.github.com/repos/Wechat-Group/weixin-java-tools/issues/357","repository_url":"https://api.github.com/repos/Wechat-Group/weixin-java-tools","labels_url":"https://api.github.com/repos/Wechat-Group/weixin-java-tools/issues/357/labels{/name}","comments_url":"https://api.github.com/repos/Wechat-Group/weixin-java-tools/issues/357/comments","events_url":"https://api.github.com/repos/Wechat-Group/weixin-java-tools/issues/357/events","html_url":"https://github.com/Wechat-Group/weixin-java-tools/issues/357","id":267879816,"number":357,"title":"退款通知回调时，wxService.parseRefundNotifyResult抛出Illegal key size or default parameters异常","user":{"login":"tenonersoft","id":23117482,"avatar_url":"https://avatars0.githubusercontent.com/u/23117482?v=4","gravatar_id":"","url":"https://api.github.com/users/tenonersoft","html_url":"https://github.com/tenonersoft","followers_url":"https://api.github.com/users/tenonersoft/followers","following_url":"https://api.github.com/users/tenonersoft/following{/other_user}","gists_url":"https://api.github.com/users/tenonersoft/gists{/gist_id}","starred_url":"https://api.github.com/users/tenonersoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tenonersoft/subscriptions","organizations_url":"https://api.github.com/users/tenonersoft/orgs","repos_url":"https://api.github.com/users/tenonersoft/repos","events_url":"https://api.github.com/users/tenonersoft/events{/privacy}","received_events_url":"https://api.github.com/users/tenonersoft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-24T02:48:56Z","updated_at":"2017-10-24T02:48:56Z","closed_at":null,"author_association":"NONE","body":"退款通知回调时，wxService.parseRefundNotifyResult抛出Illegal key size or default parameters异常\r\n具体为 cipher.init(Cipher.DECRYPT_MODE, key);时报错\r\n/**\r\n\r\n从xml字符串创建bean对象\r\n\r\n@Param xmlString xml字符串\r\n\r\n@Param mchKey 商户密钥\r\n*/\r\npublic static WxPayRefundNotifyResult fromXML(String xmlString, String mchKey) throws WxPayException {\r\nWxPayRefundNotifyResult result = WxPayBaseResult.fromXML(xmlString, WxPayRefundNotifyResult.class);\r\nString reqInfoString = result.getReqInfoString();\r\ntry {\r\nCipher cipher = Cipher.getInstance(\"AES/ECB/PKCS5Padding\");\r\n\r\nfinal MessageDigest md5 = MessageDigest.getInstance(\"MD5\");\r\nmd5.update(mchKey.getBytes());\r\nfinal String keyMd5String = new BigInteger(1, md5.digest()).toString(16).toLowerCase();\r\nSecretKeySpec key = new SecretKeySpec(keyMd5String.getBytes(), \"AES\");\r\ncipher.init(Cipher.DECRYPT_MODE, key);//这一句出错\r\nresult.setReqInfo(ReqInfo.fromXML(new String(cipher.doFinal(Base64.decodeBase64(reqInfoString)))));\r\n} catch (Exception e) {\r\nthrow new WxPayException(\"解密退款通知加密信息时出错\", e);\r\n}\r\n\r\nreturn result;\r\n}\r\n使用的2.8.3.BETA版本"}}
{"actor":{"display_login":"tenonersoft"}}