Skip to content

TLS 1.3 is faster. Should a payment API accept 0-RTT?

The Connection Is More Than an IP · Part 4 of 6 · 6 min read

Read the worked explanation ↓

Interview question. A mobile payment client connects to a distant API over HTTPS. After switching from TLS 1.2 to TLS 1.3, the team sees better first-connection latency. Now somebody proposes enabling TLS 1.3 early data so the payment request can be sent before the new handshake finishes. Explain the handshake difference, session resumption and what can go wrong with 0-RTT.

I would separate three ideas the proposal has merged: the round trips required to create a secure session, the delay from establishing a transport underneath TLS, and the semantics of the application operation. TLS 1.3 reduces ordinary handshake round trips compared with a typical full TLS 1.2 handshake. Resumption avoids repeating all parts of a full handshake. Early data permits some application bytes to be sent sooner still, but it changes the replay model. Faster encrypted transport is not permission to execute a financial side effect twice.

In a conventional TLS 1.2 full handshake using common ephemeral key exchange, a client and server exchange hellos and authentication material, establish keys, and exchange Finished messages before application data proceeds. That typically takes two TLS round trips. A TLS 1.3 full handshake is designed to complete in one TLS round trip before the client sends protected application data in the usual way. These are TLS-specific costs. A new TCP connection still needs its own three-way handshake, and DNS or proxy work may precede both.

A timeline compares typical full TLS 1.2, full TLS 1.3 and resumed TLS 1.3 with optional early-data transmission before handshake completion.
A timeline compares typical full TLS 1.2, full TLS 1.3 and resumed TLS 1.3 with optional early-data transmission before handshake completion.
Think first

A global read-only product catalog receives 20 percent of requests on new TLS connections over 130 ms RTT links. Design a measurement plan for full versus resumed TLS 1.3, then decide which endpoints, if any, could safely accept 0-RTT.

Take a few minutes to form an approach, then compare it with the worked explanation.

Reveal the worked explanation

Resuming a previous relationship

If the client previously connected successfully, the server can supply information supporting future resumption, commonly through a TLS 1.3 resumption ticket. The client can derive a pre-shared-key identity from that ticket and try a resumed handshake. Server policy, ticket validity, key rotation and the selected cryptographic parameters determine whether resumption is accepted. A ticket is not an everlasting credential or proof that a client can skip authenticating the service it reaches.

For accepted TLS 1.3 resumption, the client may send 0-RTT early data with its first flight rather than waiting for the new handshake to finish. This can matter on high-latency links. But early data is not protected against replay in the same sense as ordinary handshake-completed application data. A captured early-data flight can potentially be replayed under conditions the server and deployment must explicitly defend against.

The replay issue is about execution, not whether an attacker can read the encrypted payload. The encryption can be strong while a duplicated request still causes a duplicate purchase or transfer. TLS 1.3 also does not give 0-RTT data the same forward-secrecy properties as later traffic in the connection. Servers may reject early data, in which case the client needs a defined fallback and must not blindly issue harmful operations twice.

A payment request is the wrong first experiment

Suppose POST /charges creates a charge each time it executes and has no business idempotency contract. Sending it as 0-RTT exposes a replay-sensitive mutation earlier in the connection. Even a correctly implemented TLS stack does not know what that mutation means. The safer answer is to refuse early data for this endpoint. Later, the platform can design deduplicated payment identifiers, authenticated state transitions and an explicit application policy for request replay, but that does not make indiscriminate early data a sensible default.

You may hear that GET methods are safe. HTTP defines safe methods, but real services sometimes hide side effects behind GET routes. A GET endpoint that issues a password reset, changes inventory or triggers a job should not be treated as replay-safe just because of its verb. Even ordinary GET requests can have privacy, rate-limiting and cache implications. The deployment's replay-safety policy must reflect actual handler behavior and authentication context.

