如何从现有证书(abc.crt)和abc.key文件创建密钥库? [英] How can i create keystore from an existing certificate (abc.crt) and abc.key files?
本文介绍了如何从现有证书(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屋!
查看全文