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

mkdir ~/bin/
vi ~/bin/ssl-verify

Add following content

#!/usr/bin/php

Make it executable

chmod 755 ~/bin/ssl-verify

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

ssl-verify

Comments

Leave a Reply

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