PHP Script to verify private key matches SSL certificate?

OpenSSL command can be used to verify if an SSL certificate matches a private key file. You need to find the checksum for the SSL certificate and Private key, if both checksums are the same, then the key matches.

To make this process easier, I created a PHP script to verify if the SSL certificate matches the private key provided.

Create a file

Add following content

Make it executable

To verify an SSL and key file, go to the folder where the SSL certificate and key file are present, then run the command

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *