为什么两个tls协议版本tls 1.2和tls 1.3在重载下交替使用?

shstlldc  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(252)

我使用springrest模板对外部api进行get请求调用。此api尚不支持tls 1.3。在正常工作负载期间,与服务的连接工作正常。
在负载测试期间,我观察到一些调用失败,出现以下异常:

Remote host terminated the handshake; nested exception is javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:748)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:583)

在启用javax.debug级别日志时,发现对于失败的调用,使用tls1.3协议进行握手。

javax.net.ssl|DEBUG|9D|http-nio-8080-exec-28|2021-02-09 16:34:59.588 UTC|SSLSocketOutputRecord.java:71|WRITE:**TLS12**alert(close_notify), length = 10

javax.net.ssl|DEBUG|06 87|http-nio-8080-exec-176|2021-02-09 16:34:08.621 UTC|SSLSocketOutputRecord.java:71|WRITE:**TLS13**alert(handshake_failure), length = 2

我的应用程序是用Java11[OpenJDK11.0.3]实现的。Java11还支持TLS1.3。为了解决这个问题,我必须强制它使用tls1.2。
我想了解一下,java是如何决定tls协议版本的?在这种情况下,tls1.2和tls1.3交替使用。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题