When I connect the SFTP server to the client, I only need to provide the client software with the private key, not the public key. I do not know how this works, because from [1] and [2] both require that the client software also know the public key.
My understanding of how SFTP works
Customization
client: generate private / public key pairs.
client: send the public key to the server
server: add this public key to the list of authorized keys
during connection
client: tell the server the public key
server: check if the public key is allowed, and if not, refuse, otherwise send a random session identifier to the client
client: the client uses the private key to encode the random session identifier and send it to the server
server: decode it with the public key and confirm the identifier.
In this case, the client requires a public key. However, I did not provide this, but the SFTP client could still connect the server. So how does this SFTP protocol really work?
[1] http://www.openssh.org/txt/rfc4252.txt
[2] https://www.eldos.com/security/articles/1962.php
source share