HTTPS(TLS) encryption (TLS is upgraded version of ssl)
server sends client a certificate contains server name, server public IP, signature with CA info(signed by CA's private key) to client(Browser)
client has list of CA, and public key to decrypt the signature to verify CA.
Once verified, client creates a symmetric key, client encrypts with server's public key and send to server
server decrypts using servers private key, creates a session key and encrypt with server private key,
client can then use this session key decrypt with server public key
For two way, certification verification will be done on both side, then server creates session key encrypted with clients public key
the secret key portion is symmetric :
in symmetric key encryption, both the encryption and decryption are done with the same key, or the decryption
In the case of asymmetric encryption, the public key can only be used for encrypting the message; you’ll need the private key for decrypting the message.
SSH uses combination of both for security
https://blog.invgate.com/what-are-ssh-keys
SSH works similar but little differently
SSH uses both symmetric, and asymmetric
client need to have private key, and store public key on server
1) SSH secure connection using secret key
when client makes ssh request to server, server creates secret key and encrypt using client public key and send to client, client receives this key and decrepts using its private key, and data exchange from here on will use this secret key.
2) once server acknolwedges client decrpyts symmetic key, server creates a msg, and encrypt with clients public key.
client decrypts this msg using client private key, then use this msg combine with secret key to create a hash and send to server
server will also create the same hash using the msg and secret key, if two hash matches, user is authenticated