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

PrevUpHomeNext

ssl_stream

Provides stream-oriented functionality using OpenSSL.

Synopsis

Defined in header <boost/beast/ssl/ssl_stream.hpp>

template<
    class NextLayer>
class ssl_stream :
    public stream_base
Types

Name

Description

executor_type

The type of the executor associated with the object.

impl_struct

Structure for use with deprecated impl_type.

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.

native_handle

Get the underlying implementation in the native type.

next_layer

Get a reference to the next layer.

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.

ssl_stream

Construct a stream.

write_some

Write some data to the stream.

Description

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 this template with a tcp_stream, you would write:

net::io_context ioc;
net::ssl::context ctx{net::ssl::context::tlsv12};
beast::ssl_stream<beast::tcp_stream> sock{ioc, ctx};

In addition to providing an interface identical to net::ssl::stream, the wrapper has the following additional properties:

Convenience header <boost/beast/ssl.hpp>


PrevUpHomeNext