使用keytool工具常用证书转换

p12 转 jks
 keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jksjks 转 p12
 keytool -importkeystore -srckeystore keystore.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12jks导出crt证书
 keytool -export -alias test -keystore trust.jks -storepass 123456 -file test.cercrt证书导入jks
 keytool -import -v -alias test -file test.cer -keystore trust.jks -storepass 123456 -noprompt 去除pem格式的key的密码(输出的密码不输入即可)
 openssl rsa -in crt1.key -out crt2.key合并pem格式输出pfx(p12)
 openssl pkcs12 -export -inkey test.key -in cert2.crt -out test.pfx指定intermedian和CA
 openssl pkcs12 -export -out mypkcs12.pfx -inkey my.private.key -in mycert.crt -certfile intermediate.crt -CAfile ca.crt pfx 转 pem
 openssl pkcs12 -in test.pfx -out test.pem -nodespem 转 key
 openssl rsa -in test.pem -out test.keypem 转 crt
 openssl x509 -in test.pem -out test.crtcert 转 pem
 openssl x509 -in test.cer -out test.pem -outform PEMpem 转 der
 openssl x509 -in test.pem -inform PEM -out test.der -outform DERder 转 pem
 openssl x509 -in test.cer -inform DER -out test.pem -outform PEM