I'm starting to understand how RSA and public/private key systems work, and I was wondering where my private and public SSH key are stored. When I go to my home directory, and I browse my .ssh directory (cd .ssh), I only see the "known_hosts" file, which I guess contains the public keys of different remote SSH servers I know.
Where can I find these keys? I don't even remember creating them by the way, but since I've already established ssh connections before, they must be somewhere.
I'm using OpenSSH_5.2p1 with MAC OS 10.6.
Thanks!
Best Answer
~/.ssh/id_rsa
and~/id_rsa.pub
usually. But it doesn't follow that ssh must create a pair and save them: ssh basically uses the SSL protocol, which establishes a session key using the Diffie/Hellman key-exchange algorithm or some variant. That means the handshake setting up the connection generates a session key and discards it when the session is completed.Read up on the algorithm, it's pretty nifty: using fairly simple math, it establishes a key known to both ends of the connection without ever sending the key over the connection.