OpenSSL

Create RSA key

sudo openssl -req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem
  • -nodes - no DES, no password prompt
  • -days 365 - make valid for a year

Extract .key and .crt from .PEM file

# extract .key from .pem (RSA)
openssl rsa -in RSA-cert.pem -out cert.crt
 
# extract .crt from .pem
openssl crl2pkcs7 -nocrl -certfile RSA-cert.pem | openssl pkcs7 -print_certs -out cert.crt

Get Information from Certificate

  • print certificate information: sudo openssl x509 -text -noout -in cert.pem
  • print expiration date: sudo openssl x509 -enddate -noout -in cert.pem