websphere ssl握手失败

时间:2018-05-07 09:35:10

标签: java ssl https websphere

我正在使用rad与websphere版本8.0.0.9,我收到错误

[7/5/2018 12:27:46:973 EEST] 0000002d webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[gr.mess.web.servlets.LoginServlet]: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at com.ibm.jsse2.o.a(o.java:32)
    at com.ibm.jsse2.o.a(o.java:3)
    at com.ibm.jsse2.SSLSocketImpl.b(SSLSocketImpl.java:817)
    at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:500)
    at com.ibm.jsse2.SSLSocketImpl.h(SSLSocketImpl.java:645)
    at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:138)
    at com.ibm.jsse2.SSLSocketImpl.startHandshake(SSLSocketImpl.java:268)
    at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:165)
    at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:27)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1043)
    at com.ibm.net.ssl.www2.protocol.https.b.getOutputStream(b.java:62)
    at gr.mess.web.servlets.LoginServlet.routeeAuthenticate(LoginServlet.java:131)
    at gr.mess.web.servlets.LoginServlet.doPost(LoginServlet.java:100)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:914)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:816)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1702)

我正在尝试连接到https://www.routee.net/短信api。两个月前,我尝试了它,它是成功的,但现在我尝试我似乎无法连接。我尝试了许多事情,如使用充气城堡供应商与他们的罐子(为jdk 1.6),添加local_policy.jar和US_export_policy.jar。我还尝试从websphere安全管理员更改安全设置更改ssl tsl版本的ssl设置,但似乎没有什么对我有用。我也试图从端口接收证书,但同样的ssl握手错误发生。我试图接收证书其他网址,但这次我成功了(例如www.google.com)。这将是什么情况?jdk 1.6,特定网址的东西?有什么建议吗?

以下是我发现的两个月前工作的连接代码示例

 private String routeeAuthenticate() throws MalformedURLException, IOException {
         /*  Base64.Encoder encoder = Base64.getEncoder();*/

    /*   String toEncode = "Encoding and Decoding in Base64 Test";*/
        //Encoding in b64
        /* routeeAppId.getBytes()*/
    /*  System.out.println(encoded);
        //Decoding in b64
        byte[] decodeResult = new BASE64Decoder().decodeBuffer(encoded);
        System.out.println(new String(decodeResult));*/

           String authString = routeeAppId + ":" + routeeAppSecret;
           String token = new BASE64Encoder().encode(authString.getBytes());
           //String token = encoder.encodeToString(authString.getBytes());
           String accessToken = "";
           URL url = new URL("https://auth.routee.net/oauth/token");
           HttpURLConnection connection = (HttpURLConnection) url.openConnection();
           connection.setRequestMethod("POST");
           connection.setRequestProperty("Authorization", "Basic " + token);
           connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           connection.setDoOutput(true);
           DataOutputStream wr = new DataOutputStream (connection.getOutputStream());
           wr.writeBytes("grant_type=client_credentials");
           wr.close();
           BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
           String inputLine;
           StringBuffer response = new StringBuffer();
           while ((inputLine = in.readLine()) != null) {
               response.append(inputLine);
           }
           in.close();
           try {
               JSONParser parser = new JSONParser();
               JSONObject jsonObject = (JSONObject)parser.parse(response.toString());
               accessToken = (String) jsonObject.get("access_token");
               System.out.println("AccessToken======"+accessToken+"!!!");
           } catch (Exception e) {
               e.printStackTrace();
           }
           return accessToken;
        }

1 个答案:

答案 0 :(得分:3)

您要使用的URL似乎需要TLSv1.2和ECC密码。您是否可以使Webphere使用SSL_TLSv2或TLSv1.2。要使WebSphere使用具有HIGH安全级别的ECC密码,您需要将安全属性com.ibm.websphere.ssl.include.ECCiphers设置为true。

您可以在知识中心找到相关信息:https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/usec_seccustomprop.html

或在此处的Stackoverflow中:https://developer.ibm.com/answers/questions/303331/how-can-i-enable-elliptical-curve-cryptography-ecc/