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

Click here to view the latest version of this page.
PrevUpHomeNext

ssl::stream::native_handle

Get the underlying implementation in the native type.

native_handle_type native_handle();

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::asio::ssl::stream<asio:ip::tcp::socket> sock(io_service, ctx);

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

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

PrevUpHomeNext