Frontend Interview Questions

HTTP vs HTTPS: How TLS Actually Protects Your Traffic

"What's the difference between HTTP and HTTPS? Walk me through the TLS handshake."

Why Interviewers Ask This

TLS is a fundamental network interview question asked of frontend, backend, and security candidates alike. Interviewers test whether you understand why asymmetric crypto is used for key exchange but not for the bulk of traffic, how cert chains establish trust, and what TLS 1.3 changed.

How to Answer

  1. 1

    High level: HTTP is plaintext; HTTPS is HTTP tunneled over TLS, which provides confidentiality (encryption), integrity (MAC), and authentication (certificates).

  2. 2

    TLS 1.2 handshake — four round-trip steps: ClientHello (supported cipher suites, random); ServerHello (chosen cipher, server cert, server random); client verifies cert, generates premaster secret encrypted with server's public key, sends it; both sides derive session key from client random + server random + premaster secret.

  3. 3

    Explain the asymmetric-then-symmetric pattern: RSA / ECDHE is slow, used only to exchange the session key. Bulk data is encrypted with the symmetric session key (AES-GCM, ChaCha20) because it's orders of magnitude faster.

  4. 4

    Certificate chain and trust: the server's cert is signed by an intermediate CA, whose cert is signed by a root CA that browsers trust out-of-the-box. Chain verification walks from leaf to trusted root.

  5. 5

    TLS 1.3 improvements: handshake cut to 1-RTT (or 0-RTT for resumption); removed weak ciphers (RC4, CBC, SHA-1); Perfect Forward Secrecy is mandatory via ECDHE; all modes are AEAD.

Sample Answer

HTTP is plaintext — anyone on the network path can read or tamper with the content. HTTPS wraps HTTP in TLS, which provides three guarantees: confidentiality through encryption, integrity through a message authentication code, and server identity through X.509 certificates. The TLS 1.2 handshake runs as four logical steps. Client sends ClientHello with its supported cipher suites and a random nonce. Server responds with ServerHello choosing one cipher suite, a server random, and its certificate. The client verifies the certificate chain — the server cert is signed by an intermediate CA, whose cert is signed by a root CA that the browser already trusts. Chain verification walks from the leaf up to a trusted root in the OS or browser trust store. If valid, the client generates a premaster secret, encrypts it with the server's public key from the cert, and sends it. Both sides now have the client random, server random, and premaster secret, which they mix through a KDF to produce the symmetric session key. From then on, application data is encrypted with AES-GCM or ChaCha20 using that key. The reason for the asymmetric-then-symmetric split: asymmetric operations are hundreds to thousands of times slower than symmetric ones, so we only use RSA or ECDHE to exchange one key, then use a symmetric cipher for actual bytes. TLS 1.3 made the handshake significantly better. It cut the handshake to 1-RTT by having the client speculatively send key material in its ClientHello, and supports 0-RTT for resumption (at a replay risk trade-off). It removed all weak ciphers — no more RC4, no MD5, no CBC mode with padding oracle risk. ECDHE is mandatory, so every session has Perfect Forward Secrecy — a compromised server private key cannot decrypt past captured traffic. All cipher modes are AEAD, so authentication and encryption are always combined.

Pro Tips

  • Always explain asymmetric-for-key-exchange + symmetric-for-bulk — it's the key architectural insight.

  • Mention Perfect Forward Secrecy and ECDHE — senior roles expect this.

  • TLS 1.3 vs 1.2 improvements are a high-value follow-up; cover 1-RTT, 0-RTT, and mandatory AEAD.

  • If you blank on "ECDHE" or "AEAD" during the interview, HireMe AI can surface the acronyms and their meaning.

Frequently Asked Questions

What happens if a certificate is expired?

Browser shows a big warning page and refuses to connect unless the user explicitly bypasses. Expired certs are one of the most common production outages.

Can an attacker with the server's private key decrypt past traffic?

With RSA key exchange, yes — that's why Perfect Forward Secrecy (ECDHE) is required now. PFS means each session uses an ephemeral key that's destroyed after the session.

What's SNI?

Server Name Indication — client sends the hostname in ClientHello so a server with multiple sites can serve the right certificate. Without SNI, shared hosting couldn't do HTTPS.

Worried About Going Blank in Your Interview?

HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.

Try HireMe AI Free