When your key does not match your certificate
The renewal finished on time, the new certificate is on the server, the reload is typed — and the server refuses to start, because the key it has loaded belongs to a different certificate than the one you just installed. This is the most preventable failure in TLS operations, and it keeps happening because everything about the two files invites you to assume they go together.
The failure, as it usually unfolds
The error messages are terse and vary by server. Nginx says SSL_CTX_use_PrivateKey failed or, more helpfully in recent versions, key values mismatch. Apache reports SSL Library Error alongside a note that the private key does not match the certificate. HAProxy refuses the bind. Kubernetes ingress controllers surface it as a secret that will not load. What they share is timing: the failure appears at reload or restart, which means it is discovered at the worst possible moment — during the change that was supposed to fix an expiring certificate, often at night, often with the old certificate already removed from the path. The configuration syntax is fine. The files are readable. The permissions are right. Two files that sit side by side in the same directory, with matching names and matching dates, turn out to be strangers.
How they became strangers is almost always a renewal that rekeyed. A certificate and its private key are born together, from one key pair, and a renewal that reuses the key keeps the family intact. But many renewal flows generate a fresh key pair by default — a new CSR, a new certificate — and the delivery bundle contains a new certificate and a new key. Whoever deploys it copies the certificate in (that is the file with the new dates, the one the ticket is about) and leaves the key file untouched, because "the key didn't change" — except it did. The mirror-image mistake exists too: a new key deployed beside the old certificate. And on inherited systems there is a third variant, quieter than both: a directory that has accumulated years of .crt, .key, .pem and final/final-v2 files, where nobody alive knows which of the three plausible keys the certificate in production was issued to. The certificate & key matcher was built for exactly that directory: drop everything in and let the mathematics sort it out.
Matching is about the public key, not the file
Nothing in either file says "I belong with that one". There is no shared serial number, no pairing ID, no back-reference in the key file at all — a private key does not know it has a certificate. The relationship runs through one mathematical object: the public key. It is embedded, byte for byte, in the certificate; it is embedded in any CSR made from the key pair; and it can be re-derived from the private key, because a private key contains everything needed to reconstruct its public half. Two items match when their public keys are identical — for RSA, the same modulus and exponent; for an EC key, the same point on the same curve. Any stronger claim is superstition, and any weaker check is a guess.
That is why the traditional checks feel so unsatisfying. Comparing file names checks your filing discipline, not the cryptography. Comparing modification dates checks your copying discipline. Even the certificate's contents mislead people: the issuer, the validity dates and the name list all describe the certificate, and none of them mentions the key. The openssl modulus comparison — hash the modulus out of the certificate, hash the modulus out of the key, compare — works precisely because the modulus is most of the public key. Its limits are practical, not conceptual: it is one pair at a time, a different incantation per file type, and it has no EC equivalent, because EC keys have no modulus. The uniform version of the same idea is to hash the standard encoding of the whole public key — the SubjectPublicKeyInfo — and group files by that hash. Same hash, same key pair; that is the entire method of the matcher, and it is why its verdict can be a sentence instead of a probability.
The second classic: the right pair in the wrong order
Fix the pairing and a deployment can still fail on the chain. A server must present its leaf certificate first, then the intermediates in signing order, so that a client can walk from the leaf up to a root it trusts. The mistakes are mechanical: the bundle assembled leaf-last by someone concatenating files alphabetically; the intermediate from last year's issuer beside this year's leaf, names plausible, signature wrong; the intermediate missing entirely, which desktop browsers often hide by fetching it themselves while command-line tools, mobile apps and other servers fail with unable to get local issuer certificate. That last property — works in my browser, fails everywhere strict — sends people debugging the wrong layer for hours.
Name matching alone cannot fully clear a chain, because names can coincide while signatures do not: a re-issued intermediate with the same subject name but a different key will name-match a leaf it never signed. The sound check is the signature on each link, verified with the issuer's public key. The matcher's chain builder does both and labels them differently — signature verified when the cryptography was actually checked, name match only when the algorithm (RSA-PSS, usually) is one the browser platform cannot verify. Treat any tool's unqualified "chain OK" with the question this distinction answers: did it check the signatures, or just the names? For the deep decode of one certificate in the chain — its SANs, its dates, its fingerprint — the certificate parser remains the right page; the matcher is about how the files relate to each other.
Checking before the 2 a.m. reload
The procedural fix is embarrassingly cheap: verify the pair where it will be loaded, before the reload, as part of the same change that installs it. Keep certificate and key in one bundle with one name, versioned together, so "the pair" is a single artefact rather than a coincidence of directory listing. On renewal, decide deliberately whether you are rekeying; if you are, the deploy is two files, and the checklist says so. And rehearse the check itself: load the exact files the server will load into the matcher — it runs entirely in your browser, so a production key never leaves your machine — read the verdict line, and only then schedule the reload. If you need a fresh CSR for the renewal, the matcher generates one with its key beside it and the fingerprint to confirm the pairing; if you need a throwaway pair for an internal service, the self-signed generator keeps its certificate and key together the same way. The outage version of this story is never really about certificates. It is about an unverified assumption — two files, adjacent in a listing, presumed related — meeting a server that checks. Check first, while the old configuration is still running and the coffee is still optional.
Frequently asked questions
How can I check a match without this tool?
With openssl, compare the public key (or, for RSA, the modulus) of each file: `openssl x509 -in cert.pem -pubkey -noout` against `openssl pkey -in key.pem -pubout`, or hash the modulus of the certificate and the key and compare. The commands differ per file type, work one pair at a time, and the modulus trick does not exist for EC keys — which is why the matcher on this site does the same comparison from the encoded public key for every file at once.
The certificate and key match, but the site still fails. What else is it?
Work outward in order: is the server actually loading the files you checked (a reload after the copy, the right vhost, the right container)? Is the chain complete and ordered — leaf, intermediates, root — for clients that cannot fetch missing intermediates? Is the certificate expired, or not yet valid after a clock change? And is the name the visitor typed in the certificate's SAN list? A match is one fact; deployment has several more places to be wrong.
Can a certificate be "re-paired" with a different key?
No. The public key is baked into the signed certificate; changing it means issuing a new certificate. That is what rekeying a renewal does — new key pair, new CSR, new certificate — and it is why a renewal that rekeys silently breaks any deployment where someone copies only the new certificate over and leaves last year's key in place.