How do I verify that a private key matches a certificate?
To verify that a private key matches its certificate you need to compare the modulus of the certificate against the modulus of the private key.Please follow the below command to view the modulus of the certificate.
openssl x509 -noout -modulus -in server.crt | openssl md5
Now you will receive the modulus something like a77c7953ea5283056a0c9ad75b274b96
Please follow the below command to view the modulus of the private key.
openssl rsa -noout -modulus -in myserver.key | openssl md5
Now you should get the modulus as same as certificate modulus above. i.e a77c7953ea5283056a0c9ad75b274b96
If the modulus of the certificate and the modulus of the private key do not match, then you're not using the right private key. You can either create a brand new key and CSR and send contact support or do a search for all private keys on the system and compare their modulus.
To check the health of your private key you could perform this command:
openssl rsa -noout -check -in privkey.pem
source
Niciun comentariu:
Trimiteți un comentariu