Two directions, one failed handshake#
A mutual TLS handshake has two verifications. Your client checks the server's certificate against its trust store, and the server checks your client certificate against the CA list it trusts. Either can fail, and the error text tells you which.
- Your client refused the server. Your client logs a verification error, such as
unable to get local issuer certificateorcertificate has expired, with no "alert" in the message. The server logs that it received an alert. The server-certificate guides apply: which certificate expired. - The server refused your certificate. Your client logs an alert it received, and the server's log holds the reason. The rest of this guide covers that case.
OpenSSL records an alert reason when the alert arrives from the peer, so a client-side error that names an alert means the server sent it. OpenSSL alert handling
What each alert says about your certificate#
RFC 8446 defines the alerts a server sends when it refuses a client certificate. OpenSSL clients print them as shown. RFC 8446 alert descriptions · OpenSSL SSL error strings
| Alert | OpenSSL client prints | Usual cause |
|---|---|---|
| certificate_required | tlsv13 alert certificate required | Client sent no certificate (TLS 1.3) |
| unknown_ca | tlsv1 alert unknown ca | Issuer not in the server's CA list |
| certificate_expired | sslv3 alert certificate expired | Client certificate outside its dates |
| bad_certificate | sslv3 alert bad certificate | Corrupt, bad signature, or rejected |
certificate_required is sent when a client certificate is desired but none was provided. A TLS 1.3 server that receives an empty certificate may continue without client authentication or abort with that alert, and one that finds the chain unacceptable may continue or abort. A client sends no certificate when it has none configured, when its key and certificate do not load, or when none of its certificates was issued by a CA the server named. RFC 8446 client Certificate
In TLS 1.3 the client sends its certificate in its final handshake flight, together with its first application data. A refusal can therefore surface on the first read after connect, so a library may report it as a read error. RFC 8446 handshake overview
Some servers finish the handshake and refuse at the HTTP layer instead. nginx records the result in $ssl_client_verify as SUCCESS, FAILED: with a reason, or NONE, and defines status 495 for a verification error and 496 when no certificate was presented. An Application Load Balancer in verify mode writes tls_verify_status to its connection log as Success or Failed: with a code such as ClientCertExpired, ClientCertNotYetValid or ClientCertUntrusted. nginx ssl module · ALB connection logs
See what the server asks for#
In TLS 1.2 the CertificateRequest message carries a list of acceptable CA distinguished names. In TLS 1.3 the server may send the same information in a certificate_authorities extension, and the client should send a chain that includes one of them. RFC 5246 CertificateRequest · RFC 8446 certificate_authorities
s_client prints that list after the handshake, under Acceptable client certificate CA names, or prints No client certificate CA names sent. Run it with the certificate and key your service uses, read from the service's configured paths. -cert and -key present them when the server asks. openssl s_client · s_client CA names output
openssl s_client -connect ledger.example.internal:443 -servername ledger.example.internal \
-cert /etc/checkout/tls/client.crt -key /etc/checkout/tls/client.key \
</dev/null 2>&1 | sed -n '/client certificate CA names/,/^---/p'
openssl s_client -connect ledger.example.internal:443 -servername ledger.example.internal \
-cert /etc/checkout/tls/client.crt -key /etc/checkout/tls/client.key \
</dev/null 2>&1 | grep -E 'alert|Verify return code'
The private key stays on the host; s_client reads it the way the service does. Then inspect the certificate itself: openssl x509
openssl x509 -in /etc/checkout/tls/client.crt -noout -subject -issuer -dates -ext extendedKeyUsage
Compare its issuer with the CA names list, its dates with the current time, and its extended key usage with what client authentication needs: a certificate whose extended key usage lacks client authentication can be refused as unsuitable for that purpose. OpenSSL X509_V_ERR_INVALID_PURPOSE
An empty CA list does not prove the server accepts anything. nginx sends the certificates from ssl_client_certificate and not those from ssl_trusted_certificate, and an Application Load Balancer advertises its CA subject names only when that option is turned on. nginx ssl_client_certificate · ALB mutual authentication
Read the result#
| Observation | Points to |
|---|---|
| certificate_required, client has a certificate configured | Client did not send it: path, key or CA filter |
| unknown_ca, issuer not in the CA names list | Wrong issuing CA, or the server's CA list changed |
| unknown_ca, issuer in the list | Intermediate missing from the client's chain |
| certificate_expired, client certificate dates current | Server clock or an expired intermediate |
| Verify error with no alert on the client | Your client refused the server's certificate |
A worked example with two outcomes#
This example is illustrative. checkout calls the internal ledger API with mutual TLS. At 09:00 UTC every call fails.
In the first outcome, checkout logs tlsv1 alert unknown ca. The s_client run lists one acceptable CA, CN=Example Services CA 2. checkout's certificate was issued by CN=Example Services CA 1. The ledger team replaced CA 1 with CA 2 in its trust file at 08:55 as part of a CA migration. checkout needs a certificate from CA 2, or the ledger keeps CA 1 in its list until clients move.
In the second outcome, checkout logs sslv3 alert certificate expired. The CA list names CA 1, and checkout's certificate was issued by CA 1, but openssl x509 -dates shows it expired at 08:59. The rotation job had failed for a week without alerting anyone. The fix is renewing the client certificate and repairing the job; the ledger is behaving as configured.
Limits#
s_client from the host uses the host's OpenSSL and the files you name. If the service loads its certificate from a secret store or a sidecar, test with the material it actually loaded, and check that the files on disk are the ones it reads. Behind a proxy that terminates TLS, the proxy is the server for this check; the backend may run its own, separate mutual TLS.
If the dates look right and the alerts still say expired or not yet valid, compare clocks on both sides: certificate is not yet valid and clock skew. A version or cipher mismatch fails before certificates are exchanged: protocol version and handshake failure. For other layers, see the hub for runtime dependency failures.
Questions#
Why does the error appear on my first request and not on connect?
In TLS 1.3 the client's certificate travels in its last handshake flight. The client may consider the connection open before the server has checked the certificate, so the refusal arrives on the next read.
Can the server tell me why it rejected my certificate?
Only through the alert, which is coarse. The server's own log, or a load balancer's connection log, names the specific reason.
Do I need to send the intermediate with my client certificate?
If the server trusts only the root, yes: send the intermediate after your certificate, the same way a server sends its chain. s_client takes it with -cert_chain.