Skip to content

Instantly share code, notes, and snippets.

@cary205
Forked from pollux-/sha256 hash
Created March 16, 2023 09:46
Show Gist options
  • Select an option

  • Save cary205/8016c5709ffc53be6d03f943a797f8fd to your computer and use it in GitHub Desktop.

Select an option

Save cary205/8016c5709ffc53be6d03f943a797f8fd to your computer and use it in GitHub Desktop.
Generating SHA256 hash of a public key from remote server certificate
Creating certificate from remote URL and writing to file (mycertfile.pem)
openssl s_client -showcerts -connect gist.github.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
Generating SHA256 hash of public key from a certificate (mycertfile.pem)
openssl x509 -in mycertfile.pem -pubkey -noout | openssl rsa -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