如何将.pem和.key一起导入密钥库(.jks)

时间:2020-03-05 12:24:31

标签: certificate pem jks

我有一个.pem证书和一个.key证书文件,我必须将它们一起导入到.jks密钥库中,我该如何实现?

1 个答案:

答案 0 :(得分:1)

我找到了一种解决方案,其中包括将.key和.pem证书导出到.p12文件,然后将该.p12文件导入到Java密钥库(.jks)。

要将.pem和.key一起导出到.p12,请使用以下命令:

openssl pkcs12 -export -in <path to .pem cert> -inkey <path to .key cert> -out <desired name of the .p12 file with the extension> -name <cert alias>

然后,使用以下命令将.p12导入到Java密钥库中:

keytool -importkeystore -v -srckeystore <path to .p12 file> -srcstoretype PKCS12 -destkeystore <path to .jks> -deststoretype JCEKS
相关问题