The client and server begin communicating with what is called a “handshake”. During this procedure, the two sides authenticate each other, decide on encryption, and settle the communication rules.
The interaction between the client and server is based on a two-key system. The public key is freely shared and used to encrypt the data. The private key is kept secret and is used to decrypt it.