且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误获取响应"javax.net.ssl.SSLPeerUnverifiedException:对等方未通过身份验证"

更新时间:2022-06-26 21:49:09

如果使用上述代码创建HTTPClient,则应避免SSLPeerUnverifiedException.不安全的X509TrustManager所做的一切就是接受任何对等证书,无论它们是否可信任,这都是毫无意义的.您会看到对等方根本没有发送证书.
If you create a HTTPClient with the code above, it should avoid SSLPeerUnverifiedException. All that insecure X509TrustManager does is accept any peer certificate whether trustworthy or not, which is entirely pointless. What you are seeing is that the peer hasn''t sent a certificate at all.