pfx证书转换pem证书
(2018-07-27 10:41:30)
标签:
sslpfxpem |
分类: WIN |
公钥通过下面命令直接可以得到
$ openssl pkcs12 -in keyStore.pfx -out keyStore.pem
-nodes
这里面的私钥不是RSA格式 通过下面命令再转一次 得到RSA格式
$ openssl rsa -in keyStore.pem -check
RSA key ok
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA1uP8OO9LseRG/zNbkgEvXNPyts9kFD41b3gOnpefswq3Qb3V
...
...
https://www.sslshopper.com/article-most-common-openssl-commands.html
Convert a DER file (.crt .cer .der) to PEM
openssl x509 -inform der -in certificate.cer -out
certificate.pem
Convert a PEM file to DER
openssl x509 -outform der -in certificate.pem -out
certificate.der
Convert a PKCS#12 file (.pfx .p12) containing a private key
and certificates to PEM
openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes
You can add -nocerts to only output the private key or add
-nokeys to only output the certificates.
Convert a PEM certificate file and a private key to PKCS#12
(.pfx .p12)
openssl pkcs12 -export -out certificate.pfx -inkey
privateKey.key -in certificate.crt -certfile CACert.crt