Skip to content

Instantly share code, notes, and snippets.

@mintsoft
Created May 11, 2013 20:07
Show Gist options
  • Save mintsoft/5561247 to your computer and use it in GitHub Desktop.
Save mintsoft/5561247 to your computer and use it in GitHub Desktop.
Wrapper around openssl to verify the certificate and key files match
#!/bin/bash
[[ -z "$1" || -z "$2" ]] && echo "Please specify a certificate and keyfile (in that order)" && exit 1;
diff -sq <(openssl x509 -noout -modulus -in "$1" | openssl md5) <(openssl rsa -noout -modulus -in "$2" | openssl md5) > /dev/null;
[[ $? == 0 ]] && echo "Keys Match" || echo "Keys do NOT Match";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment