且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java.security.cert.CertPathValidatorException:找不到证书路径的信任锚

更新时间:2021-10-24 05:50:17

这将禁用SSL的安全性.可以进行本地测试,但不适合实际用户使用.

This is disabling the security of SSL. This is ok for local testing but not appropriate for use with real users.

如果您使用自签名证书运行本地开发服务器,则可以通过这种方式告诉服务器以最小的痛苦连接到该服务器.

If you run your local dev server with a self signed cert then this is how you can tell it to connect to it with minimal pain.

通常,任何用户代理(Windows上的Firefox,Mac上的Safari,Android上的Safari)都将具有其信任的用于验证站点证书的根CA列表.一些较新的服务(如Let's Encrypt)将在较旧的平台上不受信任,因此您可以提前添加自己知道的证书.

More generally any user agent (Firefox on Windows, Safari on Mac, Android) will have a list of root CAs it trusts to verify a sites certificates. Some newer services like let's encrypt will not be trusted on older platforms so you can add your own certificates that you know ahead of time.

主机名验证意味着它提供的证书甚至可以用于其他站点.

The hostname verification means that the cert it serves could be for a different site even.

对于实际流量,此代码表示您的用户在中间攻击时很容易受到人为攻击.

For real traffic this code means your users are susceptible to man in the middle attacks.