Encryption

mTLS Explained: Mutual TLS for Zero-Trust APIs

Learn how mTLS mutual TLS works, how it authenticates both client and server, and why it is the standard for securing zero-trust API and microservice traffic.

Editorial Team ·
9 min read intermediate

Introduction

In 2023, the US government mandated that all federal agencies achieve Zero Trust security goals by the end of fiscal year 2024. The technical requirement at the heart of that mandate is simple and unforgiving: every service, device, and user must prove its identity for every connection — no exceptions, no implicit trust based on network location. When a microservice calls another microservice inside your data center, the assumption that internal traffic is safe has cost organizations millions in lateral-movement breaches. mTLS — mutual TLS — is the cryptographic mechanism that eliminates that assumption.

Standard TLS protects your HTTPS connections by authenticating the server to the client: your browser verifies the bank’s certificate before sending your password. But the bank’s server never verifies that your client is who it claims to be — it accepts any connection and relies on application-layer credentials. mTLS adds the missing half of that handshake. The server sends a CertificateRequest to the client, and the client must respond with a valid X.509 certificate, proving it is an authorized party before a single byte of data flows.

This article explains how the mTLS handshake works at the protocol level, how it differs from standard TLS in practical terms, why service meshes have made it the default for microservice architectures, and how RFC 8705 extends mTLS to protect OAuth 2.0 tokens from theft. Whether you are designing a zero-trust API gateway, auditing your Kubernetes service mesh, or reviewing encryption at rest vs in transit controls for a compliance audit, understanding mTLS is essential.

What Is mTLS?

mTLS stands for mutual Transport Layer Security — the word “mutual” indicating that both parties in a TLS connection authenticate each other, not just the server authenticating to the client as in standard TLS. The underlying protocol is identical to TLS defined in RFC 8446; mTLS is not a separate protocol but a specific configuration of TLS where the optional CertificateRequest step becomes mandatory.

In standard TLS, the client verifies the server’s certificate against a trusted Certificate Authority (CA), the server proves it holds the corresponding private key, and the session proceeds. In mTLS, the server adds one additional message — CertificateRequest — and the client must respond with its own certificate and a CertificateVerify signature proving possession of the matching private key. Both parties walk away from the handshake cryptographically certain of the other’s identity.

Think of the difference this way: in a standard HTTPS connection, the bank proves it is really the bank, but the customer is anonymous until they type a password. In an mTLS connection, both the bank and the customer prove their identity using cryptographic certificates before the conversation even begins.

How mTLS Works

The mTLS handshake extends the standard TLS 1.3 flow with two additional messages from the client. Here is the complete sequence in plain English.

Step 1: ClientHello. The client initiates the connection exactly as in standard TLS — sending its supported cipher suites, TLS version, and an ephemeral Diffie-Hellman key share.

Step 2: ServerHello + CertificateRequest. The server responds with its own key share, derives the shared secret, and then sends its certificate for the client to verify. Crucially, the server also sends a CertificateRequest message. This is the message that transforms standard TLS into mTLS. In standard TLS, this message is absent.

Step 3: Client certificate + CertificateVerify. The client must now respond with two additional messages. The first is its own Certificate — an X.509 certificate signed by a CA that the server trusts. The second is CertificateVerify — a digital signature over the entire handshake transcript using the client’s private key. This signature proves that the client actually possesses the private key corresponding to the certificate, not just a copy of someone else’s certificate.

Step 4: Finished messages. Both parties exchange Finished messages — cryptographic hashes of the entire handshake — to confirm that no message was tampered with in transit.

Step 5: Encrypted application data. The session begins. Every byte of application data is encrypted with the symmetric session keys derived from the Diffie-Hellman exchange. Both endpoints have now proven their identity and established a confidential, integrity-protected channel.

The key insight is that mTLS shifts authentication from the application layer — where it relies on passwords, API keys, and JWTs — to the transport layer, where it relies on asymmetric cryptography. A stolen API key grants access to anyone; a stolen certificate is useless without the private key that lives on the legitimate client’s hardware or HSM.

