Skip to content

Instantly share code, notes, and snippets.

@mdaniel
Created January 5, 2016 20:09
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 mdaniel/512a98de7ae822eb40ed to your computer and use it in GitHub Desktop.
Save mdaniel/512a98de7ae822eb40ed to your computer and use it in GitHub Desktop.
Create EC2 fingerprints for local PEM files
#! /bin/sh
# q.v. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#verify-key-pair-fingerprints
for i in "$@"
do
echo "== $i =="
echo " if *AWS* generated the key, it's fingerprint will be:"
openssl pkcs8 -in "$i" -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
echo " if *you* generated the key, it's fingerprint will be:"
openssl rsa -in "$i" -pubout -outform DER 2>/dev/null | openssl md5 -c
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment