keyPath=/path/to/key
certPath=/path/to/cert

keyHash=$(openssl rsa -noout -modulus -in "$keyPath" | openssl md5)
certHash=$(openssl x509 -noout -modulus -in "$certPath" | openssl md5)

if [ "$keyHash" = "$certHash" ]
then 
	echo ":)" 
fi