Note: in these examples the '' means the example should be all on one line.
$ openssl x509 -in cert.pem -noout -text
$ openssl x509 -in cert.pem -noout -serial
$ openssl x509 -in cert.pem -noout -subject
$ openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
$ openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb
$ openssl x509 -in cert.pem -noout -fingerprint
$ openssl x509 -sha1 -in cert.pem -noout -fingerprint
$ openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
$ openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
$ openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca
-signkey key.pem -out cacert.pem
$ openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr
-CA cacert.pem -CAkey key.pem -CAcreateserial
Set a certificate to be trusted for SSL client use and change set its alias to "Steve's Class 1 CA "
$ openssl x509 -in cert.pem -addtrust clientAuth
-setalias "Steve's Class 1 CA" -out trust.pem
###############################################################
############################################################### openssl pkcs12 -clcerts -nokeys -in mycert.p12 -out usercert.pem chmod 0600 usercert.pem ###############################################################
############################################################### openssl pkcs12 -nocerts -in mycert.p12 -out userkey.pem chmod 0400 userkey.pem
If you want to extract from a pfx file and write it to PEM file $ openssl pkcs12 -in publicAndprivate.p12 -nocerts -out privateKey.pem
If you want to extract the CERTIFICATE file (the signed public key) from the pfx file $ openssl pkcs12 -in publicAndprivate.p12 -clcerts -nokeys -out publicCert.pem
To remove the password from the private key file. $ openssl rsa -in privateKey.pem -out private.pem