Skip to content

Instantly share code, notes, and snippets.

@arpat
Last active May 16, 2016 10:03
Show Gist options
  • Save arpat/a861eba9df541407a87bcb4008a6f115 to your computer and use it in GitHub Desktop.
Save arpat/a861eba9df541407a87bcb4008a6f115 to your computer and use it in GitHub Desktop.
Quick way to find matching ssl pub/priv key pairs.
#!/bin/bash
# Quick way to find matching ssl pub/priv key pairs.
# usage: ./comp-ssl-certs.sh mycertfiles*
CertFiles="$1"
for Files in $(ls $CertFiles)
do
#echo "ALL FILES "$Files
for Type in x509 rsa
do
Mod=$(openssl $Type -noout -modulus -in $Files 2>/dev/null) \
&& echo -en $Files" $Type\t\t\t" && echo $Mod | openssl md5
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment