收到 HANDSHAKE_FAILURE 警报

发布于 2024-11-30 15:20:23 字数 5345 浏览 3 评论 0原文

我正在编写一个 Java 客户端(在 weblogic 10.3 上)来调用安全的 Web 服务。 我已获得客户端证书,该证书已安装在 cacerts、DemoIdentity.jks 和 DemoTrust,jks 中 在我的 weblogic 中,我已将密钥库设置为 DemoIdentity 和 DemoTrust。 在 weblogic 控制台我已经设置 “双向客户端证书行为:”为“请求但未强制执行客户端证书”。 对于“启用 SSL 监听端口:”,我已选中该复选框。

我在尝试访问 Web 服务时遇到以下异常:

] FaultActor [null] Detail [<detail><bea_fault:stacktrace xmlns:bea_fault="http:
//www.bea.com/servers/wls70/webservice/fault/1.0.0">javax.net.ssl.SSLHandshakeEx
ception: [Security:090497]HANDSHAKE_FAILURE alert received from ************** Check both sides of the SSL configuration for mismatches in supported ciphers, supported protocol versions, trusted CAs, and hos
tname verification settings.
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknow
n Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertReceived(Un
known Source)
        at com.certicom.tls.record.alert.AlertHandler.handle(Unknown Source)
        at com.certicom.tls.record.alert.AlertHandler.handleAlertMessages(Unknow
n Source)
        at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown S
ource)
        at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Sou
rce)
        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(Unknow
n Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Un
known 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.j
ava:158)
        at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.
java:363)
        at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLC
onnection.java:37)
        at weblogic.wsee.connection.transport.TransportUtil.getInputStream(Trans
portUtil.java:85)
        at weblogic.wsee.connection.transport.http.HTTPClientTransport.receive(H
TTPClientTransport.java:271)
        at weblogic.wsee.connection.soap.SoapConnection.receive(SoapConnection.j
ava:485)
        at weblogic.wsee.ws.dispatch.client.ConnectionHandler.handleResponse(Con
nectionHandler.java:179)
        at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.
java:287)
        at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.
java:271)
        at weblogic.wsee.ws.dispatch.client.ClientDispatcher.handleResponse(Clie
ntDispatcher.java:213)
        at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDisp
atcher.java:150)
        at weblogic.wsee.ws.WsStub.invoke(WsStub.java:87)
        at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:339)
        at sips_cn_contract.PaymentService_Stub.processPaymentWebInit(Unknown So
urce)
        at uk.gov.gateway.payments.SipsStartupController.handleRequest(SipsStart
upController.java:73)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.ha
ndle(SimpleControllerHandlerAdapter.java:45)
        at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche
rServlet.java:485)
        at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(Frame
workServlet.java:342)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServl
et.java:318)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:300)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:183)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.doIt(WebAppServletContext.java:3686)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3650)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2268)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:2174)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1446)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
</bea_fault:stacktrace></detail>]; nested exception is:

但是在 Firefox 中,我添加了证书,当我查看 Web 服务的 wsdl 时。它会提示我输入证书,在我单击“确定”后,它会呈现 wsdl用于安全 Web 服务的文件。 有人知道我应该做什么才能让客户端使用 Java 工作吗?

I am writing a Java client (on weblogic 10.3) to invoke a secure web service.
I have been provided with a client certificate which I have installed in cacerts, DemoIdentity.jks and DemoTrust,jks
In my weblogic I have set up keystore as DemoIdentity and DemoTrust.
In weblogic console I have set
"Two Way Client Cert Behavior:" as "Client Certs requested but not enforced".
and for "SSL Listen Port enabled:" I have checked the checkbox.

I get the below exception while trying to access the web service:

] FaultActor [null] Detail [<detail><bea_fault:stacktrace xmlns:bea_fault="http:
//www.bea.com/servers/wls70/webservice/fault/1.0.0">javax.net.ssl.SSLHandshakeEx
ception: [Security:090497]HANDSHAKE_FAILURE alert received from ************** Check both sides of the SSL configuration for mismatches in supported ciphers, supported protocol versions, trusted CAs, and hos
tname verification settings.
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknow
n Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertReceived(Un
known Source)
        at com.certicom.tls.record.alert.AlertHandler.handle(Unknown Source)
        at com.certicom.tls.record.alert.AlertHandler.handleAlertMessages(Unknow
n Source)
        at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown S
ource)
        at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Sou
rce)
        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(Unknow
n Source)
        at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Un
known 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.j
ava:158)
        at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.
java:363)
        at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLC
