gpt4 book ai didi

java - JDK-11 SSLHandshakeException : No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

转载 作者:行者123 更新时间:2023-12-05 06:05:52 25 4
gpt4 key购买 nike

在使用 jdk-11 (Oracle 11.0.10) 建立 HTTPS 连接时出现此错误

javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at java.base/sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:170) ~[na:na]
at java.base/sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98) ~[na:na]
at java.base/sun.security.ssl.TransportContext.kickstart(TransportContext.java:221) ~[na:na]
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:394) ~[na:na]
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:373) ~[na:na]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) ~[httpclient-4.5.13.jar:4.5.13]

我已经尝试禁用或编辑 jdk.tls.disabledAlgorithms 但仍然是同样的问题。
我编辑的java.security在-C:\Program Files\Java\jdk-11.0.10\conf\security

最佳答案

此异常是由于 TLSv1 和 TLSv1.1 弃用所致。

从 OpenJDK 8u292 开始,11.0.11 开始和所有版本的 OpenJDK 16 read here ,所有 TLS 连接都需要使用 TLSv1.2 或 TLSv1.3 版本。您可以通过设置 Java 系统属性来设置要使用的 TLS 版本。

For HTTPS connections that use HttpsURLConnection: System.setProperty("https.protocols", "TLSv1.2");

Fot SMTPS connections: System.setProperty("mail.smtp.ssl.protocols", "TLSv1.2");

Fot POP3S connections: System.setProperty("mail.pop3s.ssl.protocols", "TLSv1.2");

在客户端源之前使用上述命令。

关于java - JDK-11 SSLHandshakeException : No appropriate protocol (protocol is disabled or cipher suites are inappropriate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65939532/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com