Skip to content

Instantly share code, notes, and snippets.

@k-oguma
Created June 19, 2019 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k-oguma/95b9fd7442c30fa2e12514982da0826d to your computer and use it in GitHub Desktop.
Save k-oguma/95b9fd7442c30fa2e12514982da0826d to your computer and use it in GitHub Desktop.
[oneliner][openssl] You can compare TLS CSR and TLS key by using one liner.
domain=<Your domain>; [[ $(openssl rsa -text -noout -in $domain.key | grep -A 3 -w modulus: | tail -1 | grep $(openssl req -text -noout -in $domain.csr | grep -A 3 -w Modulus: | tail -1)) ]] && { echo -e "\033[32m[Success] Compared $domain.{key,csr}, these had each matched the module.\033[00m" } || { echo "\033[31m[Fail] Compared $domain.{key,csr}, these don't have each matched the module.\033[00m" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment