Boost C++ Libraries Home Libraries People FAQ More

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 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