Anti-replay mechanisms can reduce risk, but distributed deployment complicates them. Imagine a ticket accepted by edge A and replayed through edge B. An edge-local replay cache does not automatically protect the whole acceptance domain. Bounded ticket age, shared replay tracking or server partitioning can help, each with availability and consistency costs. TLS 1.3 explicitly warns that preventing all replay requires more than treating the early-data flag as harmless.

Diagnose setup latency without overclaiming

I would instrument DNS resolution, TCP establishment, TLS negotiation, ALPN selection, ticket acceptance, and time to first response byte separately. If most calls reuse long-lived connections, handshake savings may barely change normal API latency. If radio networks repeatedly interrupt connections, reducing setup costs may help much more. But opening unnecessary connections to measure handshake speed could itself worsen CPU, certificate operations and port use.

On a 150 ms RTT path, a simplistic comparison suggests one fewer TLS round trip can save roughly 150 ms on a cold connection. It does not guarantee that observed end-to-end time falls by exactly that amount. Servers process handshakes, TCP setup may overlap other work, the client might use QUIC rather than TCP, and connection reuse might remove setup from most requests entirely. Measure the actual population of new versus resumed sessions.

My design would enable TLS 1.3, prefer connection reuse, ensure session-ticket rotation and key protection, and consider early data only for explicitly reviewed replay-tolerant operations. I would log early-data acceptance and rejection and exercise fallback under edge rotation. For payment mutations, the latency budget should be improved through endpoint placement, fewer round trips in the application workflow, and safe request contracts rather than through removing a security boundary.

At interview depth, remember the actual decision: TLS 1.3's shorter handshake is usually good. TLS 1.3 0-RTT is a separate application-security choice. That distinction leads into the next lesson about HTTP/2 and HTTP/3, where removing one kind of transport blocking can improve some request patterns but cannot remove every source of delay.

Go deeper

RFC 8446 defines TLS 1.3 full handshakes, PSK-based resumption, early data and replay limitations. Early-data acceptance and application replay tolerance are opt-in protocol and service decisions. TLS over TCP differs from QUIC's TLS 1.3 handshake integration, so do not add an independent TCP three-way handshake to the QUIC case. For comparison, the common TLS 1.2 full handshake involves two TLS round trips, but exact historical behavior depends on negotiated features and implementations. TLS 1.3 uses newer key-schedule and handshake encryption properties, not merely a shorter version number.

Check your reasoning

  • Compare representative full TLS 1.2 and TLS 1.3 handshake RTTs.
  • Keep TCP establishment separate from TLS RTT estimates.
  • Explain PSK tickets, TLS 1.3 resumption and early-data rejection.
  • Describe 0-RTT replay and distributed anti-replay limitations.
  • Choose replay-safe application policy for payment-like mutations.

Common mistake: 0-RTT encryption proves an early-data POST cannot be replayed at another edge.

A payment API is considering TLS 1.3 early data. Which application policy accounts for the replay risk?

Read the answer explanation

Restrict early data to explicitly reviewed replay-tolerant operations — Encryption does not provide ordinary early-data anti-replay guarantees across a distributed edge.

Apply it elsewhere

A game API uses TLS 1.3 session tickets across four edges. Each edge keeps its own replay cache. Show how a duplicated 0-RTT state-changing request might reach different edges and what an application replay policy must cover.

Compare your approach

Separate TCP and TLS costs, compare full and resumed handshakes, describe 0-RTT replay and rejection, explain distributed anti-replay limits, and choose a safe application-level policy.

One more constraint

If the client encrypts an early-data payment POST under a resumption key, does that encryption guarantee the payment cannot be replayed and processed twice?

Quick revision

A typical full TLS 1.2 handshake costs two TLS round trips, while a full TLS 1.3 handshake costs one. Resumption uses previously established key material and can allow TLS 1.3 early data to be sent before handshake completion. Early data is replay-sensitive and lacks some protections of later traffic. Reject 0-RTT for payment mutations unless an explicit, thoroughly reviewed protocol and business replay contract supports it. Measure actual cold, resumed and reused connections before estimating latency gains.

References