fjordtools / Errors / unsuitable certificate purpose

unsuitable certificate purpose

A certificate lists what it may be used for in its extended key usage and key usage fields. The client, or the server in mutual TLS, checked them against the role the certificate plays in this connection and found no match. Typical causes are a client-only certificate on a server, a server certificate used as a client certificate, and a key usage that excludes signing.

Fjordtools team · Seen in OpenSSL, curl, Node and Python · Published · 2 min read

How the tools word it

Node 26 tlsINVALID_PURPOSE: unsuitable certificate purpose
OpenSSL 3.6 s_clientverify error:num=26:unsuitable certificate purpose
OpenSSL 3.6 verify -purpose sslservererror 26 at 0 depth lookup: unsuitable certificate purpose
OpenSSL 3.6 s_server, client certificateverify error:num=26:unsuitable certificate purpose
curl 8.23curl: (60) SSL certificate OpenSSL verify result: unsuitable certificate purpose (26)
Python 3.14 sslssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unsuitable certificate purpose (_ssl.c:1082)
Python 3.14, keyCertSign on a server certificatessl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Key usage keyCertSign invalid for non-CA cert (_ssl.c:1082)

Common causes

  1. The certificate allows client authentication only

    The extended key usage field lists the purposes a certificate may serve. This one lists TLS client authentication, so a client that connects to a server using it refuses it. The Certificate Decoder shows the field as Extended key usage.

    Input

    -----BEGIN CERTIFICATE-----
    MIIB8DCCAZWgAwIBAgIBCTAKBggqhkjOPQQDAjBBMRgwFgYDVQQKDA9mam9yZHRv
    b2xzIHRlc3QxJTAjBgNVBAMMHGZqb3JkdG9vbHMgdGVzdCBpbnRlcm1lZGlhdGUw
    HhcNMjYwMTAxMDAwMDAwWhcNMzYwMTAxMDAwMDAwWjAwMRgwFgYDVQQKDA9mam9y
    ZHRvb2xzIHRlc3QxFDASBgNVBAMMC3NlcnZlci50ZXN0MFkwEwYHKoZIzj0CAQYI
    KoZIzj0DAQcDQgAE7ee19O78yqmyOB5x/h4K7/QA6YW32XJesJT8lv2Q+Y0GBR4e
    r2DpKzlXcNQ5G7VN9GkztuzSnXch/wKr38FQdqOBjjCBizAMBgNVHRMBAf8EAjAA
    MA4GA1UdDwEB/wQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDAjAWBgNVHREEDzAN
    ggtzZXJ2ZXIudGVzdDAdBgNVHQ4EFgQU/HjqRgLgUEQQDnr1y8nhCcb2baowHwYD
    VR0jBBgwFoAUMt7RDnv6EJHcKso7bd3VWZC9krowCgYIKoZIzj0EAwIDSQAwRgIh
    ALV0HYxj8bai57kFxDRmJc1jTDwfduvMU7XD1EXrkTBFAiEAq2BFgDZAJphDgkcj
    CK73WgKodZ9Olpc1iax1x/lBgVc=
    -----END CERTIFICATE-----

    Certificate Decoder says

    Extended key usage · TLS client authentication
  2. The key usage allows certificate signing only

    The key usage field says which operations the key may do. This certificate allows Certificate signing and nothing else, so it cannot sign a TLS handshake. All four clients refuse it. A server certificate for an elliptic-curve key needs Digital signature.

    Input

    -----BEGIN CERTIFICATE-----
    MIIB7TCCAZWgAwIBAgIBCjAKBggqhkjOPQQDAjBBMRgwFgYDVQQKDA9mam9yZHRv
    b2xzIHRlc3QxJTAjBgNVBAMMHGZqb3JkdG9vbHMgdGVzdCBpbnRlcm1lZGlhdGUw
    HhcNMjYwMTAxMDAwMDAwWhcNMzYwMTAxMDAwMDAwWjAwMRgwFgYDVQQKDA9mam9y
    ZHRvb2xzIHRlc3QxFDASBgNVBAMMC3NlcnZlci50ZXN0MFkwEwYHKoZIzj0CAQYI
    KoZIzj0DAQcDQgAE7ee19O78yqmyOB5x/h4K7/QA6YW32XJesJT8lv2Q+Y0GBR4e
    r2DpKzlXcNQ5G7VN9GkztuzSnXch/wKr38FQdqOBjjCBizAMBgNVHRMBAf8EAjAA
    MA4GA1UdDwEB/wQEAwICBDATBgNVHSUEDDAKBggrBgEFBQcDATAWBgNVHREEDzAN
    ggtzZXJ2ZXIudGVzdDAdBgNVHQ4EFgQU/HjqRgLgUEQQDnr1y8nhCcb2baowHwYD
    VR0jBBgwFoAUMt7RDnv6EJHcKso7bd3VWZC9krowCgYIKoZIzj0EAwIDRgAwQwIg
    KCHi8lhgTSOW368rZeGUVm1wGQbjaNRdjtT8jGOkgj0CH2xyHaj+YHE4V0zfoCz3
    Sx6/zNLnJly5S6hlc+Fgirg=
    -----END CERTIFICATE-----

    Certificate Decoder says

    Key usage · Certificate signing
  3. A server certificate is presented as a client certificate

    In mutual TLS the server asks the client for a certificate and checks it for the client role. A certificate that lists only TLS server authentication fails that check, and the error appears on the server, not in the client.

    Input

    -----BEGIN CERTIFICATE-----
    MIIB7jCCAZWgAwIBAgIBBDAKBggqhkjOPQQDAjBBMRgwFgYDVQQKDA9mam9yZHRv
    b2xzIHRlc3QxJTAjBgNVBAMMHGZqb3JkdG9vbHMgdGVzdCBpbnRlcm1lZGlhdGUw
    HhcNMjYwMTAxMDAwMDAwWhcNMzYwMTAxMDAwMDAwWjAwMRgwFgYDVQQKDA9mam9y
    ZHRvb2xzIHRlc3QxFDASBgNVBAMMC3NlcnZlci50ZXN0MFkwEwYHKoZIzj0CAQYI
    KoZIzj0DAQcDQgAE7ee19O78yqmyOB5x/h4K7/QA6YW32XJesJT8lv2Q+Y0GBR4e
    r2DpKzlXcNQ5G7VN9GkztuzSnXch/wKr38FQdqOBjjCBizAMBgNVHRMBAf8EAjAA
    MA4GA1UdDwEB/wQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDATAWBgNVHREEDzAN
    ggtzZXJ2ZXIudGVzdDAdBgNVHQ4EFgQU/HjqRgLgUEQQDnr1y8nhCcb2baowHwYD
    VR0jBBgwFoAUMt7RDnv6EJHcKso7bd3VWZC9krowCgYIKoZIzj0EAwIDRwAwRAIg
    VatubrykL+ZDu2wIXIFzNCA4G6SIsUQnf2mw4c30KXMCICf1jBo0UciVihHiS1KE
    k6cc1SY9pCBuOPjwOoiC3ob3
    -----END CERTIFICATE-----

    Certificate Decoder says

    Extended key usage · TLS server authentication

How to fix it

  1. Read what the certificate allows: the Certificate Decoder lists Key usage and Extended key usage. openssl x509 -noout -ext extendedKeyUsage,keyUsage -in cert.pem prints the same fields, and openssl x509 -noout -purpose -in cert.pem answers Yes or No for SSL server and SSL client.
  2. Have the certificate reissued for its role. A server certificate needs TLS server authentication in its extended key usage (or no extended key usage at all) and, for an elliptic-curve key, Digital signature in its key usage.
  3. For mutual TLS give the client a certificate that lists TLS client authentication, not the server's certificate.
  4. If your CA fills in the fields from a template or profile, change the template. The client cannot be told to ignore the fields.

Related errors

More error explainers are coming

See all errors.