SSH protocol 2 allows you to use DSA, ECDSA, ED25519 and RSA keys when establishing a secure connection to a server. (Keep in mind for this question that I'm only familiar with the procedure and capabilities of RSA, and can't speak for the other methods)
What confuses me, is according to man sshd
, Diffie-Hellman is used for the key exchange:
For protocol 2, forward security is provided through a Diffie-Hellman key agreement. This key agreement results in a shared session key. The rest of the session is encrypted using a symmetric cipher...
This leads to two questions:
- Where does the RSA key come into play if it isn't used during the key exchange?
- Why is a second protocol (in this case, Diffie-Hellman) required? Why not just use the client's RSA public key to encrypt the session key on the server, and send it to the client?