Converting Certs from Different Formats
- Convert a DER file (.crt .cer .der) to PEM
1openssl x509 -inform der -in certificate.cer -out certificate.pem
- Convert a PEM file to DER
1openssl x509 -outform der -in certificate.pem -out certificate.der
- Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
1openssl 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.
1openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
More details in https://www.sslshopper.com/ssl-converter.html