Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

企业付款的API,在windows上运行时,加密有些问题 #788

Closed
constanine opened this issue Oct 11, 2018 · 2 comments
Closed

企业付款的API,在windows上运行时,加密有些问题 #788

constanine opened this issue Oct 11, 2018 · 2 comments

Comments

@constanine
Copy link

constanine commented Oct 11, 2018

在windows的cmd中运行,默认是GBK2312,这样加密出来会有问题
微信返回结果如下
<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[参数错误,请检查参数]]></return_msg> <result_code><![CDATA[FAIL]]></result_code> <err_code><![CDATA[PARAM_ERROR]]></err_code> <err_code_des><![CDATA[用户真实姓名存在非UTF8字符]]></err_code_des> <nonce_str><![CDATA[1539222582130]]></nonce_str> <mch_id><![CDATA[1515170561]]></mch_id> <partner_trade_no><![CDATA[1539222572663]]></partner_trade_no> <amount>10</amount> </xml>
追查原因
com.github.binarywang.wxpay.service.impl.EntPayServiceImpl.encryptRSA(File, String)
代码中
byte[] encrypt = cipher.doFinal(srcString.getBytes());
改成
byte[] encrypt = cipher.doFinal(srcString.getBytes("UTF-8"));
是不是更合理些?
@binarywang

@binarywang
Copy link
Owner

可以

@binarywang
Copy link
Owner

3.2.1.B测试版本已包含相关代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants