如何从现有证书 (abc.crt) 和 abc.key 文件创建密钥库? [英] How can I create keystore from an existing certificate (abc.crt) and abc.key files?

查看:42
本文介绍了如何从现有证书 (abc.crt) 和 abc.key 文件创建密钥库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将证书和密钥文件导入密钥库,但我无法这样做.

I am trying to import a certificate and a key file into the keystore but I'm unable to do that.

如何通过导入现有证书 (abc.crt) 和 abc.key 文件来创建密钥库?

How can I create a keystore by importing both an existing certificate (abc.crt) and abc.key files?

推荐答案

最简单的方法可能是使用 OpenSSL 创建一个 PKCS#12 文件:

The easiest is probably to create a PKCS#12 file using OpenSSL:

openssl pkcs12 -export -in abc.crt -inkey abc.key -out abc.p12

您应该能够使用 PKCS12 密钥库类型直接使用生成的文件.

You should be able to use the resulting file directly using the PKCS12 keystore type.

如果确实需要,可以使用 keytool -importkeystore(在 Java 6 的 keytool 中可用)将其转换为 JKS:

If you really need to, you can convert it to JKS using keytool -importkeystore (available in keytool from Java 6):

keytool -importkeystore -srckeystore abc.p12 
        -srcstoretype PKCS12 
        -destkeystore abc.jks 
        -deststoretype JKS

这篇关于如何从现有证书 (abc.crt) 和 abc.key 文件创建密钥库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