What has to be settled before encrypted data can flow?
Three things. First, both sides must pick a protocol version and a set of algorithms they both support. Second, the client must be convinced it is talking to the real owner of the hostname and not to an interceptor. Third, both sides need the same secret keys without ever sending those keys across the network. The handshake does all three in a few messages, and the result is the padlock in a browser or a successful curl https://....
How does a TLS 1.3 handshake run?
- ClientHello: the client lists supported versions and cipher suites, sends a random value, names the host it wants through SNI, and already includes a key share, usually an X25519 public value.
- ServerHello: the server picks the suite and replies with its own key share. From the two shares, both sides compute the same secret with Diffie-Hellman, and everything after this point is encrypted.
- Encrypted extensions, certificate and CertificateVerify: the server sends its certificate chain and signs the handshake transcript with its private key, proving it holds the key matching the certificate.
- Finished: both sides send a MAC over the whole transcript, confirming nobody altered any message along the way.
The client can send the HTTP request right after its Finished message, so a full TLS 1.3 setup costs one round trip on top of the TCP handshake.
How was TLS 1.2 different?
| Aspect | TLS 1.2 | TLS 1.3 |
|---|---|---|
| Round trips for a full handshake | Two | One |
| Key exchange | RSA key transport or (EC)DHE | (EC)DHE only, always forward secret |
| Certificate visibility | Sent in clear text | Encrypted |
| Cipher choices | Many, including weak legacy ones | Five AEAD suites |
| Resumption | Session IDs and tickets | PSK tickets, optional 0-RTT data |
Dropping RSA key transport matters: with it, anyone who later obtained the server private key could decrypt recorded traffic. Ephemeral Diffie-Hellman gives forward secrecy, so old sessions stay private even if the key leaks.
How does the client decide to trust the certificate?
It checks that the certificate covers the requested hostname, that it is within its validity dates, and that a chain of signatures leads from it through intermediates to a root certificate in the system or browser trust store. Servers must send the intermediates; a missing intermediate is the most common cause of a handshake that works in one browser and fails in another or in curl. Revocation checks and certificate transparency logs add further assurance. Server Name Indication (SNI) explains how one address serves many certificates.
How can I watch a handshake from the shell?
openssl s_client -connect shop.example:443 -servername shop.example -tls1_3 -brief </dev/null openssl s_client -connect shop.example:443 -servername shop.example -showcerts </dev/null 2>/dev/null | grep -E '^ *[0-9] s:|^ *i:' curl -sv -o /dev/null https://shop.example 2>&1 | grep -E '^\* (SSL|TLS|ALPN|Server certificate|subject|issuer)'
The first command prints the negotiated version, cipher and peer certificate in a compact form. The second lists the chain the server sends, one subject and issuer per level. The third shows what curl negotiated, including ALPN, which tells you whether HTTP/2 was agreed during the handshake.
What does session resumption save?
A returning client can present a ticket from an earlier session and skip the certificate exchange and signature. In TLS 1.3 it can even send its request in the first flight (0-RTT), saving a full round trip. Because 0-RTT data can be replayed by an attacker, servers should only accept it for safe, idempotent requests like plain page loads; nginx leaves it off unless you enable ssl_early_data.
What do handshake failures usually mean?
- No shared cipher or protocol: an old client meeting a modern-only server, or the other way round.
- Certificate name mismatch: the certificate does not list the hostname, often because SNI was missing.
- Incomplete chain: the server sends only the leaf certificate.
- Clock skew: a machine with the wrong date rejects valid certificates as not yet valid or expired. Check with
timedatectl.
How much CPU do handshakes cost?
The signature and key agreement are the expensive part, and ECDSA certificates sign much faster than RSA ones. Busy APIs with many new connections per second benefit from fast cores; the S14 with 16 cores at high clocks handles a very large handshake rate, while the S2 is plenty for a typical site that reuses connections.
Machines for HTTPS-Heavy Sites and APIs
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| S2 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $58.39 | $58.39 (1 month) |
| S4 | Intel Xeon E-2388G | 8 / 16 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $87.52 | $87.52 (1 month) |
| S11 | Intel Core i9-14900K | 24 / 32 | 128 GB DDR5 | 2x 2 TB NVMe | 2x 10 Gbps | $149.39 | $149.39 (1 month) |
| S14 | AMD EPYC 4565P | 16 / 32 | 192 GB DDR5 | 2x 4 TB NVMe | 2x 25 Gbps | $317.89 | $317.89 (1 month) |
Keep Reading
Server Name Indication (SNI)
The TLS extension that lets one IP address serve HTTPS for many domains, how it works in nginx, and how to test and troubleshoot it.
OpenEncryption
How encryption turns readable data into ciphertext, symmetric versus public key methods, and where to encrypt data on a server.
OpenSSH vs SSL/TLS
Both encrypt traffic, but SSH runs your admin sessions while TLS protects websites and APIs; here is where each fits.
OpenLet's Encrypt with nginx
Get free TLS certificates for nginx with certbot, choose the nginx or webroot method, and confirm automatic renewal works.
OpenFAQ
Quick Answers
One for a full TLS 1.3 handshake and two for TLS 1.2, on top of the TCP handshake. Resumed TLS 1.3 sessions can send data immediately.
Each session uses fresh Diffie-Hellman keys, so recorded traffic cannot be decrypted later even if the server private key is stolen.
Usually the server is missing an intermediate certificate. Browsers sometimes fill the gap, curl does not.
Only for requests that are safe to repeat, because early data can be replayed. Many sites leave it off.
Run openssl s_client with -brief against your hostname, or curl -v, and read the negotiated protocol line.