Skip to content

Instantly share code, notes, and snippets.

@kgaughan
Created February 26, 2016 19:48
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 kgaughan/f86122d1687bea43c7dd to your computer and use it in GitHub Desktop.
Save kgaughan/f86122d1687bea43c7dd to your computer and use it in GitHub Desktop.
Generate SHA256 hash for a given cert chain for use in a TLSA (DANE) record
#!/bin/sh
extract() {
openssl x509 -in $1 -noout -pubkey | openssl rsa -pubin -outform DER
}
digest() {
openssl dgst -sha256 -hex
}
extract $1 | digest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment