OpenSSL cheatsheet based on https://httpd.apache.org/docs/2.0/ssl/ssl_faq.html.
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-keyout server.key -out server.crt -subj "/CN=example.com" \
-addext "subjectAltName=DNS:example.com,DNS:www.example.net,IP:10.0.0.1"Certificate
openssl x509 -noout -text -in server.crtKey
openssl rsa -noout -text -in server.keystart and end
openssl x509 -noout -dates -in server.crtstart only
openssl x509 -noout -startdate -in server.crtend only
openssl x509 -noout -enddate -in server.crtopenssl x509 -checkend 86400 -noout -in server.crtThe 'modulus' and the 'public exponent' portions in the key and the Certificate must match. As the public exponent is usually 65537 and it's difficult to visually check that the long modulus numbers are the same, you can use the following approach:
openssl x509 -noout -modulus -in server.crt | openssl md5 && \
openssl rsa -noout -modulus -in server.key | openssl md5A simple way to compare two 'modulus' (If more than one hash is displayed, they don't match):
(openssl x509 -noout -modulus -in server.pem | openssl md5; openssl rsa -noout -modulus -in server.key | openssl md5) | uniqopenssl req -noout -modulus -in server.csr | openssl md5openssl s_client -connect your_host.domain.com:443 | openssl x509 -noout -text