Question

I have been reading about SSH and about how it uses public key crytography to authenticate a client. I have understood all the concepts but have a doubt:

Quoting from the ArchLinux Wiki Page:

"When an SSH server has your public key on file and sees you requesting a connection, it uses your public key to construct and send you a challenge. This challenge is like a coded message and it must be met with the appropriate response before the server will grant you access. What makes this coded message particularly secure is that it can only be understood by someone with the private key. While the public key can be used to encrypt the message, it cannot be used to decrypt that very same message. Only you, the holder of the private key, will be able to correctly understand the challenge and produce the correct response."

After this authentication happens and the server gives me access, how are further messages encrypted? All of the commands that i run on the server, how do i ensure that the response of all of those commands is indeed valid/genuine?

Was it helpful?

Solution

Short version: during the key exchange phase a symmetric cipher is chosen and a new symmetric key is generated. All communications after that point are encrypted and, due to properties of the (good) key exchange protocol, the session key is known only to that particular client and server, meaning that nobody else can read or modify the traffic.

From the high level point of view the same scheme is used in SSL/TLS and other similar protocols: two parties start with asymmetric crypto (slow), use the key exchange protocol to generate a new symmetric key (sometimes called session key) and the actual communications are encrypted using symmetric crypto (fast).

RFC 4253 and related RFC's contain the detailed explanation of the SSH protocol.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top