RSA2验签遭遇异常,请检查公钥格式是否正确。待验签内容不可为空

x33g5p2x  于11个月前 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(605)

支付宝支付,上线突然出现这个问题。

2021-09-27 22:54:37	2021-09-27 14:54:37.348 [http-nio-5020-exec-7] INFO  com.fastonetech.listener.OrderPayedListener - 支付宝回调,{}
2021-09-27 22:54:37	2021-09-27 14:54:37.348 [http-nio-5020-exec-7] ERROR o.a.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.alipay.api.AlipayApiException: RSA2验签遭遇异常,请检查公钥格式是否正确。待验签内容不可为空 content=,charset=utf-8,publicKey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg7tj75iqJOmibtbcRT+SuXFfDd3XELKgpviuI1y00y2eOI3AvIcb/feyEu8uFmDaAo+j5QWKduQl94tpYjgRkb/xGXg8zxZj047BhwyYx4mfIjKbR32HQc09AtfC4hnYsIS1WGiwtqnQDyxXEAfFffPsL1jQJmrdAPQPt7nthVAHvMQPyDuKTxtbIn9r7HJ9844jQzBfgh6eNnXGYX4Mx4AG0egWTp0nwIgG2oG6dIX3DqG7wRpVImFkLz38RoSy0/5aS8HJOninidb0OHVCoj48S5+PsgluRQ4j44qa0t2ahNU73KNAYcJ9oXc8GWUhKJM5icC2fpPLh8SaCRGaswIDAQAB] with root cause
2021-09-27 22:54:37	com.alipay.api.AlipayApiException: 待验签内容不可为空
2021-09-27 22:54:37		at com.alipay.api.internal.util.asymmetric.BaseAsymmetricEncryptor.verify(BaseAsymmetricEncryptor.java:85)
2021-09-27 22:54:37		at com.alipay.api.internal.util.AlipaySignature.rsaCheck(AlipaySignature.java:588)
2021-09-27 22:54:37		at com.alipay.api.internal.util.AlipaySignature.rsaCheckV1(AlipaySignature.java:547)
2021-09-27 22:54:37		at com.fastonetech.listener.OrderPayedListener.isSignVerified(OrderPayedListener.kt:63)
2021-09-27 22:54:37		at com.fastonetech.listener.OrderPayedListener.handleAlipayed(OrderPayedListener.kt:43)
2021-09-27 22:54:37		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-09-27 22:54:37		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2021-09-27 22:54:37		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2021-09-27 22:54:37		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2021-09-27 22:54:37		at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)
2021-09-27 22:54:37		at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)
2021-09-27 22:54:37		at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
2021-09-27 22:54:37		at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894)
2021-09-27 22:54:37		at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
2021-09-27 22:54:37		at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
2021-09-27 22:54:37		at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063)
2021-09-27 22:54:37		at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
2021-09-27 22:54:37		at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
2021-09-27 22:54:37		at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
2021-09-27 22:54:37		at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
2021-09-27 22:54:37		at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
2021-09-27 22:54:37		at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
2021-09-27 22:54:37		at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
2021-09-27 22:54:37		at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
2021-09-27 22:54:37		at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
2021-09-27 22:54:37		at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
2021-09-27 22:54:37		at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
2021-09-27 22:54:37		at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
2021-09-27 22:54:37		at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
2021-09-27 22:54:37		at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
2021-09-27 22:54:37		at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
2021-09-27 22:54:37		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
2021-09-27 22:54:37		at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
2021-09-27 22:54:37		at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
2021-09-27 22:54:37		at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
2021-09-27 22:54:37		at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
2021-09-27 22:54:37		at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
2021-09-27 22:54:37		at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
2021-09-27 22:54:37		at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:764)
2021-09-27 22:54:37		at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
2021-09-27 22:54:37		at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
2021-09-27 22:54:37		at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
2021-09-27 22:54:37		at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
2021-09-27 22:54:37		at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723)
2021-09-27 22:54:37		at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2021-09-27 22:54:37		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2021-09-27 22:54:37		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2021-09-27 22:54:37		at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
2021-09-27 22:54:37		at java.base/java.lang.Thread.run(Thread.java:829)

解决问题的思路

1、回调地址是否并更过,配置错误;我们就是http修改为https的跳转
2、公钥和私钥是否配置正确。
3、调用的支付宝的配置是否配置成功。

相关文章