English 中文(简体)
我如何在没有使用关键托醇指挥线效用的情况下进口新的贾瓦·加特?
原标题:How do I import a new Java CA cert without using the keytool command line utility?
  • 时间:2009-10-30 15:41:24
  •  标签:

执行摘要:我如何使用 Java法在 Java安装新的根证书?

我们有一个桌面应用程序,可以浏览各种网络服务。 最近,其中一人将其SSL证书改为信托公司签署的证书。 虽然普通互联网浏览器接受信托社的SSL证书,但 Java似乎并未获得基本证书,我们失去了使用特定网络服务的渠道,其错误信息如下:

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

我们暂时搁置,说服供应商回到韦里辞职,但当他们回来时,我们必须做好准备。 因此,我需要我们的台式软件,以便在必要时自动安装信托人根证书。 我们的客户没有足够技术挖掘,无法使用关键波束指挥系统,因此我不会说话,因为这样做会给我带来一个脆弱的解决办法(对Mac和PPC分别实施,反对执行限制,难以找到正确的JRE安装,等等)。

我认为,关键工具是在国内使用 Java。 在 Java,我可以使用什么指挥手段复制钥匙tool的功能,并在方案上安装根证书?

最佳回答

我不知道这是否可行,但你可以实施自己的信托管理,以允许这一联系或这一联系。 Here是基本内容。

问题回答

如果你想把证书安装到桌面机器上可信赖的主楼,你将需要批准。 这与keytool相同,你需要一个密码,可以进入可靠的根基仓库。 如果你想要 quick,你就可以

  • write the certificate to a file or a byte stream or whatever
  • import using KeyTool class (sun.security.tools.KeyTool)

但是,如果证明不有效,那么它就不可信。 我要说的是这样做的良好理由。

IMHO, Sun没有通过AAP接触钥匙tool,主要是为了防止开发商修改一套值得信赖的食物。 我可以想象,利用这种守则的袭击者会把他们自己的根证书插入信托库,损害信托店的模式。

事实上,如果你看一看钥匙提炼厂(Sun.security.tools 包裹)的来源,那么它就不是最终的,它还有一个私人建筑商,阻止任何电线人从代码上挑出钥匙Tool类。 钥匙Tool确实有一种主要方法,使指挥系统(因而成为非洲顾问办用户)可能是唯一能够开始与钥匙Tool进行交流的方式。

唯一的(简单)办法是:

  • Initialize keytool as a process from the application, and pass commandline arguments to install the root CA certificate. This alone is a bad idea, and I would recommend notifying the user as to what is occuring.
  • Avoid the use of keytool and instead provide users with instructions on how to install the root CA using Keyman or KeyTool IUI. Speaking for myself only here, I prefer the latter.

您总是可以援引钥匙Tool作为程序Runtime.exec(......)

指挥部解决办法: 在澳门, Java家是/Library/Java/Home。 Try:

$ sudo -i
# cd /Library/Java/Home
# keytool -import -trustcacerts -alias CAName -file CA.crt -keystore lib/security/cacerts

Substitute CAName with the name of the CA, and CA.crt with a path to You accreditation file (PEM work). 它将促使形成一个关键的仓库密码。 缺省密码载于相关条款。

我不得不为快速通道的一个足球赛做这件事。

Sun 出版了该法典,以根据任何目标东道网站(有以下几节内容的网址)编制最新版本的热点文件:

https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java”rel=“nofollow”https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java

您的新陈词将在目前的名录中点名。 仅复制你 j/lib/security/cacerts案的新档案。

我没有就你的新陈词典的安全发表任何意见。





相关问题
热门标签