gpt4 book ai didi

java - 收到致命警报 : handshake_failure when loading html from url

转载 作者:太空宇宙 更新时间:2023-11-03 14:07:42 25 4
gpt4 key购买 nike

我有一段代码昨天运行良好,今天却抛出异常:该代码在我尝试过的所有其他网站上都有效..

代码:

String line = "", all = "",URL="https://www.website.co.il/";
URL myUrl = null;
BufferedReader in = null;
try {
myUrl = new URL(URL);
in = new BufferedReader(new InputStreamReader(myUrl.openStream(),"UTF-8"));

while ((line = in.readLine()) != null) {
all += line;
all+='\n';
}
} finally {
if (in != null) {
in.close();
}
}

异常:

Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)

谁能看出问题所在?网站所有者能否改变一些可能产生如此大变化的东西?

最佳答案

SSL Labs report该站点表示它仅支持 Java 不支持的 TLS_RSA_WITH_AES_256_CBC_SHA 密码套件。如果您查看报告的握手模拟部分,您会看到为 Java 6、7 和 8 模拟的握手都失败了。

编辑:正如@Robert 在评论中指出的那样,安装 Unlimited Strength Policy Files 将在 Java 中添加对该密码套件的支持,使您的客户端能够与该站点进行通信。

Supported cipher suites showing only TLS_RSA_WITH_AES_256_CBC_SHA

Handshake simulation for Java clients indicating failure

关于java - 收到致命警报 : handshake_failure when loading html from url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38016907/

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