Network security

What Is Mutual TLS (mTLS)? How Two-Way Authentication Works

Mutual TLS adds a client certificate to ordinary TLS, so the server checks the client as well as the other way round. Here is how it works and when it is worth the effort.

Cysoro Security TeamPublished · 9 min read
SServer CClient CERTIFICATEX.509 • verified NETWORK SECURITY MutualTLS Both sides prove who they are.
Quick answer

Mutual TLS (mTLS) is TLS in which both the client and the server present X.509 certificates and prove they hold the matching private keys. Ordinary TLS only authenticates the server; mTLS also authenticates the client, so a server can reject unknown devices, services and API callers before they reach application code.

Key takeaways

  • mTLS adds client-certificate authentication to ordinary TLS, so both ends prove their identity.
  • It proves possession of a private key, but it does not by itself grant any API permission.
  • mTLS works best for service-to-service traffic, internal APIs and managed devices, not for public websites.

When you visit a website over HTTPS, your browser checks the site's certificate, but the site never checks a certificate from you. Mutual TLS turns that one-way check into a two-way one: the client must also prove who it is before the server lets it in.

What is mutual TLS?

Mutual TLS, usually shortened to mTLS, is TLS in which both the client and the server authenticate each other with X.509 certificates. Each side presents a certificate and proves it holds the matching private key, so the connection is encrypted and both identities are checked.

Ordinary TLS, the protocol behind HTTPS, authenticates the server only. That is enough for a public website, because any visitor should be able to connect. It is not enough when a service should only talk to known callers, such as another internal service, a partner's server, or a managed device.

Cloudflare describes mTLS as a method for mutual authentication that is often used in a Zero Trust framework to verify users, devices and servers inside an organization. The organization implementing it usually acts as its own certificate authority, issuing client certificates only to devices and services it trusts.

How does the mTLS handshake work?

The mTLS handshake adds two steps to the normal TLS handshake: the server asks the client for a certificate, and the client sends its certificate plus a signature proving it holds the private key. Only then does the server grant access and encrypted application data flow.

  1. Client connects. The client sends its opening message, offering the TLS versions and cipher suites it supports.
  2. Server presents its certificate. The server replies with its certificate and a signature proving it holds its private key.
  3. Client verifies the server. The client checks the certificate chain, expiry dates and hostname, exactly as a browser does for HTTPS.
  4. Server requests a client certificate. The server sends a CertificateRequest message asking the client to authenticate itself.
  5. Client presents its certificate. The client sends its certificate chain and a CertificateVerify signature made with its private key.
  6. Server verifies the client. The server checks the chain against its trust store, confirms the certificate is valid for client authentication, and verifies the signature.
  7. Encrypted data flows. Both sides agree session keys and exchange application data over the authenticated, encrypted channel.

Neither side ever sends its private key over the network. The CertificateVerify signature is the proof: it can only be produced by someone holding the private key, while the certificate itself is public information and can be freely copied.

The mTLS handshake, step by step1. Client connectsClientHello2. Server presents certcertificate and signature3. Client verifies serverchain, dates, hostname4. Server asks for certCertificateRequest5. Client presents certcertificate and signature6. Encrypted data flowsboth sides authenticatedSteps 4 and 5 are the extra steps mTLS adds to ordinary TLS.
The mTLS handshake adds a client-certificate request and proof of possession to the normal TLS handshake. Illustration by Cysoro.

How is mTLS different from ordinary TLS?

Ordinary TLS answers one question: is this the server I think it is? mTLS answers two: is this the right server, and is this an approved client? The encryption is the same in both cases; only the authentication changes.

Ordinary TLS (one-way)Mutual TLS (mTLS)
Server authenticatedYes, with a certificateYes, with a certificate
Client authenticatedNoYes, with a client certificate
EncryptionYesYes
Who can connectAnyoneOnly holders of an approved certificate
CredentialNone needed from the clientClient certificate and private key
Typical usePublic websites, public APIsInternal APIs, service-to-service calls, managed devices
Setup effortLow: one server certificateHigher: a CA, issuance, renewal and revocation

That extra check is also the main cost. Somebody has to issue every client certificate, renew it before it expires, and revoke it when a device is lost or a service is retired. For a public website with millions of anonymous visitors, that is impossible, which is why mTLS is not used there.

Why use mTLS?

