Skip to content

Instantly share code, notes, and snippets.

@ruckuus
Created April 2, 2015 03:01
Show Gist options
  • Save ruckuus/d446a8554b5046d64740 to your computer and use it in GitHub Desktop.
Save ruckuus/d446a8554b5046d64740 to your computer and use it in GitHub Desktop.
Check if SSL cert match with its private key
#!/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