How HTTPS Secures Your Connection: From TCP Handshake to TLS Encryption

HTTPS combines HTTP with SSL/TLS encryption to protect data transmission, involving DNS lookup, TCP three‑way handshake, TLS negotiation with certificates and symmetric keys, and finally encrypted HTTP communication, while the article also explains TCP’s four‑way termination and the overall request‑response flow.

21CTO
21CTO
21CTO
How HTTPS Secures Your Connection: From TCP Handshake to TLS Encryption

What is HTTPS?

HTTPS (HyperText Transfer Protocol Secure) is HTTP combined with SSL/TLS certificates, ensuring confidentiality, integrity, and authenticity of data transferred over the network.

How HTTP and HTTPS connections are established

1. Establishing the connection

When a user enters a URL, the browser resolves the domain via DNS cache, local DNS, hosts file, or DNS server to obtain the IP address. Then a TCP three‑way handshake creates a reliable connection.

2. TCP three‑way handshake

1) Client sends SYN. 2) Server replies with SYN‑ACK. 3) Client sends ACK, and the connection enters ESTABLISHED state.

3. TCP four‑way termination

1) Client sends FIN. 2) Server acknowledges with ACK. 3) Server sends its own FIN. 4) Client acknowledges with ACK, closing the connection.

4. HTTP request flow

Client sends a request after the TCP connection is established.

Server processes the request and returns a response.

Client receives and renders the response for the user.

HTTPS handshake and encryption process

HTTPS requires the server to be configured with a valid SSL/TLS certificate. The handshake proceeds as follows:

Client sends a ClientHello containing supported cipher suites.

Server replies with ServerHello, selecting a cipher suite and providing its digital certificate.

Client verifies the certificate with a Certificate Authority (CA) and extracts the server’s public key.

Client generates a random pre‑master secret, encrypts it with the server’s public key, and sends it to the server.

Both parties derive symmetric session keys from the pre‑master secret.

Client and server exchange Finished messages, confirming that encryption parameters are agreed.

After this TLS negotiation, HTTP data is encrypted with the symmetric keys, providing confidentiality and integrity.

Why SSL/TLS certificates are essential

Deploying an SSL/TLS certificate protects data in transit from eavesdropping and tampering, safeguarding user privacy and corporate information. In China, only three CA institutions meet the international WebTrust standard, ensuring reliable global certification services.

TCP handshake diagram
TCP handshake diagram
HTTP request flow
HTTP request flow
TLS handshake diagram
TLS handshake diagram
SSL certificate importance
SSL certificate importance
CA certification in China
CA certification in China
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

encryptionTLSWeb SecurityTCP handshake
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.