SSLKeyException:致命警报:BAD_CERTIFICATE - 收到损坏或无法使用的证书
我正在尝试从 JDeveloper IDE 中生成的 java 客户端使用 .NET Web 服务。 我有服务器和客户端证书。 我在 SoupUI 中成功调用了此服务,只需为请求指定 *SSL Keystore=client_cert.pfx* 即可。 我通过以下命令将服务器证书添加到 java 密钥库:
keytool -import -alias client_alias -file client_cert.cer - 密钥库证书
当我尝试运行我的独立 java 客户端时,我得到 javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - 收到损坏或无法使用的证书。
以下是堆栈跟踪:
jdk160_21\bin\javaw.exe -client -agentlib:jdwp=传输=dt_socket,服务器=y,地址=49995 -classpath C:\JDeveloper\777\Application1.adf;C:\JDeveloper\777\Application1\Client\classes;C:\Oracle\Middleware\wlserver_10.3\server\lib\w eblogic.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.jrf_11.1.1\jrf.jar;C:\Oracle\Middleware\modules\com.oracle.toplink _1.0.0.0_11-1-1-4-0.jar;C:\Oracle\Middleware\modules\org.eclipse.persistence_1.0.0.0_2-1.jar;C:\Oracle\Middleware\modules\com.是a.core.antlr.runtime_2.7.7.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.toplink_11.1.1\javax.persistence_2.0_preview.jar -Djavax.net.ssl.trustStore=C:\Oracle\Middleware\wlserver_10.3\server\lib\DemoTrust.jks -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888 -Dhttp.nonProxyHosts=<-loopback>|localhost|localhost.localdomain|127.0.0.1|::1-Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8888 -Dhttps.nonProxyHosts=<-loopback>|localhost|localhost.localdomain|127.0.0.1|::1| client.proxy.WSHttpBinding_IQueryServiceClient 监听传输 dt_socket 地址:49995 调试器已连接到本地进程。 <27042299 SSL3/TLS MAC> <27042299 收到握手> (来源不明)位于 com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(未知 来源)于 com.certicom.tls.record.MessageInterpreter.interpretContent(未知 来源)于 com.certicom.tls.record.MessageInterpreter.decryptMessage(未知 来源)位于 com.certicom.tls.record.ReadHandler.processRecord(未知 来源)位于 com.certicom.tls.record.ReadHandler.readRecord(未知 来源)于 com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(未知 来源)于 com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(未知 来源)位于 com.certicom.tls.record.WriteHandler.write(来源未知) 在 com.certicom.io.OutputSSLIOStreamWrapper.write(来源未知) java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) 在 java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) 在 java.io.FilterOutputStream.flush(FilterOutputStream.java:123) 处 weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:162) 在 weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:376) 在 weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37) 在 weblogic.net.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:720) 在 weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:980) 在 com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:215) 在 com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204) 在 com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124) 在 com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121) 在 com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866) 处 com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815) 在 com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778) 在 com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680) 在 com.sun.xml.ws.client.Stub.process(Stub.java:272) 位于 com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153) 在 com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115) 在 com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95) 在 com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136) 处 $Proxy34.getListForDropdown(来源未知)位于 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在 java.lang.reflect.Method.invoke(Method.java:597) 处 weblogic.wsee.jaxws.spi.ClientInstanceInitationHandler.invoke(ClientInstanceInitationHandler.java:84) 在 $Proxy35.getListForDropdown(来源不明) client.proxy.WSHttpBinding_IQueryServiceClient.main(WSHttpBinding_IQueryServiceClient.java:66)
<块引用>javax.xml.ws.WebServiceException:javax.net.ssl.SSLKeyException:致命 警报:BAD_CERTIFICATE - 证书已损坏或无法使用 已收到。在 com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:218) 在 com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204) 在 com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124) 在 com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121) 在 com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866) 处 com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815) 在 com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778) 在 com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680) 在 com.sun.xml.ws.client.Stub.process(Stub.java:272) 位于 com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153) 在 com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115) 在 com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95) 在 com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136) 处 $Proxy34.getListForDropdown(来源未知)位于 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在 java.lang.reflect.Method.invoke(Method.java:597) 处 weblogic.wsee.jaxws.spi.ClientInstanceInitationHandler.invoke(ClientInstanceInitationHandler.java:84) 在 $Proxy35.getListForDropdown(来源不明) client.proxy.WSHttpBinding_IQueryServiceClient.main(WSHttpBinding_IQueryServiceClient.java:66) 引起原因:javax.net.ssl.SSLKeyException:致命警报:BAD_CERTIFICATE - 收到损坏或无法使用的证书。在 com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(未知 来源)于 com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(未知 来源)于 com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(未知 来源)于 com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(未知 来源)于 com.certicom.tls.record.MessageInterpreter.interpretContent(未知 来源)位于 com.certicom.tls.record.MessageInterpreter.decryptMessage(未知 来源)位于 com.certicom.tls.record.ReadHandler.processRecord(未知 来源)位于 com.certicom.tls.record.ReadHandler.readRecord(未知 来源)位于 com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(未知 来源)于 com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(未知 来源)位于 com.certicom.tls.record.WriteHandler.write(来源未知) 在 com.certicom.io.OutputSSLIOStreamWrapper.write(来源未知) java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) 在 java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) 在 java.io.FilterOutputStream.flush(FilterOutputStream.java:123) 处 weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:162) 在 weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:376) 在 weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37) 在 weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:965) 在 com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:215) ... 20 更多
请帮忙!感谢您的任何建议。
I am trying to consume a .NET web service from java client generated in JDeveloper IDE.
I have server and client certificates. I successfully call this service in SoupUI, just by specifying *SSL Keystore=client_cert.pfx* for Request.
I add server certificate to the java keystore by the following command:
keytool -import -alias client_alias -file client_cert.cer -keystore cacerts
When I try to run my standalone java client I get
javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
Here is the stacktrace:
jdk160_21\bin\javaw.exe -client
-agentlib:jdwp=transport=dt_socket,server=y,address=49995 -classpath C:\JDeveloper\777\Application1.adf;C:\JDeveloper\777\Application1\Client\classes;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.jrf_11.1.1\jrf.jar;C:\Oracle\Middleware\modules\com.oracle.toplink_1.0.0.0_11-1-1-4-0.jar;C:\Oracle\Middleware\modules\org.eclipse.persistence_1.0.0.0_2-1.jar;C:\Oracle\Middleware\modules\com.bea.core.antlr.runtime_2.7.7.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.toplink_11.1.1\javax.persistence_2.0_preview.jar
-Djavax.net.ssl.trustStore=C:\Oracle\Middleware\wlserver_10.3\server\lib\DemoTrust.jks
-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888 -Dhttp.nonProxyHosts=<-loopback>|localhost|localhost.localdomain|127.0.0.1|::1-Dhttps.proxyHost=127.0.0.1
-Dhttps.proxyPort=8888 -Dhttps.nonProxyHosts=<-loopback>|localhost|localhost.localdomain|127.0.0.1|::1|
client.proxy.WSHttpBinding_IQueryServiceClient Listening for transport
dt_socket at address: 49995 Debugger connected to local process.<27042299 SSL3/TLS MAC>
<27042299 received HANDSHAKE>(Unknown Source) at
com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown
Source) at
com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown
Source) at
com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown
Source) at com.certicom.tls.record.ReadHandler.processRecord(Unknown
Source) at com.certicom.tls.record.ReadHandler.readRecord(Unknown
Source) at
com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown
Source) at
com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown
Source) at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source) at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123) at
weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:162)
at
weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:376)
at
weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at
weblogic.net.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:720)
at
weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:980)
at
com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:215)
at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204)
at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124)
at
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866) at
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815) at
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778) at
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680) at
com.sun.xml.ws.client.Stub.process(Stub.java:272) at
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153) at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115)
at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136) at
$Proxy34.getListForDropdown(Unknown Source) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)
at $Proxy35.getListForDropdown(Unknown Source) at
client.proxy.WSHttpBinding_IQueryServiceClient.main(WSHttpBinding_IQueryServiceClient.java:66)javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: FATAL
Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was
received. at
com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:218)
at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:204)
at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:124)
at
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:121)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866) at
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815) at
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778) at
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680) at
com.sun.xml.ws.client.Stub.process(Stub.java:272) at
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:153) at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:115)
at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136) at
$Proxy34.getListForDropdown(Unknown Source) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)
at $Proxy35.getListForDropdown(Unknown Source) at
client.proxy.WSHttpBinding_IQueryServiceClient.main(WSHttpBinding_IQueryServiceClient.java:66)
Caused by: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE
- A corrupt or unuseable certificate was received. at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown
Source) at
com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown
Source) at
com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown
Source) at
com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown
Source) at
com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown
Source) at
com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown
Source) at com.certicom.tls.record.ReadHandler.processRecord(Unknown
Source) at com.certicom.tls.record.ReadHandler.readRecord(Unknown
Source) at
com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown
Source) at
com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown
Source) at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source) at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123) at
weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:162)
at
weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:376)
at
weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at
weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:965)
at
com.sun.xml.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:215)
... 20 more
Please help! Thanks for any advice you may have.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论