Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::asio::ssl::rfc2818_verification Class Reference

Verifies a certificate against a hostname according to the rules described in RFC 2818. More...

#include <rfc2818_verification.hpp>

Public Types

typedef bool result_type
 The type of the function object's result. More...
 

Public Member Functions

 rfc2818_verification (const std::string &host)
 Constructor. More...
 
BOOST_ASIO_DECL bool operator() (bool preverified, verify_context &ctx) const
 Perform certificate verification. More...
 

Detailed Description

Verifies a certificate against a hostname according to the rules described in RFC 2818.

Example
The following example shows how to synchronously open a secure connection to a given host name:
namespace ssl = boost::asio::ssl;
typedef ssl::stream<tcp::socket> ssl_socket;
// Create a context that uses the default paths for finding CA certificates.
ctx.set_default_verify_paths();
// Open a socket and connect it to the remote host.
ssl_socket sock(io_service, ctx);
tcp::resolver resolver(io_service);
tcp::resolver::query query("host.name", "https");
boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
sock.lowest_layer().set_option(tcp::no_delay(true));
// Perform SSL handshake and verify the remote host's certificate.
sock.set_verify_mode(ssl::verify_peer);
sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
sock.handshake(ssl_socket::client);
// ... read and write as normal ...

Member Typedef Documentation

The type of the function object's result.

Constructor & Destructor Documentation

boost::asio::ssl::rfc2818_verification::rfc2818_verification ( const std::string &  host)
inlineexplicit

Constructor.

Member Function Documentation

BOOST_ASIO_DECL bool boost::asio::ssl::rfc2818_verification::operator() ( bool  preverified,
verify_context ctx 
) const

Perform certificate verification.


The documentation for this class was generated from the following file: