Handshakes are used as a greeting action to establish connection between 2 people and is typically accompanied by a brief movement, up and down before release. SSL Handshakes works the same way for sites encrypted with SSL (Secure Socket Layer) and is used to secure a connection between (1) a web browser and (2) a web server. This however, is not seen by users and happens immediately.
In SSL, there are 3 keys used to secure a connection. They are the public, private and session keys.
Just as what the term suggests, public keys are keys made available to the public and are used to encrypt a secret message for a specific recipient with a matching private key.
Private keys are matched with public keys and used to encrypt/decrypt messages. Private keys are not available to anyone except the key holder.
A session key is a symmetric key used to encrypt messages within one transmission.
What Happens behind a SSL Handshake:
1. Browser connects to web server secured with https and requests server to identify itself.
2. Server sends its SSL certificate together with the server’s public key.
3. Browser runs a check to see if the certificate root of the SSL is trusted by a Certificate Authority (CA), the certificate expiry date and common name is also validated. Once the browser trusts the SSL, it generates, encrypts and returns a symmetric session key to the server, with the server’s public key.
4. Server decrypts the the symmetric session key with its own private key and relay back an acknowledgment to start with an encrypted session.
5. Server and Browser has completed a SSL handshake and all data transmitted is encrypted with the session key.