TLS Handshake and Certificate Chain Quiz

A 4-question reference set on TLS 1.3: the handshake flights, certificate chain validation, SNI privacy, and mTLS rotation. Covers the practical knobs that show up at staff-level networking interviews.

Question Bundle
Python
4 questions
tls
security
networking
interview-prep

By CodeSnatch

April 3, 2026

·

Updated August 10, 2026

241 views

8

4.3 (14)

Walk through the TLS 1.3 handshake step by step. What does each side send, and at what point can the client start sending encrypted application data?

Examples

Example 1:

Input: Client opens a fresh TLS 1.3 connection to example.com
Output: 1-RTT before application data: ClientHello (with key share) -> ServerHello + cert + Finished -> Client Finished -> data
Explanation: TLS 1.3 reduces handshake to a single round trip vs TLS 1.2's two.

Example 2:

Input: Resumed session with PSK (pre-shared key) from a recent connection
Output: 0-RTT: client can send application data in the very first flight
Explanation: 0-RTT trades replay resistance for latency and is opt-in per server policy.
import ssl
import socket

def fetch_with_tls13(host: str, port: int = 443) -> bytes:
    context = ssl.create_default_context()
    context.minimum_version = ssl.TLSVersion.TLSv1_3
    with socket.create_connection((host, port), timeout=5) as raw:
        with context.wrap_socket(raw, server_hostname=host) as tls:
            tls.sendall(f"GET / HTTP/1.0\r\nHost: {host}\r\n\r\n".encode())
            chunks = []
            while True:
                data = tls.recv(4096)
                if not data:
                    break
                chunks.append(data)
            return b"".join(chunks)