Skip to main content

    SSL Handshake Failed: Find the Cause Before You Change Anything

    SSL handshake failed? The TLS alert number (40, 48, 70, 112) names the cause. Real curl, Java, Python and Go errors, reproduced, with the fix for each.

    MS
    My-SSL
    ·
    15 min read
    ·
    Published September 21, 2026
    ·
    Last updated October 24, 2026

    The short answer

    SSL handshake failed means the two sides gave up before agreeing how to encrypt the connection, so no request was ever sent. The failure is not generic: the side that gave up usually sends a numbered TLS alert, and that number names the fault — 40 handshake_failure, 48 unknown_ca, 70 protocol_version, 71 insufficient_security, 112 unrecognized_name. Read the alert or your client's error string before touching a setting. The fixes that skip that step — disabling verification, turning old protocols back on — remove the protection instead of the fault.

    The four handshake stages and their alerts, stackedThe same four stages as the wide figure, top to bottom: connect, with no TLS alert; negotiate, highlighted in gold, with alerts 40, 70, 71 and 112; certificate, with alerts 48, 46, 45, 44 and 42; prove keys, with alerts 51 and 49.The alert number names the stage1. Connect · never reached TLSnothing on port 443connection resetfirewall or timeoutno alert to read2. Negotiate · no common ground40 handshake_failure70 protocol_version71 insufficient_security112 unrecognized_name3. Certificate · chain rejected48 unknown_ca46 certificate_unknown45 certificate_expired44 certificate_revoked42 bad_certificate4. Prove keys · proof failed51 decrypt_error49 access_deniedmostly mutual TLSStages 1 and 2: no certificate involved
    Find the stage before touching a setting: a failure in the first two stages happened before any certificate was sent, so no certificate change can fix it.

    What a handshake failure actually is

    A TLS handshake is the negotiation that happens before any request is sent: the client proposes protocol versions, cipher suites and a hostname, the server picks from what it was offered, sends a certificate chain, and both sides prove they hold the keys they claim to. A handshake failure means that negotiation was abandoned. Nothing was encrypted badly, because nothing was encrypted at all.

    That distinction is the reason so much debugging time goes nowhere. “SSL handshake failed” reads like a certificate error, so the certificate is the first thing anyone looks at, even when the connection died before a certificate was ever sent. A protocol version mismatch, a cipher suite mismatch and an unreachable port all surface under the same sentence.

    What makes this tractable is that TLS is unusually talkative about its own failures. When one side gives up it is supposed to send an alert record carrying a numbered description, and those numbers are kept in the IANA TLS Alerts registry, which since July 2026 cites RFC 9846, the revised TLS 1.3 specification that replaces RFC 8446 and RFC 5246. Your client has probably printed one. It is usually buried in the middle of a long error string, which is why it gets skipped.

    Read the alert code before you change anything

    Every fatal TLS alert carries a number from the IANA TLS Alerts registry, and that number narrows the cause to a single handshake stage. Alerts 40, 70 and 71 mean the two sides found no common version or cipher. Alerts 42 through 48 mean a certificate was received and rejected. Alerts 49 and 51 mean key or access checks failed, usually under mutual TLS.

    One rule governs how to read any of them, and it is easy to get backwards: an alert that arrives at you was sent by the other side, about what it received from you. If your server logs an incoming unknown_ca, the client distrusts the chain your server sent. Changing your server's trust store will not help. The same alert logged by your client means the opposite, and the fix lives somewhere else entirely.

    AlertWhat the sender meansWhere to look
    40 handshake_failureCould not negotiate an acceptable set of security parametersVersion or cipher overlap; a server with no certificate usable for what was asked
    42 bad_certificateA certificate was corrupt, or its signature did not verifyA truncated or wrongly concatenated PEM file; in mutual TLS, the client certificate; in our test, a Go client sent it for a missing intermediate
    44 certificate_revokedThe certificate was revoked by its issuerReissue is the only fix; check why revocation happened before reordering
    45 certificate_expiredA certificate in the chain is outside its validity windowCheck the intermediate too, not only the leaf; check the verifier's clock
    46 certificate_unknownSome other problem made the certificate unacceptableThe catch-all certificate alert; in our test, a Java client sent it for a missing intermediate
    48 unknown_caA chain was received but could not be matched to a trusted issuerA missing intermediate, a private CA, or a stale trust store
    49 access_deniedThe certificate was valid but the peer declined to proceedClient-certificate access rules; a valid identity that is not authorised
    51 decrypt_errorA signature or key-exchange verification failedIn mutual TLS, a client key that does not match the client certificate
    70 protocol_versionThe offered protocol version is recognised but not supportedA client stuck on TLS 1.0/1.1, or a server that has not enabled TLS 1.2+
    71 insufficient_securityThe server requires stronger parameters than the client offeredA hardened server policy meeting a legacy client; more specific than alert 40
    112 unrecognized_nameThe server did not recognise the name sent in SNI (RFC 6066)A missing or wrong SNI value; a virtual host that is not configured

    Two alerts on that list are worth treating as good news. Alert 70 and alert 71 say the same thing as alert 40 but with more precision, so a peer that sends one of them has saved you a round of guessing. Alert 40 is the least specific of the three, which is why the next step is to reproduce the failure somewhere you can see both sides.

    Alerts 44 and 45 are the two where no setting will help: a revoked or expired certificate has to be replaced. Check the intermediate as well as the leaf, and the verifying machine's clock, before you order anything. If it does need replacing, compare DV, OV and EV SSL certificates before you order, so the replacement matches the validation level the old one had.

    Diagnosing it in four commands

    Four openssl s_client runs cover the stages in the figure above. The first establishes whether TLS works at all from your network. The second pins a protocol version to test for a version mismatch. The third shows exactly which certificates the server sends. The fourth turns a quiet verification warning into a hard error you cannot overlook.

    bash
    # 1. Does it negotiate at all, and with what?
    openssl s_client -connect example.com:443 -servername example.com </dev/null
    
    # 2. Pin a version to test for a version mismatch
    openssl s_client -connect example.com:443 -servername example.com -tls1_2 </dev/null
    openssl s_client -connect example.com:443 -servername example.com -tls1_3 </dev/null
    
    # 3. What does the server actually send? (chain order and completeness)
    openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
    
    # 4. Make verification failures fatal instead of advisory
    openssl s_client -connect example.com:443 -servername example.com \
      -verify_return_error </dev/null

    Three lines in that output carry most of the answer. Protocol and Cipher tell you what was agreed, if anything. Verify return code tells you how the chain fared: 0 (ok) is a pass, 21 (unable to verify the first certificate) is the signature of a missing intermediate, and 10 (certificate has expired) needs no translation. The list of certificates under Certificate chain shows what the server sent, in order.

    The most useful thing this gives you is a bisection. If openssl s_client completes a handshake from the same machine where your application fails, the server is negotiating correctly and the fault is in your application — its trust store, its pinned protocol versions, its cipher list, or a proxy it is configured to use. If s_client fails too, the fault is on the server side or in the network between you. That one comparison tells you which half of the problem to work on.

    When you want the same picture from outside your own network — which matters, because a corporate proxy that intercepts TLS will change the answer — you can check what chain your server serves to the public internet and compare it against what you saw locally.

    What each failure looks like when you reproduce it

    We broke a test server on purpose, one fault at a time, and recorded what the client printed and what the server logged. The setup was a throwaway root, intermediate and leaf for test.example, served by openssl s_server (OpenSSL 3.0.13) on 24 October 2026, with curl 8.5.0, Python 3.13, OpenJDK 21, Go 1.24 and Chromium 153 as clients. Every string below is copied from that output.

    Fault we introducedWhat the client printedWhat the server logged
    Server TLS 1.3 only, client capped at TLS 1.2tlsv1 alert protocol version ... SSL alert number 70unsupported protocol
    No cipher suite in common (TLS 1.2)sslv3 alert handshake failure ... SSL alert number 40no shared cipher
    Client sends a name the server does not hosttlsv1 unrecognized name ... SSL alert number 112final_server_name:callback failed
    Client does not trust the issuing CAVerify return code: 20 (unable to get local issuer certificate)tlsv1 alert unknown ca ... SSL alert number 48
    Server sends the leaf without its intermediateVerify return code: 21 (unable to verify the first certificate)Depends on the client: see below

    The last row is the one worth remembering. A missing intermediate is one fault on the server, yet the alert the server logs depends on which TLS library the client uses. curl and Python, both built on OpenSSL, sent alert 48 unknown_ca. Java 21 sent alert 46 certificate_unknown. Go 1.24 sent alert 42 bad_certificate. So when a server log shows a mix of 42, 46 and 48 from different clients, it can be a single problem: the chain the server sends.

    One missing intermediate, three alert numbers, stackedA server sending its leaf without the intermediate. curl and Python cause alert 48, Java 21 alert 46, Go 1.24 alert 42 in the server log. One fix: send the full chain.One fault, three alert numbersServer sends the leaf onlyno intermediatecurl 8.5 / Python 3.13server logs alert 48 unknown_caJava 21server logs alert 46 certificate_unknownGo 1.24server logs alert 42 bad_certificateOne fix: send the full chain
    A mix of alerts 42, 46 and 48 in one server's log can come from one cause, not three: check the chain it sends before anything else.

    One more thing the test showed: openssl s_client finishes the handshake even when verification fails. It prints Verify return code: 21 and carries on, which is why the fourth command above adds -verify_return_error. Without it, a broken chain can look like a successful connection.

    What your client's error string is telling you

    Every TLS stack words the same failures differently, so one server misconfiguration can look like several unrelated bugs. The strings below map back to two causes between them: a peer that sent a fatal alert, or a chain that could not be verified locally. Recognising which one you have decides whether you look at the server or at the client.

    ClientWhat you seeWhat it means
    curl(35) ... alert handshake failure or (35) ... tlsv1 alert protocol versionThe peer sent alert 40 (no shared cipher or no usable certificate) or alert 70 (no shared version)
    curl(60) unable to get local issuer certificateVerification failed locally — usually a missing intermediate on the server
    Java(certificate_unknown) PKIX path building failed ... unable to find valid certification path to requested targetSame missing intermediate, or an issuer absent from the trust store Java uses; the server logs alert 46
    JavaReceived fatal alert: handshake_failureThe peer sent alert 40: compare the protocols and cipher suites this JVM enables with the server's
    Python[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificateLocal verification failed; the text after the colon names the reason (here, a missing intermediate)
    Gotls: failed to verify certificate: x509: certificate signed by unknown authorityThe chain could not be completed from what the server sent and the roots Go trusts; the server logs alert 42
    ChromeERR_SSL_VERSION_OR_CIPHER_MISMATCHNo shared version or cipher; in our test the server logged no shared cipher
    Windows (Schannel)The TLS protocol defined fatal alert code is 40.The same alert numbers as above; the event text says which side sent it (next section)
    CloudflareError 525 / Error 526The edge-to-origin handshake failed (525) or the origin certificate was rejected (526)

    Windows: what Schannel events 36887 and 36888 tell you

    On Windows, a failed handshake shows up in the Windows event log under the Schannel source, and the alert number is in the text. Event 36887 reads “A fatal alert was received from the remote endpoint. The TLS protocol defined fatal alert code is 48.” Event 36888 reads “A fatal alert was generated and sent to the remote endpoint” and ends with the code and a Windows SChannel error state.

    The two wordings settle the direction question from the alert table. “Received from the remote endpoint” means the other machine rejected something this machine sent, so a 48 here means the peer did not trust this machine's certificate chain. “Generated and sent” means this machine did the rejecting, and the cause is in what it received. Read the number against the alert table above, then look on the side the event text points to.

    The intermediate that browsers can forgive

    If a site loads in a browser but fails from curl, Java, Python or a mobile app, the server is usually sending only its leaf certificate and omitting the intermediate that links it to a trusted root. Browsers can paper over this: Firefox, for one, pre-downloads every trusted Web PKI intermediate certificate through Mozilla's Remote Settings, so it can build the chain from its own cache.

    Command-line tools and application runtimes are stricter. In our test, curl, Java, Python and Go all rejected a server that sent only its leaf, each with its own error string from the table above. The result is a misconfigured server that looks healthy to anyone who checks it in a browser.

    A server that omits its intermediate, stackedThe server sends the leaf but not the intermediate. Firefox can build the chain from preloaded intermediates; curl, Python, Java and Go each fail with their own error.Intermediate not sentleaf sent · intermediate missingFirefoxcan build the chain itselfcurl 8.5fails: (60) unable to get local issuerPython 3.13fails: CERTIFICATE_VERIFY_FAILEDJava 21fails: PKIX path building failedGo 1.24fails: x509: signed by unknown authority
    Test every install or renewal with a client that is not a browser: that is where an incomplete chain shows up first.

    The fix is to install the full chain file your CA provides: the leaf first, then each intermediate in order. The root does not need to be sent and adds a wasted round of bytes to every connection, since a client that does not already hold the root has no reason to trust a copy the server hands it. How certificate chains are built and validated covers the ordering rules and the common ways bundles get assembled wrong.

    One habit prevents the whole class of problem: after installing or renewing any certificate, verify it with something that is not a browser. A single curl -v https://yourhost/ catches an incomplete chain right after deployment, before a client that is not a browser finds it for you.

    Version and cipher suite mismatches

    A version or cipher mismatch is an empty intersection between two lists, and neither side is malfunctioning. The client offers the versions and cipher suites it is willing to use, the server compares them against its own list, and if nothing appears in both it sends alert 40, 70 or 71 and closes the connection. No certificate is involved, which is why reissuing one changes nothing.

    A version and cipher mismatch is an empty intersection, not a faultOn the left, a panel lists what a modern client offers: TLS 1.3, TLS 1.2, and cipher suites based on ECDHE with AES-GCM. On the right, a panel lists what an old server still accepts: TLS 1.0, TLS 1.1, and cipher suites based on RSA key exchange with CBC and 3DES. Between them a dark box states that the intersection is empty and that this is reported as alert 40, alert 70 or alert 71. A band across the bottom contrasts two responses: re-enabling TLS 1.0 on the client creates the overlap by removing the protection, while upgrading the server's configuration creates the overlap by fixing the fault.Nothing is broken. There is simply no overlap.CLIENT OFFERSTLS 1.3TLS 1.2ECDHE key exchangeAES-GCM, ChaCha20example: current clientSERVER ACCEPTSTLS 1.0TLS 1.1RSA key exchangeCBC, 3DESexample: legacy serverINTERSECTION: EMPTYreported as alert 40,70 or 71Two ways to create an overlap:Re-enable TLS 1.0 on the client — the connection succeeds and the protection is gone.Update the server's TLS configuration — the connection succeeds and the fault is gone.
    Both columns are internally consistent, which is why neither side logs anything that looks like an error beyond the alert itself.

    The two directions this arrives from look identical in the logs and call for opposite fixes. An old client against a modern server — an embedded device, a legacy Java service, a payment terminal — fails because the server dropped TLS 1.0 and 1.1 and the RSA key-exchange ciphers. A modern client against an old server fails for the mirror-image reason. Running the second command in the previous section against each protocol version tells you which situation you are in within a minute.

    Where the old component is the server, the work is a configuration update. Where the old component is a client you do not control, the honest answer is sometimes that it cannot connect to a properly configured endpoint, and the options are to update it or to give it a separate endpoint with a deliberately weaker policy, kept away from anything sensitive. Cipher suites explained sets out what a current suite list should contain and what has been removed from it.

    When the server doesn't recognise the name

    Server Name Indication is how a client tells a server which hostname it wants, before any certificate is chosen. On a host serving many sites from one address, a missing or wrong SNI value means the server picks its default virtual host, which usually holds a certificate for some other name. RFC 6066 says a server that does not recognise the name should either abort with a fatal unrecognized_name(112) alert or continue the handshake.

    That choice is why the symptom is inconsistent. A server that aborts produces a clean alert 112 and an obvious diagnosis. A server that continues hands over the wrong certificate, and the client rejects it a moment later for a name mismatch — the same root cause, reported as a certificate problem. RFC 6066 also notes that sending unrecognized_name at warning level is not recommended, because client behaviour in response to warnings is unpredictable.

    The clients that hit this are the ones that do not send SNI at all: very old runtimes, some monitoring probes, and anything connecting to a bare IP address rather than a hostname. You can reproduce it exactly by dropping -servername from the openssl commands above and watching a different certificate come back. A server set to abort instead (in our test, openssl s_server -servername_fatal) gives the clean version: SSL alert number 112 on the client when it asked for a name the server does not host. What SNI does and why shared hosting depends on it covers the mechanism in full.

    Cloudflare 525 and the origin leg

    Behind a CDN there are two separate TLS connections: the visitor to the edge, and the edge to your origin server. Cloudflare error 525 refers only to the second. It means the handshake between the edge and your origin failed, and it appears in Full or Full (Strict) mode, where the edge speaks TLS to the origin. Error 526 is the neighbouring case: in Full (Strict) mode, Cloudflare reached the origin but could not verify its certificate.

    The two TLS connections behind a CDN, and which one error 525 refers toThree boxes run left to right: the visitor's browser, the CDN edge, and the origin server. The first leg, browser to CDN edge, is marked as normally healthy because the edge presents its own certificate. The second leg, CDN edge to origin, is the one that fails. Two labelled boxes distinguish the failures on that second leg: error 525 means the handshake with the origin failed, and error 526 means the edge could not verify the certificate the origin presented. A band across the bottom says to test the second leg directly against the origin address, because the browser never sees that connection.Behind a CDN there are two handshakes. Only one of them is failing.BROWSERsees only leg 1CDN EDGEown certificateORIGINwhere it breaksleg 1leg 2525handshake never completed526certificate was rejectedBoth codes are generated by the edge, about a connection your browser never makes.Test leg 2 yourself, against the origin address, with the real hostname in SNI.
    Turning the proxy off makes a 525 disappear without fixing anything — the origin is still unable to complete a handshake, and now it is serving traffic directly.

    The causes on that leg are the ordinary ones, just somewhere you cannot see from a browser. Cloudflare's own list is four items: no valid certificate on the origin, port 443 (or the custom secure port) closed, an origin that does not support SNI, and no cipher suite in common. Each is diagnosable with the same openssl commands, pointed at the origin address with the real hostname supplied through -servername.

    Switching the proxy to a mode that does not verify the origin will clear the error and leave the origin exactly as broken as it was, now serving traffic over a connection nobody is checking. What each Cloudflare SSL mode actually does sets out what changes between Flexible, Full and Full (Strict), and why Full (Strict) is the mode that checks the origin's certificate.

    The causes that are new in 2026

    Three changes in 2026 cause handshake failures in setups that worked for years without modification. None of them shows up as an unusual alert code: they look like ordinary certificate rejections or expiries, which is why they are worth ruling out early.

    The first is the removal of the clientAuth extended key usage from publicly trusted TLS certificates. Organisations that used a public TLS certificate as the client certificate in a mutual-TLS setup find that the server rejects the renewed one. Certum stopped issuing public SSL/TLS certificates with clientAuth on 15 May 2026, and from 15 June 2026 the Chrome Root Program requires single-purpose server certificates. Certificates issued earlier keep working until they expire, so the failure arrives at renewal and looks like a broken renewal instead of a policy change. Why public TLS certificates no longer authenticate clients covers how to confirm it and where mutual TLS should move instead.

    The second is shorter certificate lifetimes. Certificates issued on or after 15 March 2026 cap at 200 days under the CA/Browser Forum Baseline Requirements, dropping to 100 days from 15 March 2027 and 47 days from 15 March 2029. At 200 days a certificate has to be replaced close to twice a year, so any renewal process that depends on somebody remembering will fail sooner and more often.

    The third is distrust of a compromised CA. In October 2026, after eMudhra intermediate keys were compromised, Chrome blocked the affected intermediates on 17 October, eMudhra revoked six TLS intermediates on 18 October, and Apple and Microsoft followed on 19 and 20 October. A server whose chain runs through one of them now fails certificate checks in clients that apply those blocks, and the certificate has to be replaced. What the eMudhra compromise means and what to do lists the affected intermediates.

    The fixes that make it worse

    Every handshake failure has a fix that makes the error message disappear in under a minute, and each one works by removing the check rather than the fault. They are worth naming because each one leaves the connection weaker than the person applying it believes.

    The quick fixWhat it actually doesInstead
    curl -k, verify=FalseAccepts any certificate from anyone, including an interceptorFix the chain on the server, or point the client at the right CA bundle
    A trust-all TrustManagerDisables verification for every connection that uses itImport the actual issuing CA into a keystore the application points at
    Re-enabling TLS 1.0 / 1.1Restores versions the IETF formally deprecated in RFC 8996 (March 2021)Update the component that cannot do TLS 1.2, or isolate it behind its own endpoint
    Importing the leaf into the trust storeWorks until the next renewal, then fails again with no obvious link to the changeServe the missing intermediate from the server, where the problem is
    Switching the CDN off verificationHides a broken origin and leaves the edge-to-origin hop unauthenticatedFix the origin handshake, then return the proxy to Full (Strict)

    There is one legitimate use for the first row, and it is diagnostic. If curl -k succeeds where curl fails, you have proved the failure is verification rather than negotiation, which is genuinely useful information. The mistake is leaving the flag in the script that goes to production.

    Updated October 24, 2026: added a table of each failure reproduced against a test server (client output and server log), the finding that one missing intermediate shows up as alert 42, 46 or 48 depending on the client library, Windows Schannel events 36887 and 36888, and the eMudhra distrust; alert references moved to the IANA registry and RFC 9846; removed claims we could not source.

    Frequently Asked Questions

    Quick answers to related questions.

    What does “SSL handshake failed” mean?

    It means the client and the server could not agree on the terms of an encrypted connection, so the connection was dropped before any request was sent. No data was exchanged and nothing was decrypted incorrectly — the two sides never got as far as having a session. The failure happens at one of four stages: reaching TLS at all, agreeing a protocol version and cipher suite, verifying the certificate chain, or proving possession of the private key.

    Why does my site work in a browser but fail in curl or Java?

    Usually a missing intermediate certificate. A browser can complete the chain on its own: Firefox, for example, pre-downloads every trusted Web PKI intermediate. curl, Java, Python and Go verify only what the server sent. In our tests a leaf-only server failed in all four, with curl error 60, Python CERTIFICATE_VERIFY_FAILED, Java PKIX path building failed and Go x509: certificate signed by unknown authority. The server is the thing to fix: send the intermediate with the leaf.

    What is TLS alert 40, handshake_failure?

    Alert 40 is the sender saying it could not negotiate an acceptable set of security parameters. In practice it means there was no overlap: no protocol version both sides support, no cipher suite both sides accept, or no certificate on the server usable for what the client asked for. It is also the least specific handshake alert. Alert 70 (protocol_version) and alert 71 (insufficient_security) name the same kind of problem more precisely, so a peer that sends one of those has already told you which list to compare.

    How do I see which TLS versions and ciphers a server accepts?

    Run openssl s_client against the host once per protocol version: openssl s_client -connect example.com:443 -servername example.com -tls1_2, then again with -tls1_3. A version the server accepts returns a certificate and a negotiated cipher; a version it refuses returns an alert instead. Comparing which versions succeed against what your client is configured to offer isolates a version mismatch in under a minute.

    What causes Cloudflare error 525?

    Error 525 means the SSL handshake between Cloudflare and your origin server failed, and it appears in Full or Full (Strict) SSL/TLS modes, where Cloudflare speaks TLS to the origin. Cloudflare lists four causes to rule out at the origin: no valid SSL certificate installed, port 443 (or the custom secure port) closed, no SNI support, and no cipher suite in common with Cloudflare. Error 526 is different: Cloudflare reached the origin in Full (strict) mode but could not verify its certificate.

    Is “SSL handshake failed” always a certificate problem?

    No. Many handshake failures never reach the certificate stage: protocol version mismatches, cipher suite mismatches, SNI problems and nothing listening on the port all end the handshake before a certificate is checked. The alert code tells you which stage failed, and a version or cipher failure reported as alert 40, 70 or 71 will not be fixed by reissuing a certificate. Alerts 42, 44, 45, 46 and 48 are the ones that point at a certificate.

    Still Have Questions?

    Contact our support team with questions about certificates, installation, or technical issues.

    Worth checking while this is fresh

    An incomplete chain and an approaching expiry both look fine in a browser right up to the moment something that is not a browser tries to connect. Both are quick to rule out. Check what your server actually serves — the chain it sends, the names it covers and the date it expires — for the host that just failed, and for the one you renewed last month and have not tested since.