Created
April 2, 2015 03:01
-
-
Save ruckuus/d446a8554b5046d64740 to your computer and use it in GitHub Desktop.
Check if SSL cert match with its private key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cert=$1 | |
key=$2 | |
MD51=$(openssl x509 -text -noout -in $cert -modulus | grep "^Modulus" | openssl md5) | |
MD52=$(openssl rsa -text -noout -in $key -modulus | grep "^Modulus" | openssl md5) | |
if [ "$MD51" == "$MD52" ]; then | |
echo "Match" | |
else | |
echo "Not match" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment