javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException [英] javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException

查看:67
本文介绍了javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前,我可以成功地向 Web 服务发送请求并接收响应,但它现在返回以下异常.根据其他答案,我需要更新证书,但我需要知道为什么我现在收到此异常.另一个问题是,我可以找到我的 java_home 的地址,但我无法更新证书.

Previously, I could successfully send request to a web service and receive response but it now returns the following exception. Based on other answers I need to renew the certificate but I need to know why I am receiving this exception now. The other issue is that, I could find the address of my java_home but I can not renew the certificate.

例外:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed

代码

URI uri = new URI("https", "xml.example.com", "/service/ServiceRequest.do", 
                           "serverName=www.example.com&xml=" 
                           ...
                           +" ", null);

            URL page = uri.toURL();
            HttpsURLConnection conn = (HttpsURLConnection) page.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.connect();

推荐答案

问题是您正在尝试与 SSL 证书已过期的服务器通信.您收到异常的原因是 Java SSL 代码正在检查证书链,并且已经注意到问题.已过期的 SSL 证书不可信......并且不受默认证书验证器的信任.

The problem is that you are trying to talk to a server whose SSL Certificate has expired. The reason you are getting the exception is because the Java SSL code is checking the certificate chain, and has noticed the problem. A SSL certificate that has expired is not trustworthy ... and is not trusted by the default certificate validator.

我无法续订证书...

更新证书由网站所有者决定.如果这不是您,那么您无能为力……除了绕过证书验证,这对 SSL 连接安全不利.

Renewing the certificate is up to the owner of the website. If that is not you, then there is nothing you can do ... apart from bypassing validation of the certificate, which is bad for SSL connection security.

这篇关于javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