oxidising
oxidising

Reputation: 310

Fingerprint of RSA public key

I'm trying to get a fingerprint from a public key created as below:

openssl genrsa -out test.pem -aes128 -passout pass:testphrase 2048
openssl rsa -pubout -in test.pem -out test_public.pem -passin pass:testphrase

I'm uploading the public key to my cloud provider which confirms the fingerprint to be 70:d6:cb:9c:c7:95:ad:6f:49:84:4f:d1:fb:71:a8:53 and I can get the fingerprint from the private key using this command

openssl rsa -in test.pem -pubout -outform DER | openssl md5 -c

(stdin)= 70:d6:cb:9c:c7:95:ad:6f:49:84:4f:d1:fb:71:a8:53

I've tried

openssl rsa -pubin test_public.pem -pubout -outform DER | openssl md5 -c

But this gives me d4:1d:8c:d9:8f:00:b2:04:e9:80:09:98:ec:f8:42:7e. I'd like to get the fingerprint directly from the public key, I feel like I'm missing something simple here.

Upvotes: 2

Views: 3445

Answers (1)

oxidising
oxidising

Reputation: 310

OK so thanks to @Topaco I now know that the commands

openssl rsa -in test.pem -pubout -outform DER | openssl md5 -c

and

openssl rsa -pubin -in test_public.pem -outform DER | openssl md5 -c

Give the same hash, I'd missed the -in flag before test_public.pem.

Upvotes: 5

Related Questions