收藏
回答

应答的微信支付签名验证失败,getCertificateTest()方法?

[main] WARN com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator - signature verify fail: serial=[] message=[

{"data":[{"effective_time":"2021-07-15T13:31:23+08:00","encrypt_certificate":{"algorithm":"AEAD_AES_256_GCM","associated_data":"certificate","ciphertext":"","nonce":"a674bf75ea55"},"expire_time":"2026-07-14T13:31:23+08:00","serial_no":""}]}

] sign=[]


org.apache.http.client.ClientProtocolException

at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)

at com.wechat.pay.contrib.apache.httpclient.HttpClientBuilderTest.getCertificateTest(HttpClientBuilderTest.java:87)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)

at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: org.apache.http.HttpException: 应答的微信支付签名验证失败

at com.wechat.pay.contrib.apache.httpclient.SignatureExec.executeWithSignature(SignatureExec.java:73)

at com.wechat.pay.contrib.apache.httpclient.SignatureExec.execute(SignatureExec.java:49)

at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)

at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)

... 27 more


回答关注问题邀请回答
收藏

1 个回答

  • 飞燕
    飞燕
    2021-09-23
    丿
    2021-09-23
    有用
    回复 1
    • 沙漠苍狼
      沙漠苍狼
      2021-09-23
      应答的微信支付签名验证失败,// 对成功应答验签
          StatusLine statusLine = response.getStatusLine();
          if (statusLine.getStatusCode() >= 200 && statusLine.getStatusCode() < 300) {
            convertToRepeatableResponseEntity(response);
            if (!validator.validate(response)) {
              throw new HttpException("应答的微信支付签名验证失败");
            }
          }




      statusLine.getStatusCode()返回的是200 ok,!validator.validate(response)这一步校验不通过,你有遇到过吗?使用的是官方的api下载到本地的
      2021-09-23
      回复
登录 后发表内容