What is mTLS? Mutual TLS and how it differs from TLS
Mutual TLS (mTLS) is a TLS connection in which both sides present certificates: the server proves who it is, and the client does too. It is one of the terms in the SSL and TLS glossary. The client's share is a certificate meant for client authentication and a signature made with its private key, and in TLS 1.3 a server's refusal of that certificate reaches the client after the client has finished its side of the handshake.
- Messages
- CertificateRequest from the server; Certificate and CertificateVerify from the client [1]
- The client proves
- that it holds the private key behind its certificate [1]
- Certificate purpose
- TLS client authentication, id-kp-clientAuth, when the certificate carries an extended key usage (RFC 5280) [3]
- No certificate sent
- the server may go on without client authentication or abort with a certificate_required alert [1]
One-way TLS versus mutual TLS
In ordinary TLS only the server is authenticated. TLS makes client authentication optional: a server may request a certificate from the client [1], and in one-way TLS it does not. The browser checks the server's certificate against the name it asked for; the server learns nothing about the client at that stage, and identifies a person later with a password, a cookie or a token.
Mutual TLS moves client identity into the connection itself. The server asks for a certificate, the client presents one and proves it holds the matching private key, and the server checks it against the authorities it accepts for clients. When verification is required, a failed check stops the client at the server, before any request reaches the application [5].
Client certificates come from a PKI the server trusts; what is PKI lists the parts of one.
What happens in the handshake
The difference is one extra exchange. In TLS 1.3 the server sends a CertificateRequest message after its EncryptedExtensions. The message must carry the signature_algorithms extension and can name the authorities the server accepts in a certificate_authorities extension [1]. The client answers with its own Certificate and a CertificateVerify message, a signature made with the client's private key over the handshake so far [1]. TLS 1.2 uses messages with the same names and puts the list of acceptable authorities inside CertificateRequest itself [2].
That signature is the point. The client never sends a reusable secret: it demonstrates possession of a key, and each CertificateRequest carries a context that must be unique within the connection, which prevents replay of a client's CertificateVerify [1]. Server authentication works the same way.
If the client's chain is unacceptable, for example not signed by an authority the server trusts, the server may continue with the client unauthenticated or abort [1]. TLS 1.3 also lets a server ask for a certificate after the handshake, but only from a client that offered the post_handshake_auth extension [1].
Where mTLS is used
Service-to-service traffic. Systems that call each other's APIs, where every client is a machine you issued a certificate to. In Kubernetes, each kubelet authenticates to the API server with a client certificate [7].
Zero-trust networks. NIST SP 800-207 describes zero trust as granting no implicit trust based on network location and authenticating before a session is established [8]. mTLS makes every connection prove which workload it comes from.
OAuth clients. RFC 8705 defines mutual-TLS client authentication to an authorization server and access tokens bound to the client's certificate [9].
Administrative interfaces and devices. Panels and devices that should accept connections only from known machines.
It fits poorly with the general public. Every visitor would need a certificate issued, installed and replaced, which is the work ordinary sign-in exists to avoid. Browsers can present client certificates, but Chrome selects one by itself only for sites listed in its AutoSelectCertificateForUrls policy [11], and RFC 9846 warns that client authentication could involve prompting the user [1].
What the server has to be configured with
Turning mutual TLS on is a short list of decisions, and each one is a place where a setup goes quietly wrong.
Which authorities to trust for clients. A separate list from the one browsers use for servers. Trusting a public authority here would accept any certificate anyone can obtain for any domain. Chrome's root program relies on its root store only for TLS server authentication, not client authentication, and is phasing out multi-purpose roots [4].
Whether a certificate is required or optional. Optional lets the application decide per route; required rejects anything without one. In nginx that is
ssl_verify_client optionaloron, in Apache httpdSSLVerifyClient optionalorrequire; Apache's optional_no_ca, its documentation says, cannot be relied upon for client authentication [5][6].Which part of the certificate identifies the client. A name in the subject or in the subject alternative names. That value is what the application authorises, so it has to be one you control when issuing. The Kubernetes API server takes the subject's common name as the user name and its organization fields as groups [7].
Where identity is handed to the application. When a proxy terminates TLS, it passes the verified identity on, for example in a request header filled from nginx's
$ssl_client_s_dn[5]. The application must accept that header only from the proxy, or anyone can set it.
How to test a mutual TLS endpoint
Both OpenSSL and curl can present a client certificate [10]:
$ openssl s_client -connect api.example.com:443 -cert client.crt -key client.key
$ curl --cert client.crt --key client.key https://api.example.com/Run the same command without the certificate. An endpoint that really requires mTLS refuses the second attempt, though not always at the handshake: nginx documents code 496 for a missing certificate and 495 for a failed verification, both handled after the request is fully parsed [5].
In TLS 1.3 the client sends its Certificate, CertificateVerify and Finished in its last flight and can send application data right behind them [1], so the server's alert is read as a reply. In the test further down this page, curl exited with code 56, failure in receiving network data, where the same refusal over TLS 1.2 gave 35, an SSL connect error [10]. openssl s_client printed Verification: OK for the server's certificate and then the alert. A script that treats only 35 as a handshake problem will misfile the TLS 1.3 case.
Why mutual TLS fails
The server does not require it. Client certificate verification is off or optional, so a client without one gets through and the problem shows up later as an authorisation error.
The certificate is not for client authentication. A certificate with an extended key usage may be used only for the purposes listed in it [3], so one issued for server authentication only can be refused.
The chain is incomplete. The client sends its certificate without the intermediate that links it to the authority the server trusts. In the test below this looked exactly like an untrusted authority, alert and log line included.
It expired. The server's alert says so: certificate expired.
What each failure looks like
Reproduced with curl 8.5.0 and openssl s_server from OpenSSL 3.0.13 on a test PKI of our own, with the server requiring a client certificate:
| What the client sent | curl exit code and alert | openssl s_server log |
|---|---|---|
| No certificate, TLS 1.3 | 56, tlsv13 alert certificate required | peer did not return a certificate |
| No certificate, TLS 1.2 | 35, sslv3 alert handshake failure | peer did not return a certificate |
| Certificate for server authentication only | 56, sslv3 alert unsupported certificate | num=26:unsuitable certificate purpose |
| Certificate from an authority the server does not trust | 56, tlsv1 alert unknown ca | num=20:unable to get local issuer certificate |
| Certificate without its intermediate | 56, tlsv1 alert unknown ca | num=20:unable to get local issuer certificate |
| Expired certificate | 56, sslv3 alert certificate expired | num=10:certificate has expired |
What it costs to run
The certainty comes with a certificate lifecycle for every client.
Issuing. From a private authority you operate, not a public one, so that only clients you approved can obtain a certificate your server accepts. Names on publicly trusted certificates are published in certificate transparency logs, one more reason client identities belong on certificates from your own authority.
Distribution. Each client needs its certificate and private key placed where its software can read them, and nowhere else. Encoding is not protection: anyone who can read an unencrypted key in the base64 text of a PEM-format file has it.
Renewal. Client certificates expire like server certificates. An expired client certificate looks, from the outside, like a sudden outage of one integration.
Revocation. When a client should stop being trusted, the server has to learn that, which is harder than it sounds; see certificate revocation. nginx, for example, checks client certificates against a CRL file or over OCSP only when configured to [5].
What mTLS does not give you
It proves which certificate the client holds, not what the client is allowed to do. Authorisation, rate limits and auditing still belong to the application. It also proves nothing about a stolen key: a client certificate copied with its private key works for whoever has it, until it expires, or until it is revoked on a server that checks revocation.
FAQ
What is mTLS?
mTLS, or mutual TLS, is a TLS connection where the client also presents a certificate and proves it holds the matching private key, so both sides are authenticated in the handshake.
How is mTLS different from TLS?
Ordinary TLS authenticates only the server. mTLS adds a client certificate to the same handshake, so a server that requires one can refuse an unknown client before the application sees a request.
What is a client authentication certificate?
A certificate whose extended key usage includes TLS client authentication, id-kp-clientAuth in RFC 5280. One limited to server authentication was refused as a client certificate in the test on this page.
Do browsers support client certificates?
Yes. A browser can present a client certificate when a site asks for one. Chrome picks one by itself only for sites listed in an administrator policy; elsewhere the user may be asked to choose.
Who issues client certificates for mTLS?
A private certificate authority that the organisation runs, so that only approved clients can get a certificate the server accepts. A public authority would let anyone with a domain obtain one.
Is mTLS the same as an API key?
No. An API key is a secret sent with each request and can be replayed if captured. mTLS proves possession of a private key during the handshake without sending it. The two combine: mTLS identifies the client, a token says what it may do, and RFC 8705 binds an OAuth token to the client's certificate, so a stolen token is useless without the key.
Related terms
The connection is covered under TLS, certificates and their lifecycle under certificates. A stricter check in the other direction is certificate or key pinning, in which an app accepts only specific server certificates or public keys. The header that keeps browsers on HTTPS is HTTP Strict Transport Security (HSTS). The rest of the vocabulary is in this glossary.
Sources
RFC 9846, TLS 1.3: §2, §4.3.4, §4.3.6, §4.4.2, §4.5.1.3, §4.5.2, §4.7.2.
RFC 5246, TLS 1.2: §7.4.4, §7.4.6, §7.4.8.
RFC 5280, X.509 profile: §4.2.1.12, extended key usage.
Chrome Root Program Policy, §1.3.2.
nginx, ngx_http_ssl_module.
Apache HTTP Server 2.4, mod_ssl.
Kubernetes documentation: PKI certificates and requirements; Authenticating.
NIST SP 800-207, Zero Trust Architecture, abstract.
RFC 8705, OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens.
curl manual (--cert, --key, --tls-max, exit codes); OpenSSL 3.0 manual, openssl-s_client and openssl-s_server.
Chrome Enterprise policy list: AutoSelectCertificateForUrls, PromptOnMultipleMatchingCertificates.