Use below command to convert certificate format
- Convert .CRT to .PEM format
- openssl x509 -inform der -in c:\Certificate\user2.crt (Your directory path) -out c:\Certificate\certificate_1.pem (Your directory path)
- Convert .CRT to .PFX format
- openssl pkcs12 -export -out c:\Certificate\certificate.pfx -inkey c:\Certificate\certificate_1.pem -in c:\Certificate\user2.crt
- Convert .PEM to .DER format
- openssl x509 -outform der -in c:\Certificate\certificatename.pem -out c:\Certificate\certificatename.der
- Convert .DER to .PEM format
- openssl x509 -inform der -in c:\Certificate\certificatename.der -out c:\Certificate\certificatename.pem
- Convert .PFX to .PEM format
- The PKCS#12 or PFX format is a binary format for storing the server certificate, intermediate certificates, and the private key in one encryptable file. PFX files usually have extensions such as .pfx and .p12. PFX files are typically used on Windows machines to import and export certificates and private keys.
- Generate private key from .CRT file
- install the crt file /pem file certificate
- openssl genrsa -out (certificate path+certficiate name) 2048 ( example - openssl genrsa -out user.crt 2048).
- make sure you are on the same directory where the certificate is saved
- go to keychain access ( on mac) , open the certficate key ( right click and export as p.12)
- open the p.12 file in a code editor to find your private key
converting .CRT to PEM via DER step in between ( does not ask for certificate password) :-
openssl x509 -in \public.crt -out \public.der -outform DER
openssl x509 -in \public.der -inform DER -out \public.pem -outform PEM