Login/Register

Certificate Key Matcher

Paste a certificate, a private key or a CSR, any two or all three, and see whether they belong together. A certificate installed with the wrong key is the most common reason a web server refuses to start.

Only if the key is encrypted

When you need it

Nginx answers with key values mismatch, Apache with X509_check_private_key:key values mismatch, and IIS shows the certificate without the little key symbol. All three mean the same: the certificate on the server was issued for a different private key than the one next to it.

It happens when a CSR was generated twice, when files of an old and a new certificate were mixed up, or when a certificate was reissued and the old key was kept.

How the check works

A certificate, its private key and the CSR it was ordered with all contain the same public key. The tool takes the public key out of each file and compares them. If they are identical, the files belong together.

You can do the same on a server: openssl x509 -noout -pubkey -in cert.crt | openssl sha256 and openssl pkey -pubout -in private.key | openssl sha256 must print the same value.

What to do when they do not match

  • Look for the right key on the server where the CSR was created. It is usually next to the .csr file.
  • If the key is lost, generate a new CSR and reissue the certificate with it. A reissue is free.
  • Check that you did not paste the intermediate certificate instead of your own.

Questions and answers

Is it safe to paste my private key here?
The key is sent to our server over HTTPS, used for the comparison and then discarded. It is not stored and not logged. If your security rules do not allow a key to leave the server, run the two openssl commands from this page there instead.
Do I need all three files?
No. Any two are enough: certificate and key, certificate and CSR, or key and CSR.
My private key is password protected.
Enter the password in the field under the key. It is used to read the key for this one check.
The files match, but the server still shows an error.
Then the cause is elsewhere: often a missing intermediate certificate or a wrong file path in the configuration. Run the SSL checker on your domain to see what the server really sends.