【发布时间】:2016-01-25 22:04:56
【问题描述】:
我使用 Java 程序(使用 HttpUrlConnection)向网站发送 http 请求并从那里下载文件。
网站是“https”并使用证书。
当我尝试运行我的代码时出现异常:
cause javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我试图用我的浏览器(Mozilla)访问这个网站。当我检查证书时,有三个证书。该网站包含这些证书。
DigiCert 高保证 EV 根 CA
-DigiCert 高保证 CA-3
-thecompanycert(由 DigiCert High Assurance CA-3 颁发)
然后我用 keytool 检查了我的 trustsroe。信任库只有根 CA。 是否足够或者我必须导入其他 2 个证书?还是只有-thecompanycert?
将中间证书添加到 java 信任库有什么风险? 我必须这样做吗?
有人可以帮忙吗?
【问题讨论】:
-
将完整的证书链导入到trustore
标签: java http ssl https certificate