openssl pkcs12 -in <cert>.pfx -clcerts -nokeys -out <pub_cert>.pemopenssl pkcs12 -in keystore.p12 -nokeys -out cert.pemopenssl pkcs12 -in keystore.p12 -nodes -nocerts -out key.pemopenssl x509 -in domain.crt \
        -outform der \
        -out domain.deropenssl x509 -inform der \
        -in domain.der \
        -out domain.crtUse this command if you want to add PEM certificates (domain.crt and ca-chain.crt) to a PKCS7 file (domain.p7b):
openssl crl2pkcs7 -nocrl \
       -certfile domain.crt \
       -certfile ca-chain.crt \
       -out domain.p7bopenssl pkcs7 -in domain.p7b \
        -print_certs \
        -out domain.crtwhen working with a legacy algorithm, e.g. SHA1, then use -legacy
openssl pkcs7 -in domain.p7b \
        -print_certs \
        -legacy \
        -out domain.crtUse this command if you want to take a private key (domain.key) and a certificate (domain.crt), and combine them into a PKCS12 file (domain.pfx):
openssl pkcs12 \
       -inkey domain.key \
       -in domain.crt \
       -export -out domain.pfxif you need an "alias", then includ option -name "myalias"
Use this command if you want to convert a PKCS12 file (domain.pfx) and convert it to PEM format (domain.combined.crt):
openssl pkcs12 \
       -in domain.pfx \
       -nodes -out domain.combined.crtopenssl x509 -in mycert.crt -out mycert.pem -outform PEMopenssl x509 -outform der -in certificate.pem -out certificate.crtopenssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile more.crt- openssl– the command for executing OpenSSL
- pkcs12– the file utility for PKCS#12 files in OpenSSL
- -export-out certificate.pfx – export and save the PFX file as certificate.pfx
- -inkey privateKey.key– use the private key file privateKey.key as the private key to combine with the certificate.
- -in certificate.crt– use certificate.crt as the certificate the private key will be combined with.
- -certfile more.crt– This is optional, this is if you have any additional certificates you would like to include in the PFX file.