Display the contents of a SSL certificate

I was asked couple times last week and today about to display the contents of a ssl certificate.

You can display the contents of a DER formatted certificate using this command under linux using openssl:

$ openssl x509 -in mycert.der -inform der -text

and for contents of a PEM formatted certificate under Linux, again using openssl:

$ openssl x509 -in mycert.pem -text