The ssh-keygen
command generates .pub
files which it describes as "public key files", but they are a totally different format to most "public key files" I've usually seen, which are in PEM format. The ssh-keygen
-style files look like this:
ssh-rsa AAAAB3NzaC1... user@host
... whereas the PEM files look like this:
-----BEGIN CERTIFICATE-----
MIIGZjCCBU6gAwIBAgIDCIrNMA0GCSqGSIb3DQEBBQUAMIGMMQsw...
-----END CERTIFICATE-----
Are these two formats interchangeable, or are they performing a fundamentally different purpose? I came across this problem because I wanted to get the RSA2 key fingerprint of my PEM-encoded public key file, but the method usually suggested to do it (ssh-keygen -l
) says that my PEM-encoded file "is not a public key file".
By the way, I'm aware of this answer, but it doesn't cover the .pub files generated by ssh-keygen
.