SIP Security: Introduction to TLS Handshake.

Krishnakumar PG
3 min readJun 8, 2024

--

In today’s digital world, ensuring secure communication is crucial to protect sensitive information from unauthorized access. One of the key components of secure communication is the TLS (Transport Layer Security) handshake. In this article, we will explore what TLS handshake is and how it works to establish secure connections between clients and servers.

What is TLS Handshake?

TLS handshake is a process that occurs at the beginning of a secure communication session between a client (device that initiates the connection) and a server (device that validates and accepts the connection). Its primary goal is to establish a secure and encrypted connection before any data is transmitted.

Core Concept:

Imagine you want to have a private conversation with an unknown person in a crowded place, and you want to make sure that you are talking to the right person and nobody else can eavesdrop on your chat. This is where TLS certificates come into play. TLS certificates are like special passes that ensure your conversation stays confidential and secure. Here is how it’s made possible –

  1. Root Certificate Authority (CA): Think of the Root CA as the ultimate authority, like a government agency that issues official ID cards. They are the top dogs in the security world, and their job is to create a foundation of trust. Just like you trust your government’s ID, servers trust the Root CA’s certificate implicitly.
  2. Intermediate Certificate Authority (CA): In our analogy, the Intermediate CA is like a regional office that verifies the authenticity of ID cards. They’re trusted by the Root CA, so they have some authority. In the online world, they issue certificates for devices, vouching that the device is what it claims to be.
  3. Identity Certificates: Now, think of identity certificates as your own ID card. During TLS handshake, the client presents its identity certificate, showing it’s the real deal. Just like when you show your ID to confirm your identity. The server checks this certificate and ensures it’s signed by either the Root CA or an Intermediate CA, establishing trust.

Steps in the TLS Handshake Process:

TLS Handshake

Client Hello: The client initiates the handshake by sending a “Client Hello” message to the server. This message includes information such as the TLS version supported by the client, a random number (called the “Client Random”), and a list of supported cipher suites (encryption algorithms).

Server Hello: Upon receiving the “Client Hello” message, the server responds with a “Server Hello” message. This message contains the TLS version chosen for the session, another random number (called the “Server Random”), and the selected cipher suite from the client’s list.

Certificate Exchange: Next, the server sends its digital certificate to the client. This certificate contains the server’s public key, which is used for encryption and authentication. The client verifies the certificate’s authenticity by checking its digital signature against a trusted root certificate authority (CA).

Key Exchange: In this step, the client generates a pre-master secret, encrypts it using the server’s public key from the certificate, and sends it to the server. Both the client and server then independently derive the same master secret from the pre-master secret.

Session Key Generation: Using the master secret, the client and server generate session keys that will be used for symmetric encryption and decryption of data during the session. These session keys are unique to each session and are not transmitted over the network.

Cipher Suite Confirmation: To ensure both client and server agree on the cipher suite and session keys, they exchange messages to confirm the parameters of the encryption algorithm and verify that the handshake process has not been tampered with.

Handshake Completion: Once the cipher suite confirmation is successful, the handshake is considered complete. The client and server can now securely exchange data using the agreed-upon encryption algorithm and session keys.

Conclusion:

The TLS handshake plays a crucial role in creating secure connections between clients and servers. This process guarantees that communication sessions are encrypted, authenticated, and shielded from eavesdropping and tampering. Grasping the mechanics of the TLS handshake highlights the significance of secure communication in protecting our sensitive information online.

--

--