how/network
The green padlock in the browser does not appear right away. Before it, a few packets pass where the two sides pick a cipher, check the certificate, and compute a shared key.
When you open https://example.com, before the page content
shows up in the browser, the client and server have to agree on an
encrypted channel. That is the TLS handshake.
It settles several things at once:
Press ▶ to see how all of this happens in 3 packets (TLS 1.2; 1.3 is trickier, everything in 1 round-trip, but the idea is the same).
Before TLS there has to be a ready transport channel:
a TCP connection in ESTABLISHED (see tcp-handshake).
On top of that channel a separate handshake begins. Now you negotiate the encryption. Until it finishes, no HTTP data is sent, only internal TLS messages.
recap
What to remember:
intermediate-09-tls- handshake that walks through a real pcap from tcpdumpRelated to the [[tls-handshake|extended KB article]] and to the next explainer on HTTPS cert chain validation: what happens when the browser checks the certificate.