Friday, November 10, 2017

SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch

Error:

SSL_CTX_use_PrivateKey_file("/opt/nginx/ssl/server.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch

Solution:

To match CSR key and generated SSL certificate
echo "--Certificate:" && openssl x509 -noout -modulus -in ssl_certificate_file && echo "--Key:" && openssl rsa -noout -modulus -in csr_key_file
 Here change ssl_certificate_file and csr_key_file with your own file names.

With this command, you can get 2 modules. And if this both modules value looks same then it should work else key and SSL certificate is not correct.

You can also compare serial key from your order of SSL certificate:
openssl x509 -in ssl_certificate.cer -serial -noout

If it will not match then Reissue certificate or check your key or SSL if it is an old one.