certificate validation fails for trusted self-signed server certificate
Cosmin Banu <[email protected]> Wed, 6 Aug 2025 09:05:33 -0700 (PDT)
| Newsgroups | gmane.comp.encryption.openssl.user |
|---|---|
| Message-ID | <[email protected]> |
I have encountered a scenario with unexpected behavior when trying to connect an SSL client (custom client application) to a server that is configured with a self-signed server certificate (it's not marked as CA, it's a leaf certificate) - more specifically, the server I'm testing against is: https://self-signed.badssl.com/ I've configured the client by loading the server's certificate in an X509_STORE and then set that store on the SSL_CTX and I've set the verify mode to SSL_VERIFY_PEER. The error I'm getting is X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT (error code 18: "self-signed certificate"). The documentation for this error suggests even more that this should not happen, since the certificate was loaded into the store: https://github.com/openssl/openssl/blob/openssl-3.5/doc/man3/X509_STORE_CTX_get_error.pod?plain=1#L193 "The passed certificate is self-signed and the same certificate cannot be found in the list of trusted certificates." The introductory documentation doesn't seem to cover this scenario: https://docs.openssl.org/master/man7/ossl-guide-tls-introduction/#trusted-certificate-store The OpenSSL version I've tested with is 3.5.0. Is there something I'm missing? Some other configuration option? Or is this the expected behavior? -- You received this message because you are subscribed to the Google Groups "openssl-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/581147ae-8743-45ba-a2c4-b593b6289d8en%40openssl.org.