mTLS is worth the effort when the callers are known in advance and the cost of an unknown caller reaching your service is high. It moves authentication to the connection itself, so an unauthenticated request never reaches your application code.

  • Stolen API keys stop working as a shortcut. An attacker who copies a bearer token or API key still cannot connect without the client certificate and its private key.
  • Phishing-resistant machine identity. A certificate cannot be typed into a fake login page the way a password can, and it is bound to the device or service that holds the key.
  • Simpler service-to-service trust. Microservices can trust each other by certificate instead of sharing long-lived secrets across many codebases.
  • Device access without user logins. Internet-of-things devices, printers and sensors can authenticate with a certificate even though no person is present to log in.

Cloudflare notes that mTLS allows requests that do not authenticate through an identity provider, such as IoT devices, to demonstrate they can reach a given resource. That is a common pattern: the device proves itself with a certificate, and the server decides what that device may do.

Where is mTLS used?

mTLS shows up wherever a fixed set of callers talks to a sensitive service. The most common settings are internal APIs, financial services, healthcare systems and device fleets, where the caller list is known and changes slowly.

  • Service-to-service APIs. One microservice calls another inside the same company, and each side checks the other's certificate.
  • Partner and B2B APIs. A bank, payment processor or supplier only accepts connections from partners holding certificates it issued.
  • Zero Trust access. Internal tools and admin panels require a device certificate, so a stolen password alone cannot open them.
  • IoT and device fleets. Sensors, cameras and industrial equipment authenticate with certificates baked in at manufacture or provisioning.
  • OAuth with RFC 8705. An OAuth client authenticates to the authorization server with a certificate, and its access token can be bound to that certificate.

It is also the authentication layer underneath many service meshes. Tools in that space issue short-lived certificates to every workload automatically, which removes most of the manual certificate work that used to make mTLS painful. Keeping track of those certificates matters too, which is what certificate monitoring is for.

What does RFC 8705 add to mTLS?

RFC 8705 standardizes two separate OAuth 2.0 uses of mutual TLS, published in February 2020. The two mechanisms are independent: a deployment can use either one, or both, and they should not be confused with each other.

First, mTLS client authentication lets an OAuth client authenticate to the authorization server with an X.509 certificate instead of a shared client secret. The methods are called tls_client_auth for PKI-based certificates and self_signed_tls_client_auth for a pre-registered self-signed certificate.

Second, certificate-bound access tokens tie an issued token to the client certificate presented when the token was requested. A resource server must reject the token if it is presented over a connection using a different certificate, so a stolen token is useless to anyone who does not hold the private key.

That distinction matters in practice. A certificate-bound token still needs its own authorization checks: the token's scope, audience and expiry, and the resource server's policy, decide what the caller may do. Authentication proves who is calling; authorization decides what they may do.

One-way TLS vs mutual TLSOrdinary TLSServer: certificate shownClient: no certificateAnyone can connectPublic websitesMutual TLSServer: certificate shownClient: certificate shownOnly approved clients connectInternal APIs and devicesEncryption is the same in both. Only the client check differs.
Ordinary TLS checks the server only; mTLS checks both sides. Illustration by Cysoro.

What are the limits and common mistakes?

mTLS is strong authentication, but it is not a complete security design. The most common mistake is treating a valid handshake as proof that the caller is allowed to do whatever it asks for.

  • Authentication is not authorization. A valid client certificate proves the caller holds a key for an accepted certificate. It does not say which API actions, data or tenants that caller may access, so map the certificate to a narrow identity and enforce permissions separately.
  • Broad trust anchors are dangerous. Trusting a large public CA for client certificates means anyone with a certificate from that CA could connect. Limit trust to CAs whose issuance policy you control or have checked.
  • Revocation must actually work. If a device is lost or a service is compromised, its certificate must be revoked and the revocation checked. A certificate that cannot be revoked is a credential you cannot take back.
  • Expiry causes outages. Client certificates expire, and a fleet of devices can all expire at once if they were issued together. Automate renewal and alert well before expiry.
  • Termination can hide the identity. If TLS is terminated at a load balancer or edge proxy, the backend may never see the client certificate unless the identity is forwarded securely, for example in a verified header.

NIST SP 800-52 Rev. 2 gives the government baseline for TLS configuration, including which TLS versions and cipher suites to use. mTLS deployments should follow that baseline for the TLS layer itself, then add the client-certificate policy on top.

How do you set up mTLS?

Setting up mTLS is mostly a certificate-management project, not a coding project. The steps below describe the usual path for a small team protecting an internal API.

  1. Decide who the clients are. List every service, device or partner that needs access, and give each one its own certificate rather than sharing one across a fleet.
  2. Choose a certificate authority. Run a private CA, use a managed CA from your cloud or edge provider, or use a service mesh that issues certificates automatically.
  3. Issue client certificates. Create a certificate per client, with a subject or subject alternative name that identifies that client and nothing else.
  4. Configure the server. Tell the server which CAs to trust for client certificates, require a client certificate, and decide what happens on failure: reject the connection, do not fall back to unauthenticated access.
  5. Map certificates to identities. Turn the certificate's subject or SAN into an application identity, then apply your normal authorization rules to that identity.
  6. Automate renewal and revocation. Use short-lived certificates with automatic renewal where you can, and keep a revocation list or OCSP check that the server actually consults.
  7. Test failure modes. Try an expired certificate, a revoked certificate, a certificate from the wrong CA and no certificate at all, and confirm each one is rejected.

