How do I derive a SHA256 fingerprint from either a public key or MD5 fingerprint?

3.2k Views Asked by At

I received a public key generated by "SAP SuccessFactors" from someone who needs to connect to an SFTP, but in order for me to import the public key, I need to provide a SHA256 fingerprint.

Apparently "SAP SuccessFactors" can only produce an MD5 fingerprint. I've tried running the command

ssh-keygen -lf <path>.fakekeyname.pub

but I get an error

fakekeyname.pub is not a public key file

In opening up the public key file, the header says

 begin ssh2 public key

whereas I'm used to seeing something along the lines of ssh-rsa.

Apologies in advance if this seems immediately obvious, but I would sincerely appreciate some guidance or advice.

Thanks very much!

1

There are 1 best solutions below

2
DEFL On

You can use ssh-keygen. First you would need to convert the file to pem format first

ssh-keygen -i -m PKCS8 -f pubkey.pem > NEWpubkey.pem
Next get the fingerprint

and then you can get the sha256 value from it:

ssh-keygen -lf NEWpubkey.pem

for reference see this post:get SHA256 hash of public key

Edit: For Pub files this could work ssh-keygen -E sha256 -lf sample.pub see How to Calculate Fingerprint From SSH RSA Public Key in Java?