Various types of certificates because the contents of the store are different (such as whether the public/private key is encrypted storage/single certificate or multi-certificate, etc.), the adoption of different encoding (DER/BASE64), the standard is different (such as PEM/PKCS), so although the standard of the certificate content specification, but the certificate file is a variety of. Fortunately, OpenSSL has a good support for these different standards, which can be used to convert certificates in different formats.
In general, there are several types of work to be done with certificate conversions
Encoding conversion: DER<-->BASE64
Conversion of different certificate standards: PKCS series <-->pem/cer
Increase/subtract/extract/transform of private key
...
Pem--der/cer (Base64--der encoded conversion)
OpenSSL x509-outform der-in certificate.pem-out Certificate.der
PEM--P7B (PEM--PKCS#7)
OpenSSL crl2pkcs7-nocrl-certfile certificate.cer-out certificate.p7b-certfile cacert.cer
PEM--PFX (PEM--PKCS#12)
OpenSSL pkcs12-export-out certificate.pfx-inkey privatekey.key-in certificate.crt-certfile CACert.crt
PEM--P12 (PEM--PKCS#12)
OpenSSL pkcs12-export-out cert.p12-in Cert.pem-inkey Key.pem
CER/DER--PEM (coded der--base64)
OpenSSL x509-inform der-in certificate.cer-out Certificate.pem
P7b--pem (PKCS#7--PEM)
OpenSSL pkcs7-print_certs-in certificate.p7b-out certificate.cer
P7B--PFX (PKCS#7--PKCS#12)
OpenSSL pkcs7-print_certs-in certificate.p7b-out certificate.cer
OpenSSL pkcs12-export-in certificate.cer-inkey privatekey.key-out certificate.pfx-certfile CACert.cer
Pfx/p12--pem (PKCS#12--PEM)
OpenSSL pkcs12-in certificate.pfx-out certificate.cer
If you do not need to encrypt the private key in Pem, you can add option-nodes;
If you do not need to export the private key, you can add option-nokeys;
PEM base64--x.509 Text Format
OpenSSL x509-in key.pem-text-out Cert.pem
PFX file to extract the private key (. Key)
OpenSSL pkcs12-in mycert.pfx-nocerts-nodes-out Mycert.key
Pem--spc
OpenSSL crl2pkcs7-nocrl-certfile venus.pem-outform der-out venus.spc
PEM--PVK (OpenSSL 1.x start support)
OpenSSL rsa-in mycert.pem-outform pvk-pvk-strong-out mypvk.pvk
pem--pvk(for versions prior to OpenSSL 1.x, you can download the PVK converter and complete it with the following command)
Pvk-in Ca.key-out ca.pvk-nocrypt-topvk
PVK format More information: http://www.drh-consultancy.demon.co.uk/pvk.html
For more options and features of OpenSSL, please refer to the OpenSSL manual
OpenSSL formats a certificate for conversion