为什么在Ubuntu上会出现证书错误,而在Windows上却没有?

huangapple 未分类评论52阅读模式
英文:

Why do I get a certificate error on Ubuntu but not on Windows?

问题

在一个Java应用程序中,我尝试从Google Alerts(https://www.google.com/alerts/feeds/...)读取一个RSS订阅。在我的笔记本电脑上,运行着Windows 10,它可以正常工作。从Windows上的Web浏览器访问该RSS订阅的URL也能正常工作。但是,当我尝试在Ubuntu服务器(16.04.06)上运行该Java应用程序时,我会得到以下异常:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException: 无法找到到请求目标的有效认证路径

我可以通过找到我的Web浏览器信任的证书并将其存储在Ubuntu服务器上的Java应用程序正在使用的信任存储中来解决这个问题。然而,这似乎不是正确的解决方案。我认为这是一个应该被操作系统信任的根证书。在我的Web浏览器中,它被描述为“GlobalSign Root CA - R2”。当我在Windows 10笔记本电脑上运行Java应用程序时,它以某种方式找到了一个受信任的证书。这使我相信我的Ubuntu服务器上的证书可能已经过时了,或者有什么问题。

是否有比在Ubuntu服务器上的Java应用程序的信任存储中存储我找到的Web浏览器中的证书更好或更适当的解决方法呢?

英文:

In a java application, I'm trying to read an RSS feed from google alerts (https://www.google.com/alerts/feeds/...). On my laptop, running Windows 10, it works fine. Visiting the URL of the RSS feed also works fine from a web browser on Windows. But when I try running the java application on an Ubuntu server (16.04.06) I get the following exception:

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

I can work around this by finding the certificate that my web browser trusts and storing it in the trust store than my java application is using on the Ubuntu server. However, this doesn't seem like the right solution. I think this is a root certificate that should be trusted by the operating system. In my web browser it is described as "GlobalSign Root CA - R2." When I run the java application on my Windows 10 laptop it is somehow finding a certificate that it trusts. This leads me to believe that the certificates on my Ubuntu server are out of date, or something.

It there a better or more proper way of solving this problem than storing the certificate I found in my web browser in the java application's trust store on the Ubuntu server?

huangapple
  • 本文由 发表于 2020年4月9日 05:49:51
  • 转载请务必保留本文链接:https://java.coder-hub.com/61110601.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定