{"record":{"id":"0139969f6d5e8ec7","repo":"golang/go","slug":"client-doesn-t-support-certificate-curve","errorCode":null,"errorMessage":"client doesn't support certificate curve","messagePattern":"client doesn't support certificate curve","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/crypto/tls/common.go","lineNumber":1499,"sourceCode":"\t\t\tswitch pub.Curve {\n\t\t\tcase elliptic.P256():\n\t\t\t\tcurve = CurveP256\n\t\t\tcase elliptic.P384():\n\t\t\t\tcurve = CurveP384\n\t\t\tcase elliptic.P521():\n\t\t\t\tcurve = CurveP521\n\t\t\tdefault:\n\t\t\t\treturn supportsRSAFallback(unsupportedCertificateError(c))\n\t\t\t}\n\t\t\tvar curveOk bool\n\t\t\tfor _, c := range chi.SupportedCurves {\n\t\t\t\tif c == curve && config.supportsCurve(vers, c) {\n\t\t\t\t\tcurveOk = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !curveOk {\n\t\t\t\treturn errors.New(\"client doesn't support certificate curve\")\n\t\t\t}\n\t\t\tecdsaCipherSuite = true\n\t\tcase ed25519.PublicKey:\n\t\t\tif vers < VersionTLS12 || len(chi.SignatureSchemes) == 0 {\n\t\t\t\treturn errors.New(\"connection doesn't support Ed25519\")\n\t\t\t}\n\t\t\tecdsaCipherSuite = true\n\t\tcase *mldsa.PublicKey:\n\t\t\t// ML-DSA requires TLS 1.3, which we already excluded above.\n\t\t\treturn errors.New(\"connection doesn't support ML-DSA\")\n\t\tcase *rsa.PublicKey:\n\t\tdefault:\n\t\t\treturn supportsRSAFallback(unsupportedCertificateError(c))\n\t\t}\n\t} else {\n\t\treturn supportsRSAFallback(unsupportedCertificateError(c))\n\t}\n","sourceCodeStart":1481,"sourceCodeEnd":1517,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/crypto/tls/common.go#L1481-L1517","documentation":"Thrown by SupportsCertificate when the certificate is an ECDSA key on a curve (P-256/P-384/P-521) that does not appear in the client's SupportedCurves (or the server does not support that curve for the negotiated version). Without a shared curve the ECDSA cipher suite cannot be selected, so the cert is unusable for this client.","triggerScenarios":"Server has an ECDSA cert (e.g., P-384) but the client's SupportedCurves omits that curve, or config.supportsCurve returns false for it. Reached in the ECDSA branch of SupportsCertificate after curveOk stays false.","commonSituations":"Cert generated on P-384/P-521 but client only offers P-256/X25519; client stripped uncommon curves for policy; multi-cert setup picking the wrong cert for the client; curve disabled by CurvePreferences.","solutions":["Generate or select an ECDSA cert on a curve the client advertises (P-256 is most widely supported).","Set Config.CurvePreferences to include the cert's curve and ensure the client offers it.","Provide multiple ECDSA certs on different curves and pick via GetCertificate using chi.SupportedCurves.","Fall back to an RSA or Ed25519 cert when no ECDSA curve overlaps."],"exampleFix":"// before: cert on P-521, client offers only P-256\ncfg.Certificates = []tls.Certificate{p521Cert}\n\n// after: add a P-256 cert and select by client curves\ncfg.Certificates = []tls.Certificate{p256Cert, p521Cert}\ncfg.GetCertificate = func(chi *tls.ClientHelloInfo) (*tls.Certificate, error) {\n    for _, c := range chi.SupportedCurves {\n        if c == tls.CurveP521 { return &p521Cert, nil }\n    }\n    return &p256Cert, nil\n}","handlingStrategy":"fallback","validationCode":"// Pick an ECDSA cert whose curve the client advertises.\nfunc pickECDSACert(chi *tls.ClientHelloInfo, byCurve map[tls.CurveID]*tls.Certificate) (*tls.Certificate, error) {\n    for _, c := range chi.SupportedCurves {\n        if cert, ok := byCurve[c]; ok { return cert, nil }\n    }\n    return nil, errors.New(\"client shares no ECDSA curve\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Issue ECDSA certs on P-256 for maximum client compatibility.","Provide multiple ECDSA certs on different curves and select via GetCertificate.","Keep an RSA or Ed25519 cert as fallback when no ECDSA curve overlaps.","Inspect chi.SupportedCurves during testing to choose the right cert inventory."],"tags":["crypto","tls","ecdsa","curve-negotiation","go"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}