1. JKS转P12
keytool -importkeystore -srckeystore temp.JKS -destkeystore tmp.p12 -srcstoretype JKS -deststoretype PKCS12
2. P12转pem
openssl pkcs12 -in tmp.p12 -nodes -out tmp.rsa.pem
3. pem转pk8
openssl pkcs8 -topk8 -outform DER -in tmp.rsa.pem -inform PEM -out my_private.pk8 -nocrypt
4. pem转x509.pem
cat tmp.rsa.pem
复制-----BEGIN CERTIFICATE-----到
-----END CERTIFICATE-----的部分,粘贴到temp.x509.pem 即可