Watch how the mTLS handshake adds the CertificateRequest from the server and the client's Certificate plus CertificateVerify response — the two messages that make authentication mutual.
This 22-minute breakdown covers the full mTLS handshake, certificate chains, and real-world implementation patterns in Kubernetes service meshes. Pay attention to the CertificateRequest segment starting around the 8-minute mark.

mTLS vs Standard TLS

The comparison below highlights the differences that matter for your architecture decisions.

FeatureStandard TLSmTLS
Server authenticated?YesYes
Client authenticated?No (anonymous)Yes (certificate required)
Authentication layerTransportTransport
Credential typeServer X.509 certificateServer + client X.509 certificate
Protects against MITM?Server side onlyBoth sides
Replaces application-layer auth?NoPartially — for service identity
Certificate management complexityLow (one CA per server)High (CA must issue client certs)
Suitable for user-facing APIs?YesRarely (user cert management is complex)
Suitable for service-to-service?PartialIdeal
Standard referenceRFC 8446RFC 8446 (§ 4.3.2) + RFC 8705 (OAuth)

The most important row is “Suitable for user-facing APIs?” — mTLS is designed for machine-to-machine communication, not human users. Requiring browser users to install client certificates is operationally impractical and nearly never done outside of government and financial sector smart card environments. For service-to-service communication inside a cluster, mTLS is the correct default.

Real-World Use Cases

Kubernetes service meshes. Istio and Linkerd are the two dominant open-source service meshes, and both implement mTLS transparently. Each mesh runs a control plane that acts as an internal CA, automatically issuing short-lived X.509 SVID certificates (per the SPIFFE standard) to every workload. The sidecar proxy intercepts all network traffic and performs the mTLS handshake on behalf of the application. Application developers write code that calls another service’s hostname; the mesh handles mutual authentication, encryption, and certificate rotation without a single line of crypto code in the application. A 2023 survey found that 79% of organizations adopting service meshes cited security — specifically mTLS enforcement — as the primary driver.

Financial APIs and PSD2 compliance. The EU’s Payment Services Directive 2 (PSD2) mandates that Open Banking APIs authenticate third-party providers using eIDAS-qualified certificates — effectively requiring mTLS for all API calls to bank systems. RFC 8705’s certificate-bound access tokens are increasingly used here: the bank issues an OAuth 2.0 access token bound to the third party’s certificate, so even if the token is intercepted in a log or proxy, it cannot be replayed by an attacker who lacks the private key. Our guide on key management services covers how HSMs store those private keys securely.

IoT device authentication. Traditional IoT security relies on shared secrets baked into firmware — a single compromised device reveals the credential for every device in the fleet. mTLS allows each device to hold a unique private key provisioned at manufacture, with a unique certificate issued by the manufacturer’s CA. A compromised device’s certificate can be revoked without affecting others. NIST SP 800-207’s zero-trust principles align directly with this model, and the broader organizational framework for implementing zero trust across all technology environments is documented in the NIST Cybersecurity Framework.

Common Mistakes to Avoid

Using long-lived client certificates. The entire zero-trust model breaks down if a compromised certificate remains valid for years. SPIFFE-compliant service meshes issue certificates with lifetimes measured in hours, not years. For your own PKI, follow the same discipline: use short-lived certificates and automate rotation. A certificate that expires in 24 hours limits the blast radius of any single compromise to one day. See our article on encryption key rotation for the rotation principles that apply equally to certificate management.

Skipping certificate revocation. When a service is decommissioned or a private key is suspected compromised, you need a mechanism to immediately invalidate its certificate. If your service mesh does not use short-lived certificates, configure OCSP stapling or CRL distribution points. Without revocation, a decommissioned service’s stolen certificate remains valid until it expires — potentially months later.

Confusing mTLS with application-layer authorization. mTLS answers “who are you?” at the transport layer — it proves cryptographic identity. It does not answer “what are you allowed to do?” That question belongs to your authorization layer: RBAC policies, API gateway rules, or attribute-based access control. mTLS and authorization work together; mTLS alone is not a complete access control solution.

