Re: The correct way to verify a server certificate?

Viktor Dukhovni <[email protected]>
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
On Wed, May 14, 2025 at 07:33:28PM +0000, 'Ladd, Watson' via openssl-users wrote:

> Tls.Dial("tcp", "www.example.com:443", nil)
> 
> In OpenSSL I know that SSL_CTX_set_verify(VERIFY_PEER) is required,
> but it doesn't seem from my reading the documentation that there is an
> easy way to verify hostnames: it seems that the expectation is doing a
> bunch of X509_ functions on the result of get_peer_certificate or make
> a callback function, but I'm not sure that I am not just failing to
> find the name of what I need.
> 
> This has caused a few issues already. I'm sure we have all run into this. Does anyone have an ideomatic, easy to explain way to do this that I'm just not figuring out for some reason?

As of OpenSSL 1.1.0, prior, OpenSSL has: SSL_set1_host(3).

    SYNOPSIS
         #include <openssl/ssl.h>

         int SSL_set1_host(SSL *s, const char *host);
         int SSL_add1_host(SSL *s, const char *host);
         void SSL_set_hostflags(SSL *s, unsigned int flags);
         const char *SSL_get0_peername(SSL *s);

    ...
    HISTORY
        These functions were added in OpenSSL 1.1.0.

See the DESCRIPTION for further details.

-- 
    Viktor.

-- 
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/aCVBBGNKY_tyF_KJ%40chardros.imrryr.org.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.