A protocol is a set of rules which defines, how a particular thing will happen. HTTP is a network protocol which allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web.
We usually see a lock symbol in websites which has https. Here, "s" stands for security. To achieve this security, another protocol "SSL/TLS" is used. SSL is an encryption protocol which ensures the encrypted communication between two parties (i.e. client and a server). SSL (Secure Socket Layer) is now known as TLS (Transport Layer Security).
To achieve a secure communication between client and server using SSL/TLS, a series of steps happens which are known as SSL/TLS Handshake.
Note
- SSL Certificate works on a TCP (Transmission Control Protocol) protocol to send data over the internet.
- All TLS handshake works on Public Key Cryptography. Public-key cryptography or asymmetric cryptography uses a pair of keys to encrypt and decrypt the data. The public key is used for encryption purposes and the private key is for decryption. Public Key is shared with everyone who receives the certificate upon visiting a website on internet which is secured with SSL.
- SSL can be implemented either one-way or two-way. In one -way SSL, only the client validates the identity of the server whereas in two-way (mutual) SSL, both server and client validate the identity of each other through the digital certificate so that both parties are assured of the others' identity. Usually, when we browse an HTTPS website, one-way SSL is being used where only our browser (client) validates the identity of the website (server). Two-way SSL is mostly used in server to server communication where both parties need to validate the identity of each other.
SSL/TLS Handshake
1. Handshake initiates when client (usually a web browser) sends a "hello" message to the server. The message includes the information like which TLS version the client supports, the cipher suites supported and a client random etc.
2. In reply to the client's hello message, the server sends a message containing the information like server's SSL certificate, the server's chosen cipher suite and a server random.
Notes
- The above explained way was an example of RSA Key exchange algorithm during TLS Handshake. Other could be Diffie-Hellman.
- As we have seen, after mutual agreement upon session key, encryption and decryption both will happen using the same key. Hence Handshake process is a combination of Asymmetric and Symmetric encryption.
- The certificate authority (CA) is essential to preventing man-in-the-middle attacks.