Server chose TLSv1, but that protocol version is not enabled or not supported by the client.

javax.net.ssl.SSLHandshakeException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.

 报错显示:服务器端采用TLSv1 版本协议 (前身是ssl),可是客户端不支持或者未开启该版本java

我本地是开发,使用okhttp去访问的该https网站,这证实是该端协议不支持服务器

 

server:查看 本地开发端 server 支持与开启tls 信息socket

public static void main(String[] args) throws Exception { SSLContext context = SSLContext.getInstance("TLS"); context.init(null, null, null); SSLSocketFactory factory = (SSLSocketFactory) context.getSocketFactory(); SSLSocket socket = (SSLSocket) factory.createSocket(); String[] protocols = socket.getSupportedProtocols(); System.out.println("Supported Protocols: " + protocols.length); for (int i = 0; i < protocols.length; i++) { System.out.println(" " + protocols[i]); } protocols = socket.getEnabledProtocols(); System.out.println("Enabled Protocols: " + protocols.length); for (int i = 0; i < protocols.length; i++) { System.out.println(" " + protocols[i]); } }

结果:网站

Supported Protocols: 5 SSLv2Hello SSLv3 TLSv1 TLSv1.1 TLSv1.2 Enabled Protocols: 3 TLSv1 TLSv1.1 TLSv1.2
相关文章
相关标签/搜索