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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

ssl_stream

Provides stream-oriented functionality using OpenSSL.

Synopsis

Defined in header <boost/beast/experimental/core/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.

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

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.

Move Constructor.

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 boost::asio::ip::tcp::socket, you would write:

boost::asio::io_context ioc;
boost::asio::ssl::context ctx{boost::asio::ssl::context::sslv23};
boost::beast::ssl_stream<boost::asio:ip::tcp::socket> sock{ioc, ctx};

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


PrevUpHomeNext