如何使用来自 chrome、firefox 或任何浏览器的 public keys/certs 创建一个 SSLEngine?

How to create an SSLEngine with all the same public keys/certs from chrome, firefox or any browser?

是否可以使用随 Chrome 安装的证书创建 SSLEngine?我记得默认情况下它安装了相当多的权限 public 证书。

我认为,由于 chrome 适用于我所知道的所有网站,因此会更详尽一些,并且仅安装 chrome 并依赖它会更容易。

谢谢, 院长

据我所知,每个浏览器都使用它自己的证书存储。基本上有三种解决方案:一种是静态的,一种是动态的,一种是"good enough"。我们开始:

  1. 静态解决方案 - 您阅读文档,了解如何从浏览器的存储中读取证书(或整个链),手动导出它们并将它们全部导入 Java 的 cacerts存储空间或您的自定义存储空间。

  2. 动态解决方案 - 与上述基本相同,但您在应用程序启动期间执行。

  3. 懒惰但足够好的解决方案 - 您什么都不做,希望 cacerts JKS 中的证书与浏览器中的证书几乎相同,无论是 Chrome、Firefox、Opera 还是 IE。

但请注意以下几点:https://bugzilla.mozilla.org/show_bug.cgi?id=1265113 also it seems that on Windows Chrome reads certificates from Windows' certificates store, so in reality your application should probably read system certificate store and use it: on Linux there is /usr/share/ca-certificates and to start with Windows you could try: https://superuser.com/questions/411909/where-is-the-certificate-folder-in-windows-7

不幸的是,实现似乎相当复杂 - 但是,嘿!它是一个非常好的开源项目:)