JKS (Java Keystore) is a Java-specific file format that was the default format for KeyStores until Java 8. Starting from Java 9, PKCS#12 is the default KeyStore format. Despite JKS, PKCS#12 is a standardized and language-neutral format for storing encrypted data. The PKCS#12 format is also known as PKCS12 or PFX.
PEM (Privacy Enhanced Mail) is also a certificate container format. The PEM files are encoded in Base64. This ensures that data remains intact during translation between different systems.
Further, a PEM file can contain one or more instances, each of them being separated by a plain-text header and footer:
openssl pkcs12 -in test.p12 -nocerts -nodes -out rsa_origin.key
openssl rsa -in rsa_origin.key -out rsa_pkcs1.pem
openssl rsa -in rsa_origin.key -pubout -out rsa_public_key.pem
openssl pkcs8 -topk8 -inform PEM -in rsa_pkcs1.pem -outform PEM -out rsa_private_pkcs8.pem -nocrypt
将jks文件转未pkcs12格式
keytool -importkeystore -srckeystore client.jks -destkeystore client.pkcs
-srcstoretype JKS -deststoretype PKCS12
将pkcs12格式转化为pem文件
openssl pkcs12 -clcerts -nokeys -in test.p12 -out cert.pem
openssl pkcs12 -clcerts -nokeys -out cert.pem -in test.p12
openssl pkcs12 -export -in cert.pem -inkey key.pem -out certificate.p12 -name "certificate"