Openssl is an open source project, consists with cryptographic library and SSL/TSL protocols toolkit. Widely being used in server side and client tools. It's command line are also commonly used for key and certificate management.

Below shows some of most used command examples:

Check openssl version

Use the command 'openssl version -a'

$openssl version -a
OpenSSL 1.0.1e-fips 11 Feb 2013
built on: Thu Nov  6 13:16:51 CST 2014
platform: linux-x86_64
options:  bn(64,64) md2(int) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wa,--noexecstack -DPURIFY -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/etc/pki/tls"
engines:  dynamic

Examing openssl certificate and keys

Use -text to print certificate content, while use -noout to not print non encoded certificate itself

openssl x509 -text -in fd.crt -noout
openssl x509 -text -in hostcert.pem -noout

Similar command to print key content

openssl x509 -text -in userkey.pem

Convert certifcate and key format

Keys and Certificates can be stored in varity of formats, you will often need to convert key or certificate from one format to another

To convert certificate from PEM to PKCS

openssl pkcs12 -export -in usercert.pem -inkey userkey.pem -out mycert.p12  -name 'This email address is being protected from spambots. You need JavaScript enabled to view it.' 

To convert PKCS to PEM

openssl pkcs12 -in <filename>.p12 -nokeys -clcerts -out usercert.pem 
openssl pkcs12 -in <filename>.p12 -nocerts -out userkey.pem
And chmod the .pem files to read only.

To conver PEM to DER

openssl x509 -inform PEM -in fd.pem -outform DER -out fd.der

TO convert DER to PEM

openssl x509 -inform DER -in fd.der -outform PEM -out fd.pem

Most common format are

Binary certificate(DER)
ASCII certificate(PEM)
PKCS certificate
Binary key(DER)
ASCII key(PEM)
PKCS key