security - How SFTP works with keys? -


i new sftp , need understanding following. research half day on net not found relevant ans.

what role of keys in sftp? authentication or encrypting data?

my assumption lets using computer name "source" , need send file computer name "destination".

now think computer named "source" generate pair of public , private keys. send public key computer "destination" , keep private key secure.

now confused because if sftp uses keys encrypt data if computer "source" encrypt data using public key , send computer name "destination", destination computer not have private key decrypt file, how working?

on note if keys use authenticate how works. computer "source" has both private , public key , computer "destination" has public key. understanding can have public key if man in middle has public key , if install on pc, how security works then?

there 2 distinct concepts understand:

  1. data encryption use symmetric-key algorithms such 3des, aes,..
  2. public key authentication use asymmetric algorithms such rsa, ecdsa,..

from sftp man page :

sftp interactive file transfer program, similar ftp, performs operations on encrypted ssh transport. may use many features of ssh, such public key authentication [...]

from ssh man page :

public key authentication works follows: scheme based on public-key cryptography, using cryptosystems encryption , decryption done using separate keys, , unfeasible derive decryption key encryption key. idea each user creates public/private key pair authentication purposes. server knows public key, , user knows private key.

the data encryption algorithm can selected -c option :

-c cipher_spec selects cipher specification encrypting session.

the supported ciphers are: - 3des-cbc - aes128-cbc - aes192-cbc - aes256-cbc [...]

  • the authentication keys (assymetric) stored in ~/.ssh/ directory , are not used data encryption.
  • the data encryption keys (symmetric) created per session through key exchange algorithm , never communicate between client , server if same key present on both side of communication.

for more details, can read article digital ocean : understanding ssh encryption , connection process


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -