## Get private key fingerprint for AWS generated key ( will match the id in AWS Console)
$ openssl pkcs8 -in test_key.pem -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
(stdin)= f6:38:9c:53:9c:64:a8:b3:40:23:9f:6c:ed:0e:3d:bf:bf:16:bb:1c
## Get fingerpint from Openssh public key only md5 / sha1
$ ssh-keygen -f test_key.pub -e -m PKCS8 | openssl pkey -pubin -outform DER | openssl md5 -c
(stdin)= 55:b6:90:db:34:29:da:60:68:c9:08:24:f1:9f:c8:4b
(or)
$ openssl pkey -in test_key.pem -pubout -outform DER|openssl sha1 -c
(stdin)= 45:96:32:86:dd:34:2b:1e:21:0a:0c:86:e4:07:8b:f1:2c:4a:41:23
## Get fingerpint from Openssh pem file md5 /sha1
$ openssl pkey -in test_key.pem -pubout -outform DER|openssl md5 -c
(stdin)= 55:b6:90:db:34:29:da:60:68:c9:08:24:f1:9f:c8:4b
(or)
$ openssl pkey -in test_key.pem -pubout -outform DER|openssl sha1 -c
(stdin)= 45:96:32:86:dd:34:2b:1e:21:0a:0c:86:e4:07:8b:f1:2c:4a:41:23
Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html
validating EC2 pem / ssh key pairs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment