将.jks转换为p12

问题描述 投票:50回答:6

我怎么能把.jks文件转换为p12jks是一个java密钥库文件,那么如何将其转换为p12格式?

pkcs#12 jks
6个回答
81
投票

将JKS文件转换为PKCS12格式(Java 1.6.x及更高版本)

keytool -importkeystore -srckeystore
KEYSTORE.jks -destkeystore
KEYSTORE.p12 -srcstoretype JKS
-deststoretype PKCS12 -srcstorepass mysecret -deststorepass mysecret
-srcalias myalias -destalias myalias -srckeypass mykeypass -destkeypass mykeypass -noprompt

来自A few frequently used SSL commands


33
投票

JKS→P12:

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

P12→JKS:

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

4
投票

这是一行的一行命令。

keytool -importkeystore -srckeystore <MY_KEYSTORE.jks> -destkeystore <MY_FILE.p12> -srcstoretype JKS -deststoretype PKCS12 -deststorepass <PASSWORD_PKCS12> -srcalias <ALIAS_SRC> -destalias <ALIAS_DEST>

解释参数:

MY_FILE.p12: path to the PKCS#12 file (.p12 or .pfx extension) that is going to be created.
MY_KEYSTORE.jks: path to the keystore that you want to convert.
PASSWORD_PKCS12: password that will be requested at the PKCS#12 file opening.
ALIAS_SRC: name matching your certificate entry in the JKS keystore, "tomcat" for example.
ALIAS_DEST: name that will match your certificate entry in the PKCS#12 file, "tomcat" for example.

2
投票

following page为您提供了一组有用的SSL命令,您将找到答案。


1
投票

你可以使用,https://keystore-explorer.org/打开你的jks并保存为p12或打开p12并保存为jks。


0
投票

这是为了未来的人,我发现上面的答案已经过时,在mac上我用这个命令将JKS转换为PKCS12

keytool -importkeystore -srckeystore srckeystore.jks -destkeystore destkeystore.jks -deststoretype pkcs12
© www.soinside.com 2019 - 2024. All rights reserved.