All posts

Mutual TLS (mTLS): when both sides prove their identity

Mutual TLS (mTLS): when both sides prove their identity (KAEMI)

Anyone visiting a website over HTTPS verifies the server's identity without noticing it: the browser checks its TLS certificate. The reverse direction remains open. Initially, the server does not know who is connecting. For a public website, that is fine. For APIs, machine-to-machine communication, and Zero Trust architectures, it is not enough.

Mutual authentication closes exactly this gap: both sides of a connection prove their identity before data flows. The most widespread implementation is Mutual TLS (mTLS). This article explains how the method works, the certificate infrastructure behind it, what it protects against, and what matters when introducing it.

What is mutual authentication?

Mutual authentication (also called two-way authentication) means that both sides of a communication channel verify the identity of the other, instead of only one side checking. An everyday picture: with a booked ride, the passenger checks the license plate and the car before getting in, and the person behind the wheel asks for the name before setting off. Both make sure they are dealing with the right counterpart.

Digitally, it works the same way: client and server verify each other independently, instead of only the client trusting the server. Connections between devices, for example in the Internet of Things (IoT), also frequently use mutual authentication. The method is best known in connection with the Transport Layer Security (TLS) protocol, but it also exists in other protocols and contexts.

Three paths to mutual authentication

In practice, three methods have become established:

  • Public key authentication: Both sides hold a key pair consisting of a public and a private key. Each side proves via digital signature that it possesses the private key matching its published public key. If the signature can be verified with the public key, the counterpart is legitimate.
  • Certificate-based authentication: Like the public key method, except that both sides hold a public key certificate. The certificate contains additional verifiable details: who issued it, whom it applies to, and when it expires. TLS certificates on both sides enable this form.
  • Username and password: Despite the name, a server certificate is behind this as well. The client first verifies the server. On the client side, the classic login then takes place: username and password are sent to the server and checked there.

What is Mutual TLS (mTLS)?

Standard TLS authenticates only one direction: the client checks the server's certificate. Mutual TLS extends the handshake to the reverse direction. The client also presents a certificate and proves possession of the corresponding private key. Only when both checks succeed is the encrypted connection established. This makes mTLS the most widespread form of mutual authentication and, at the same time, a technical cornerstone of modern Zero Trust models.

How the mTLS handshake works

Simplified, mTLS adds three steps to the familiar TLS handshake:

  1. The client connects, the server presents its TLS certificate; the client checks it against its trusted certificate authorities (as with any HTTPS request).
  2. The server additionally requests a client certificate.
  3. The client sends its certificate and proves possession of the private key via a signature.
  4. The server checks the client certificate against the certificate authorities it accepts. Only then is the connection established and continued in encrypted form.

If one of the checks fails, no connection is established. Unknown clients are thus rejected at the transport layer, before an application even sees any requests.

The certificate chain behind it: PKI in brief

mTLS requires a public key infrastructure (PKI), on both sides. Typical is a three-tier hierarchy built in parallel for server and client certificates:

  • Root CA: the top-level certificate authority, whose key is specially protected and rarely used.
  • Intermediate CA: an intermediary signed by the root CA that issues the actual certificates. This keeps the root CA offline and the risk contained.
  • End-entity certificates: the server certificate and the client certificates, issued by the intermediate CA, with limited validity periods.

For the mutual check to work, each side maintains a truststore with the certificate authorities it trusts: the server accepts only client certificates from its client PKI, the client only servers from the server chain. The private keys never leave their systems.

What mutual authentication protects against

  • On-path attacks: An attacker who inserts themselves between both sides and impersonates the counterpart to each end fails at authenticating to both ends.
  • Spoofing and impersonation: Posing as a trustworthy server or user becomes considerably harder when both sides have to provide proof of identity.
  • Credential theft: If authentication is based on keys and certificates instead of passwords, there simply are no login credentials to harvest via phishing; such attacks come to nothing.

Typical usage scenarios

  • APIs: mTLS ensures that an interface only accepts requests from legitimate clients and that clients do not accept forged responses.
  • Microservices and service-to-service communication: In distributed architectures, services authenticate to each other via machine identities. Every internal connection is secured individually instead of trusting the network wholesale.
  • IoT: Devices communicate with servers and with each other over the open internet. Mutual authentication ensures that data comes from a legitimate source.
  • Zero Trust: If no user and no device is considered trustworthy by default, mTLS provides the two-sided proof of identity that enforces this principle at the connection level.
  • Cloud-native and enterprise environments: From the application to the database, connections can be consistently secured via certificates, regardless of where the workloads run.

Why not every connection uses mTLS

As effective as mutual authentication is, it comes at a price. The exchange costs somewhat more time and computing power, but above all it requires preparation on both sides: each party needs key pairs or certificates. For the average website visit, that is impractical. This is why ordinary HTTPS remains one-sided. The real challenges lie in ongoing management:

  • Certificate management: Issuing, distributing, and renewing many client certificates needs to be organized; done manually, it quickly becomes error-prone.
  • Rotation: Expired or compromised certificates must be reliably replaced and revoked without causing outages.
  • Complexity of distributed systems: The more services, environments, and teams are involved, the more important automation and a clean inventory of all identities become.

What matters when introducing it

Practical experience suggests a few guardrails:

  • Build your own CA hierarchy cleanly: separate chains for server and client certificates, keep the root CA offline, use intermediate CAs for issuance.
  • Short validity periods and automated renewal: the shorter a certificate is valid, the smaller the window for misuse. Rotation belongs in automation, not in the calendar.
  • Maintain truststores deliberately: The server should trust only its own client CA, not all public certificate authorities across the board.
  • Anchor enforcement on the server side: Requesting the client certificate must be mandatory at the endpoint, otherwise mTLS remains theory.
  • Create visibility: an inventory of all issued certificates and alerts before expiration prevent nasty surprises.

mTLS in Zero Trust and SASE/SSE

Mutual authentication is not a niche tool but a core component of modern security platforms. Besides TLS, the Secure Shell protocol (SSH), for example, also supports mutual authentication via keys or certificates. In Zero Trust and SASE/SSE platforms, mTLS is used to cryptographically verify users, devices, and services. Cloudflare, for instance, uses mTLS in its Zero Trust platform to verify users and devices and supports it in API Shield for securing interfaces.

How SASE/SSE bundles network and security into one cloud service is explained in our article What is SASE/SSE? .

And why access decisions should generally start from identity is covered in the article Why identity is the engine of Zero Trust .

mTLS with KAEMI

Whether API protection, service-to-service encryption, or Zero Trust access: as a managed security service provider, we at KAEMI plan, implement, and manage mutual authentication as part of a SASE/SSE architecture , including certificate management and ongoing support. During rollout, our Professional Services provide support, from PKI planning to enforcement at the endpoint.

This article draws on Cloudflare's learning article (“What is mutual authentication?”) and a technical piece on end-to-end security with Mutual TLS in modern web applications (Medium).

Want to secure access consistently with Zero Trust?

KAEMI designs, implements and manages SASE/SSE with Cloudflare One: ZTNA instead of VPN, verified access from anywhere — as a managed service.