(Deprecated. Use ssl::host_name_verification
.)
Verifies a certificate against a hostname according to the rules described
in RFC 2818.
class rfc2818_verification
Name |
Description |
---|---|
The type of the function object's result. |
Name |
Description |
---|---|
Perform certificate verification. |
|
Constructor. |
The following example shows how to synchronously open a secure connection to a given host name:
using asio::ip::tcp; namespace ssl = asio::ssl; typedef ssl::stream<tcp::socket> ssl_socket; // Create a context that uses the default paths for finding CA certificates. ssl::context ctx(ssl::context::sslv23); ctx.set_default_verify_paths(); // Open a socket and connect it to the remote host. asio::io_context io_context; ssl_socket sock(io_context, ctx); tcp::resolver resolver(io_context); tcp::resolver::query query("host.name", "https"); 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 ...
Header: asio/ssl/rfc2818_verification.hpp
Convenience header: asio/ssl.hpp