| Home | Libraries | People | FAQ | More

### ssl::stream

Provides stream-oriented functionality using SSL.

    template<
        typename Stream>
    class stream :
      public ssl::stream_base,
      noncopyable

##### Types

Name | Description
--- | ---
impl_struct | Structure for use with deprecated impl_type.
executor_type | The type of the executor associated with the object.
handshake_type | Different handshake types.
lowest_layer_type | The type of the lowest layer.
native_handle_type | The native handle type of the SSL stream.
next_layer_type | The type of the next layer.

##### Member Functions

Name | Description
--- | ---
async_handshake | Start an asynchronous SSL handshake.
async_read_some | Start an asynchronous read.
async_shutdown | Asynchronously shut down SSL on the stream.
async_write_some | Start an asynchronous write.
get_executor | Get the executor associated with the object.
handshake | Perform SSL handshaking.
lowest_layer | Get a reference to the lowest layer.
native_handle | Get the underlying implementation in the native type.
next_layer | Get a reference to the next layer.
operator= | Move-assign a stream from another.
read_some | Read some data from the stream.
set_verify_callback | Set the callback used to verify peer certificates.
set_verify_depth | Set the peer verification depth.
set_verify_mode | Set the peer verification mode.
shutdown | Shut down SSL on the stream.
stream [constructor] | Construct a stream. — Construct a stream from an existing native implementation. — Move-construct a stream from another.
write_some | Write some data to the stream.
~stream [destructor] | Destructor.

The stream class template provides asynchronous and blocking stream-oriented functionality using SSL.

##### Thread Safety

Distinct objects: Safe.

Shared objects: Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.

##### Example

To use the SSL stream template with an `ip::tcp::socket`, you would write:

    boost::asio::io_context my_context;
    boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
    boost::asio::ssl::stream<boost::asio::ip::tcp::socket> sock(my_context, ctx);

##### Requirements

Header: `boost/asio/ssl/stream.hpp`

Convenience header: `boost/asio/ssl.hpp`