Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save conclusionlogic/efa21f7f9505f4b21d98cc3e7e313b5f to your computer and use it in GitHub Desktop.
Save conclusionlogic/efa21f7f9505f4b21d98cc3e7e313b5f to your computer and use it in GitHub Desktop.
[get certificate fingerprint] Extraxt Base64 encoded certificate fingerprint for HPKP #bash #shell #openssl #pinning #hpkp
#!/usr/bin/env bash
# from Ceritifcate Signing Requets (for backpup certificate pinning):
$ openssl req -pubkey < DOMAIN.csr | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64
# from Public Certificate file (for main certificate pinning):
$ cat DOMAIN.crt | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment