asio C++ library

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:

asio::ssl::stream<asio:ip::tcp::socket> sock(my_context, 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