序号 | 源证书文件格式 | 目标证书文件格式 | 所需命令 |
---|---|---|---|
1 | keystore | p12 | keytool -importkeystore -srckeystore xxxx.keystore -srcstoretype JKS -deststoretype PKCS12 -destkeystore xxx.p12 |
2 | p12 | jks | keytool -importkeystore -srckeystore xxx.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore xxx.jks |
3 | pk8 | pem | openssl pkcs8 -inform DER -nocrypt -in xxx.pk8 -out xxx.pem |
4 | pem | pks12 | openssl pkcs12 -export -in xxx.x509.pem -inkey platform.pem -out xxx.pkcs12 |
5 | pks12 | jks | keytool -importkeystore -srckeystore xxx.pkcs12 -srcstoretype pkcs12 -srcstorepass android -destkeystore xxx.jks -deststoretype jks -deststorepass android |
6 | jks | p12 | keytool -importkeystore -srckeystore xxx.jks -destkeystore xxx.p12 -srcstoretype JKS -deststoretype PKCS12 -srcstorepass android -deststorepass android -srcalias platform -destalias platform -srckeypass android -destkeypass android -noprompt |
7 | p12 | x509.pem | openssl pkcs12 -in xxx.p12 -nodes -nokeys -out xxx.x509.pem -password pass:android |
8 | p12 | rsa.pem | openssl pkcs12 -in xxx.p12 -nodes -cacerts -out xxx.rsa.pem -password pass:android |
9 | rsa.pem | pk8 | openssl pkcs8 -topk8 -outform DER -in xxx.rsa.pem -inform PEM -out xxx.pk8 -nocrypt |
10 | cer | jks | keytool -import -file xxx.cer -keystore xxx.jks |
11 | cer | bks | keytool -importcert -v -trustcacerts -alias xx -file xxx.cer -keystore xxx.bks -storetype BKS -storepass ‘123456’ |
12 | bks | cer | keytool -export -alias xx -file xxx.cer -keystore xxx.bks -storetype BKS -provider org.bouncycastle.jce.provider.BouncyCastleProvider -storepass ‘123456’ |
13 | cer | crt | openssl x509 -inform DER -in xxx.cer -out xxx.crt |
14 | pem | crt | openssl x509 -outform der -in xxx.pem -out xxx.crt |
15 | pem | cer | openssl x509 -inform pem -in xxx.pem -outform der -out xxx.cer |
另外:
查看 bks 文件中包含的证书
keytool -list -rfc -keystore xxx.bks -storetype BKS
查看 jks 文件中包含的证书
keytool -list -rfc -keystore xxx.jks -storetype JKS