Managed options lower the effort a lot. Cloudflare, for example, lets you use its managed CA to create client certificates, or bring your own CA on Enterprise accounts, and it stores the validation result so access rules can check it. Each zone allows up to 100 active client certificates by default, according to Cloudflare's documentation.

Before you roll mTLS out widely, check the certificate your service already presents. Our free SSL checker shows the server certificate, its issuer and its expiry date in seconds.

mTLS vs API keys, OAuth and VPNs: which should you use?

mTLS is one of several ways to authenticate a caller, and the right choice depends on who is calling and how often the caller list changes.

MethodBest forMain weakness
mTLSKnown services, devices and partnersCertificate lifecycle work; not for public users
API keysSimple public or partner APIsKeys leak, get copied and are hard to rotate
OAuth 2.0 bearer tokensDelegated user access, third-party appsA stolen token works from anywhere unless bound, as in RFC 8705
VPNNetwork-level access for people and officesOnce inside, a caller can often reach too much
Passkeys and FIDO2Human logins to websites and appsNot designed for service-to-service calls

In practice these methods combine. A common pattern is mTLS at the connection layer, plus an OAuth token bound to the client certificate under RFC 8705, plus per-service authorization rules. Each layer catches what the others miss.

The bottom line

mTLS is ordinary TLS with the missing half filled in: the server checks the client, not just the other way round. That makes it a strong fit for internal APIs, partner connections and managed devices, where the callers are known and the stakes are high.

It is not a shortcut. You take on a certificate authority, renewals and revocation, and you still need authorization on top of authentication. Done properly, though, it removes whole classes of attack: leaked API keys, stolen tokens and anonymous connections simply cannot get through the handshake.

Start by checking your own certificates with the free SSL checker, and add client certificates where the caller list is small enough to manage.

Frequently asked questions

What is mutual TLS in simple terms?

Mutual TLS is a version of the encryption used by HTTPS in which both sides show ID. The server shows its certificate, as usual, and the client also shows a certificate. Each side checks the other's certificate, so only approved clients can connect.

What is the difference between TLS and mTLS?

Ordinary TLS authenticates only the server: your browser checks the website's certificate, but the website does not check a certificate from you. mTLS adds the reverse check, so the server also verifies a client certificate before allowing the connection.

Does mTLS replace passwords or API keys?

It can replace them for machine-to-machine calls, because the client certificate is the credential. For people, it is usually combined with another login step. A certificate proves which device or service is calling, not which person is using it or what they are allowed to do.

Is mTLS the same as a VPN?

No. A VPN encrypts all traffic between a device and a network and usually requires a VPN client. mTLS authenticates a single connection to a specific service, with no tunnel. The two can be used together, but they solve different problems.

Do I need mTLS for a public website?

No. Public visitors cannot be expected to hold a client certificate, so mTLS would lock them out. Use ordinary TLS with a publicly trusted certificate for public sites, and reserve mTLS for internal services, partner APIs and managed devices.

What happens when a client certificate expires?

The server rejects the connection, just as a browser rejects an expired server certificate. That makes certificate lifetime, renewal and revocation part of the design: short-lived certificates and automated renewal prevent sudden outages.

Can a stolen client certificate be used by an attacker?

A certificate alone is not enough, because the attacker also needs the matching private key to pass the proof-of-possession check. That is why private keys must be stored securely, ideally in a hardware module or the device's secure store, and why revocation must work quickly.

What is RFC 8705?

RFC 8705, published in February 2020, standardizes two OAuth 2.0 uses of mutual TLS: authenticating an OAuth client with a certificate instead of a shared secret, and binding an access token to a client certificate so a stolen token cannot be used by anyone else.

Sources

  1. Cloudflare — What is mutual TLS (mTLS)?
  2. Cloudflare Developers — Client certificates (mTLS)
  3. RFC 8705 — OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens
  4. IETF — RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
  5. NIST — SP 800-52 Rev. 2: Guidelines for the Selection, Configuration, and Use of TLS
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against Cloudflare's mTLS documentation, RFC 8705, RFC 8446 (TLS 1.3) and NIST SP 800-52 Rev. 2.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free