javax.net.ssl.SSLKeyException:ECDH服务器密钥交换消息上的签名无效(在java中)

时间:2016-05-19 05:23:55

标签: java ssl jsoup ssl-certificate handshake

我在从java发出简单的http GET请求时遇到异常(实际上来自jsoup java api)。

javax.net.ssl.SSLKeyException: Invalid signature on ECDH server key exchange message
        at sun.security.ssl.HandshakeMessage$ECDH_ServerKeyExchange.<init>(HandshakeMessage.java:1098)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:278)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:913)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:849)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1035)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1344)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
        at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:512)
        at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:493)
        at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:205)
        at org.jsoup.helper.HttpConnection.get(HttpConnection.java:194)
        at com.ampower.scraper.data.util.DocumentUtil.test(DocumentUtil.java:205)
        at com.ampower.scraper.goolesearch.email.EmailScraper.doGoogleSearch(EmailScraper.java:87)
        at com.ampower.scraper.goolesearch.email.EmailScraper.main(EmailScraper.java:50)

这里使用java版本的iam是1.7.0_101。请建议。

2 个答案:

答案 0 :(得分:0)

可能是过期的证书问题。我偶然发现了同样的错误;在debugging the SSL/TLS Connections之后,我注意到该证书已不再有效:

Validaty: [From: date-in-the-past,
           To: date-in-the-past]

一旦更新了证书,错误就会消失。

答案 1 :(得分:-1)

请尝试以下选项之一:

选项1:JDK升级

如果可能,请更新您的JDK版本以获取更新版本,并检查是否再次遇到同一问题。

选项2:可能的已知问题

已报告similar issue。解决方案来自使用jdk.tls.client.protocols系统属性。

选项3:禁用TLS证书验证

Jsoup.connect(url).validateTLSCertificates(false).get();

选项4:调试SSL交换

在此处粘贴目标网站的网址:Comodoca's SSL analyzer

请参阅此SO answer (Wht not Java7?)中的完整详细方法。

另见: