About the OpenSSL cheat sheet
openssl is the tool you reach for when a certificate problem needs an answer rather than a guess. Most certificate incidents come down to three questions: what does this certificate actually say, does this private key match it, and what is the server really presenting.
The distinction between inspecting a file and inspecting a live endpoint matters. Reading a certificate from disk tells you what you have; connecting to a server tells you what it is serving, including the full chain it sends. Those differ more often than people expect — a correct certificate on disk that is not the one being served is a common and confusing failure.
Chain problems are the most frequent real-world issue. A server that sends its leaf certificate without the intermediate works in browsers, which cache intermediates, and fails in curl, Java clients and anything else that does not. Testing with a client that does not paper over it is how you catch this before users do.
Frequently asked questions
How do I check what a live server is presenting?
Connect with the client subcommand and read the certificate chain it returns, specifying the server name so the right virtual host is selected. This shows the full chain as served, which is what actually matters — a certificate that is correct on disk but not being served is a common cause of confusing failures.
How do I confirm a private key matches a certificate?
Derive the public key from each and compare them — extract the public key from the certificate and from the private key, and if the two differ they are not a pair. The older trick of comparing moduli works only for RSA; on an ECDSA certificate it errors out and tells you nothing, so the public-key comparison is the one worth remembering. This is the fastest way to diagnose a service that will not start with a TLS configuration error, which is very often a mismatched key and certificate rather than anything more subtle.
Why does my certificate work in a browser but not in curl?
Almost always a missing intermediate certificate. Browsers cache intermediates from previous connections and can fetch them, so a chain that is incomplete still works there. Other clients do not. Serve the full chain — leaf plus intermediates, without the root — and it will work everywhere.
What is the difference between PEM, DER, PKCS12 and JKS?
They are encodings and containers, not different certificates. PEM is base64 text with header lines and the most common on Linux. DER is the binary equivalent. PKCS12 bundles a certificate with its private key in one password-protected file, and is what Windows and Java tooling typically want. openssl converts between them, so a format mismatch is an inconvenience rather than a problem.
How do I check when a certificate expires?
Read the validity dates from the certificate, either from a file or from a live connection. For monitoring, check the live endpoint rather than a file on disk — the goal is to know what users are being served, and a renewed file that was never picked up by the running process is exactly the failure you are trying to catch.