Forgetting about certificate transparency for internal CAs. Your internal CA does not submit to public Certificate Transparency logs, which means rogue certificate issuance goes undetected without equivalent internal monitoring. Maintain an internal certificate inventory, audit CA logs, and alert on unexpected issuances. Our certificate transparency explainer covers why CT logs matter for public CAs and what the equivalent looks like for private infrastructure.

Not testing mTLS configuration before rollout. Enabling STRICT mTLS mode in Istio without first auditing which services actually support it will cause immediate connectivity failures. Use PERMISSIVE mode — which accepts both mTLS and plaintext traffic — during migration, monitor which services are still sending plaintext, migrate them, then enforce STRICT mode.

Getting Started

Start with your service mesh control plane. If you run Kubernetes, install Istio or Linkerd and let the mesh handle certificate issuance and rotation automatically. The default Istio profile enables mTLS in PERMISSIVE mode. Once all services are meshed, switch to STRICT mode via a PeerAuthentication policy. This is the lowest-friction path to organization-wide mTLS.

Design your internal PKI before issuing certificates. Every mTLS deployment depends on a CA that both sides trust. Decide whether you will use the service mesh’s built-in CA (appropriate for most clusters) or integrate an external CA like HashiCorp Vault or AWS Private CA for cross-cluster identity. The trust boundary must be explicit — a certificate signed by your development CA should never be trusted by production services. Our article on hardware security modules explains how HSMs protect the CA’s root private key.

Implement RFC 8705 for your external OAuth APIs. If you expose APIs to third-party partners, require certificate-bound access tokens. Configure your authorization server to embed the client certificate thumbprint in issued tokens and configure your resource server to verify the match on every request. This single change makes stolen tokens non-replayable — the most common attack on bearer OAuth tokens. If you are not yet familiar with how OAuth 2.0 and OpenID Connect work end to end, read OAuth 2.0 and OpenID Connect Explained before implementing RFC 8705.

Monitor with zero-trust telemetry. A well-configured service mesh gives you mutual-authentication status for every connection in your cluster. Export that data to your SIEM and alert on any plaintext connections, expired certificates, or certificate verification failures. These signals are your early warning system for compromised workloads or misconfigured services. Pair this monitoring with the controls described in our zero-knowledge encryption guide for a defense-in-depth strategy that protects data even if transport security is bypassed.

FAQ

Common questions — answered in plain English.

What is mTLS and how does it differ from TLS?
Standard TLS authenticates only the server — the client verifies the server's certificate but remains anonymous. mTLS (mutual TLS) adds a second authentication step: the server also requests and verifies a certificate from the client. Both parties prove their identity before any data is exchanged.
Why is mTLS important for zero-trust security?
Zero trust requires cryptographic verification of every connection, regardless of where it originates. mTLS provides that verification at the transport layer — every service must present a valid certificate to communicate. This eliminates the assumption that traffic from inside the network is automatically trustworthy.
How does mTLS work in a service mesh?
Service meshes like Istio and Linkerd inject a sidecar proxy alongside each service. The mesh control plane acts as a Certificate Authority and automatically issues short-lived X.509 certificates to each workload. The proxy handles the mTLS handshake transparently, so application code never needs to manage certificates.
What is the difference between mTLS and API keys?
API keys are bearer credentials — anyone who obtains the key can use it, and they are often long-lived and hard to rotate. mTLS uses asymmetric cryptography: the client must possess the private key corresponding to its certificate, making stolen credentials useless without the key. mTLS also encrypts the channel, while API keys do not.
Does mTLS slow down API performance?
The mTLS handshake adds a small amount of latency on connection establishment, but modern TLS 1.3 completes mutual authentication in one round trip. For long-lived connections, the overhead is negligible. Sidecarless service mesh architectures using eBPF reduce this further.
What is RFC 8705 and how does it relate to mTLS?
RFC 8705 defines how to use mTLS for OAuth 2.0 client authentication and how to bind access tokens to the client's certificate. This prevents token theft: even if an attacker intercepts an access token, they cannot use it without the private key that corresponds to the certificate the token was bound to during issuance.

References

  1. [1]
  2. [2]
  3. [3]
  4. [4]
  5. [5]