Skip to content

Instantly share code, notes, and snippets.

@besmirzanaj
Created February 16, 2023 17:10
Show Gist options
  • Save besmirzanaj/8f371cda74b7d4d79a7ea376935edd5f to your computer and use it in GitHub Desktop.
Save besmirzanaj/8f371cda74b7d4d79a7ea376935edd5f to your computer and use it in GitHub Desktop.
calculate cert pin
#!/bin/bash
# EDS Certificate pin calculator
# 2023, Besmir Zanaj
# Usage:
# /ets_pin_calculator.sh <CERT_FILE>
# This script will calulate the EDS cert pin for a certificate file.
# More info in RFC-7469 - https://www.rfc-editor.org/rfc/rfc7469#section-2.1.1
# It takes only one argument, the CERT File in PEM (x509) format.
# Make sure openssl binary is already installed or available in $PATH
openssl x509 -in $1 -noout -pubkey | openssl pkey -inform PEM -pubin -outform der | openssl sha1 -sha256 -binary | openssl enc -base64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment