java以编程方式将自签名证书添加到密钥库

问题描述:

我在命令提示符下使用keystore添加了自签名证书。

I added the self signed certificate using keystore from command prompt.

我找到了几个链接,告诉我们如何将证书添加到密钥库,但他们都说在运行程序之前在本地存储证书,并通过代码完成其余的工作。我需要动态地将证书添加到密钥库。

I found several links which tells how to add certificate to keystore, but they all say to store the certificate locally before running program and do the rest via code. I need to add certificate to keystore dynamically.

如何以编程方式添加证书?

How can I add a certificate programatically?

你可以参考这个博客获得更多帮助

You can refer this blog for more help

java.security.KeyStore 也很有用。

如果你想要的话要从外部服务器导入,请参考sun 实施

If you want to import from external server refer the sun implementation