One of my friends sent me an e-mail earlier this week inquiring about SSH keys. Specifically, he wanted to know how he could determine the type of key and the key-size in a public key file. All openssh implementations ship with the ssh-keygen utility, which has a “-l” option that can be used to print the type of key, the size of the key and the key’s fingerprint:
ssh-keygen -l -f id_dsa.pub
1024 a1:89:c8:19:a0:1a:d7:37:fa:5d:22:24:97:d7:6e:3d id_dsa.pub (DSA)
I needed to summarize all of the keys on some systems I managed a few years back, and found a new friend in ssh-keygen.