onnection.java:37)
        at weblogic.wsee.connection.transport.TransportUtil.getInputStream(Trans
portUtil.java:85)
        at weblogic.wsee.connection.transport.http.HTTPClientTransport.receive(H
TTPClientTransport.java:271)
        at weblogic.wsee.connection.soap.SoapConnection.receive(SoapConnection.j
ava:485)
        at weblogic.wsee.ws.dispatch.client.ConnectionHandler.handleResponse(Con
nectionHandler.java:179)
        at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.
java:287)
        at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.
java:271)
        at weblogic.wsee.ws.dispatch.client.ClientDispatcher.handleResponse(Clie
ntDispatcher.java:213)
        at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDisp
atcher.java:150)
        at weblogic.wsee.ws.WsStub.invoke(WsStub.java:87)
        at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:339)
        at sips_cn_contract.PaymentService_Stub.processPaymentWebInit(Unknown So
urce)
        at uk.gov.gateway.payments.SipsStartupController.handleRequest(SipsStart
upController.java:73)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.ha
ndle(SimpleControllerHandlerAdapter.java:45)
        at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche
rServlet.java:485)
        at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(Frame
workServlet.java:342)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServl
et.java:318)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:300)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:183)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.doIt(WebAppServletContext.java:3686)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3650)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2268)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:2174)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1446)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
</bea_fault:stacktrace></detail>]; nested exception is:

However in firefox, i have added the certificate, and when i view the wsdl of the web service.It prompts me with the certificate and after i click ok, it renders the wsdl file for secure web service.
Anybody has idea what should I do to make the client working using Java?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜心 2024-12-07 15:20:23

我认为真正的问题是 Weblogic 没有使用 JDK 提供的标准 Sun HTTPS 实现,而是使用它自己的实现,如这一行所示:

at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)

标准 Sun 实现类称为 javax.net.ssl.HttpsURLConnection< /代码>。

因此,Weblogic 内部的证书策略与独立 Java 程序中的证书策略不同。我刚刚发现这个调试类似的问题。

本页建议使用 Sun 实现而不是 Weblogic:
http://webtech-kapil.blogspot.com/2010/06/javalangclasscastException.html

他们建议使用以下标志启动 WL:

-DUseSunHttpHandler=true

它将使用标准 Sun 的 SSL 实现。不过,我个人还没有尝试过这个。

谢谢,

伊戈尔

I think that the real problem is that Weblogic is not using standard Sun HTTPS implementation provided by JDK, but rather uses its own, as apparent on this line:

at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)

The standard Sun implementation class is called javax.net.ssl.HttpsURLConnection.

As a result, the certificate policy is different inside Weblogic than in a standalone Java program. I just discovered this debugging a similar problem.

This page advises to use a Sun implementation instead of Weblogic:
http://webtech-kapil.blogspot.com/2010/06/javalangclasscastexception.html

They advice to start WL with the following flag:

-DUseSunHttpHandler=true

which will use standard Sun's implementation of SSL. However, I personally have not tried this yet.

Thanks,

Igor

机场等船 2024-12-07 15:20:23

您可能没有正确导入证书和密钥。您可以通过将以下内容添加到 JUnit 或类似内容来测试您的密钥库:

static {
        System.setProperty("javax.net.ssl.keyStoreType", "pkcs12"); // or whatever
        System.setProperty("javax.net.ssl.keyStore", "c:/folder/mycert.p12");
        System.setProperty("javax.net.ssl.keyStorePassword", "mypassword");
        System.setProperty("javax.net.debug", "ssl");
}

设置为 ssljavax.net.debug 属性将打印您的证书链和所有其他 SSL 日志记录,这可能会有所帮助。您需要将证书等添加到您的应用程序容器中,就像您在生产中已有的那样。

尝试使用 SSL 进行调试,看看会发生什么。很可能您只需要正确配置 weblogic 即可。检查是否有自定义 SSL 端点配置(即,当 URI 为 /test/test 时使用 keyStore XYZ)。

You have likely not imported your certificate and key correctly. You can test your keystore by adding the following to a JUnit or something similar:

static {
        System.setProperty("javax.net.ssl.keyStoreType", "pkcs12"); // or whatever
        System.setProperty("javax.net.ssl.keyStore", "c:/folder/mycert.p12");
        System.setProperty("javax.net.ssl.keyStorePassword", "mypassword");
        System.setProperty("javax.net.debug", "ssl");
}

The javax.net.debug property set to ssl will print your certificate chain and all other SSL logging, which can be helpful. You'll want to add the certificate, etc. to your application container like you already have in production.

Try debugging with SSL and see what comes of that. More than likely you just need to configure weblogic correctly. Check to see if there are custom SSL endpoint configurations (i.e. when URI is /test/test use keyStore XYZ).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文