1
回答
HTTPS握手不成功
华为云实践训练营,热门技术免费实践!>>>   

在使用jdk1.6发送https请求的时候有事后能握手成功有时候会报下面的错误,也有绕开证书验证。最后看了一下源代码,发现是在底层socket请求的时候获取证书返回的是null,不知道怎么解决,用1.8的就能稳定访问,对方使用是自制证书和用Nginx发布的

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
    at com.sun.net.ssl.internal.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:352)
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:437)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1138)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1076)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1050)
    at com.nbtv.commons.http.HttpClientUtils.sendGetRequest(HttpClientUtils.java:524)

<无标签>
举报
git用户1107145
发帖于8个月前 1回/153阅
顶部