I recently was troubleshooting a problem with network authentication and suspected that the issue was around certificates and private keys not matching on a client. I had a .PEM file for the certificate and a .KEY for the private key, and I wanted to see if they matched.
To see if the private key matches the certificate, use the following two commands and compare the
openssl x509 -in file.pem -noout -text
openssl rsa -in file.key -noout -text
If they match, the private key matches the certificate. If they don’t, they don’t.
In my case they didn’t match, which was causing the authentication problems. So we then solved what was happening during cert issuance and everything was then good.