# 证书格式转换
2017-05-10
# 命令转换
# OpenSSL 转换
DER to PEM
openssl x509 -out server.cer -in <your server cert> -inform DER
-outform PEM openssl pkey -out server.key -in <your privatekey>
-inform DER -outform PEM
PFX 查看
openssl pkcs12 -info -in <your pfx file>
PEM to PFX
openssl pkcs12 -export -out server.pfx -in <your server cert> -inkey
-certfile <our CACerts> -name <your keyalias>
PFX to PEM
openssl pkcs12 -clcerts -nokeys -out server.cer -in <your pfx file> &&
openssl pkcs12 -nocerts -out server.key -in <your pfx file> -nodes &&
openssl pkcs12 -cacerts -nokeys -out CACerts.txt -in <your pfx file>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# KeyTool 转换
JKS 查看
keytool -list -v -keystore <your jks file>
PFX to JKS
keytool -importkeystore -srckeystore <your pfx file> -destkeystore
server.jks -srcstoretype PKCS12 -deststoretype JKS
JKS to PFX
keytool -importkeystore -srckeystore <your jks file> -destkeystore
server.pfx -srcstoretype JKS -deststoretype PKCS12
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 在线工具
https://www.ssltools.org/cert_convert.html (opens new window)
https://www.myssl.cn/tools/merge-jks-cert.html (opens new window)
# OpenSSL for windows
https://wiki.openssl.org/index.php/Binaries (opens new window)