wechatpay-apiv3/CertificateDownloader

下载平台证书出错

Closed this issue · 6 comments

报错:=== download begin ===
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while running command (com.elias.CertificateDownloader@18ef96): java.lang.IllegalArgumentException: Illegal base64 character 2d
at picocli.CommandLine.executeUserObject(CommandLine.java:1738)
at picocli.CommandLine.access$900(CommandLine.java:145)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1928)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2282)
at picocli.CommandLine.run(CommandLine.java:2740)
at picocli.CommandLine.run(CommandLine.java:2677)
at com.elias.CertificateDownloader.main(CertificateDownloader.java:129)
Caused by: java.lang.IllegalArgumentException: Illegal base64 character 2d
at java.util.Base64$Decoder.decode0(Unknown Source)
at java.util.Base64$Decoder.decode(Unknown Source)
at java.util.Base64$Decoder.decode(Unknown Source)
at com.wechat.pay.contrib.apache.httpclient.util.PemUtil.loadPrivateKey(PemUtil.java:36)
at com.elias.CertificateDownloader.downloadCertificate(CertificateDownloader.java:55)
at com.elias.CertificateDownloader.run(CertificateDownloader.java:105)
at picocli.CommandLine.executeUserObject(CommandLine.java:1729)
... 8 more

看栈信息,可能是商户证书私钥文件的问题,你检查下-f传入的商户证书文件,要是apiclient_key.pem的原始文件

我也遇到了这个问题
我 -f 传递的是 apiclient_key.pem 后正常了

=== download begin ===
download failed,resp code=401,body={"code":"SIGN_ERROR","detail":{"detail":{"issue":"sign not match"},"field":"signature","location":"authorization","sign_information":{"method":"GET","sign_message_length":66,"truncated_sign_message":"GET\n/v3/certificates\n1637075217\nwFqcI2DKa6gr2DJ3J14WNLEZDVwWhHwF\n\n","url":"/v3/certificates"}},"message":"错误的签名,验签失败"}
java.io.IOException: request failed
at com.elias.CertificateDownloader.downloadCertificate(CertificateDownloader.java:106)
at com.elias.CertificateDownloader.run(CertificateDownloader.java:67)
at picocli.CommandLine.executeUserObject(CommandLine.java:1729)
at picocli.CommandLine.access$900(CommandLine.java:145)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1928)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:2282)
at picocli.CommandLine.run(CommandLine.java:2740)
at picocli.CommandLine.run(CommandLine.java:2677)
at com.elias.CertificateDownloader.main(CertificateDownloader.java:155)
我也不行, 这个要怎么解决

我也遇到了这个问题 我 -f 传递的是 apiclient_key.pem 后正常了

可以把完整的命令示例截图看下不? 关键信息可以不用完整

我也遇到了这个问题 我 -f 传递的是 apiclient_key.pem 后正常了

可以把完整的命令示例截图看下不? 关键信息可以不用完整

你这个 应该还没到这一步

看着错误 或许是参数的那个文件没传对