I have two files,
id_rsa.pub, what command can be used to validate if they are the
Question is already answered on stackoverflow: http://stackoverflow.com/questions/274560/how-do-you-test-a-public-private-keypair
(Can I mark a question as duplicate on another stackexchange network?)
I would prefer the
(How the hell is it doing that? I can only hope the public key is encoded directly or indirectly in the private key...)
Needed this myself and used the following bash-oneliner. It should output nothing if the keys belong together. Apply a little
If they're on your local system, stick
Depending on where you get the public key file you are testing, the accepted answer may give false positive results. This is because of the behavior described in the comment by @drewbenn. Specifically, when the -e option is used with the private key file as the -f option parameter, it simply parrots (but reformats) what's in the associated public key file.
In other words,
(apparently) generates the public key value, and
simply and outputs (and reformats) the key in the existing id_rsa.pub whatever it is.
In my case, I have to verify that the pair has not been corrupted. So, I decided to compare the following:
Perhaps this is not as flexible, but it is better for my needs. Maybe it helps someone else.