Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
ssl_stream::native_handle

Get the underlying implementation in the native type.

Synopsis
native_handle_type
native_handle();
Description

This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.

Example

The ssl_stream::native_handle() function returns a pointer of type SSL* that is suitable for passing to functions such as SSL_get_verify_result and SSL_get_peer_certificate:

boost::beast::ssl_stream<net::ip::tcp::socket> ss{ioc, ctx};

// ... establish connection and perform handshake ...

if (X509* cert = SSL_get_peer_certificate(ss.native_handle()))
{
  if (SSL_get_verify_result(ss.native_handle()) == X509_V_OK)
  {
    // ...
  }
}

PrevUpHomeNext