• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>ssl::rfc2818_verification</title>
5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../reference.html" title="Reference">
9<link rel="prev" href="ssl__host_name_verification/result_type.html" title="ssl::host_name_verification::result_type">
10<link rel="next" href="ssl__rfc2818_verification/operator_lp__rp_.html" title="ssl::rfc2818_verification::operator()">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15<td align="center"><a href="../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="ssl__host_name_verification/result_type.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ssl__rfc2818_verification/operator_lp__rp_.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_asio.reference.ssl__rfc2818_verification"></a><a class="link" href="ssl__rfc2818_verification.html" title="ssl::rfc2818_verification">ssl::rfc2818_verification</a>
28</h3></div></div></div>
29<p>
30        (Deprecated. Use <a class="link" href="ssl__host_name_verification.html" title="ssl::host_name_verification"><code class="computeroutput">ssl::host_name_verification</code></a>.)
31        Verifies a certificate against a hostname according to the rules described
32        in RFC 2818.
33      </p>
34<pre class="programlisting">class rfc2818_verification
35</pre>
36<h5>
37<a name="boost_asio.reference.ssl__rfc2818_verification.h0"></a>
38        <span class="phrase"><a name="boost_asio.reference.ssl__rfc2818_verification.types"></a></span><a class="link" href="ssl__rfc2818_verification.html#boost_asio.reference.ssl__rfc2818_verification.types">Types</a>
39      </h5>
40<div class="informaltable"><table class="table">
41<colgroup>
42<col>
43<col>
44</colgroup>
45<thead><tr>
46<th>
47                <p>
48                  Name
49                </p>
50              </th>
51<th>
52                <p>
53                  Description
54                </p>
55              </th>
56</tr></thead>
57<tbody><tr>
58<td>
59                <p>
60                  <a class="link" href="ssl__rfc2818_verification/result_type.html" title="ssl::rfc2818_verification::result_type"><span class="bold"><strong>result_type</strong></span></a>
61                </p>
62              </td>
63<td>
64                <p>
65                  The type of the function object's result.
66                </p>
67              </td>
68</tr></tbody>
69</table></div>
70<h5>
71<a name="boost_asio.reference.ssl__rfc2818_verification.h1"></a>
72        <span class="phrase"><a name="boost_asio.reference.ssl__rfc2818_verification.member_functions"></a></span><a class="link" href="ssl__rfc2818_verification.html#boost_asio.reference.ssl__rfc2818_verification.member_functions">Member
73        Functions</a>
74      </h5>
75<div class="informaltable"><table class="table">
76<colgroup>
77<col>
78<col>
79</colgroup>
80<thead><tr>
81<th>
82                <p>
83                  Name
84                </p>
85              </th>
86<th>
87                <p>
88                  Description
89                </p>
90              </th>
91</tr></thead>
92<tbody>
93<tr>
94<td>
95                <p>
96                  <a class="link" href="ssl__rfc2818_verification/operator_lp__rp_.html" title="ssl::rfc2818_verification::operator()"><span class="bold"><strong>operator()</strong></span></a>
97                </p>
98              </td>
99<td>
100                <p>
101                  Perform certificate verification.
102                </p>
103              </td>
104</tr>
105<tr>
106<td>
107                <p>
108                  <a class="link" href="ssl__rfc2818_verification/rfc2818_verification.html" title="ssl::rfc2818_verification::rfc2818_verification"><span class="bold"><strong>rfc2818_verification</strong></span></a> <span class="silver">[constructor]</span>
109                </p>
110              </td>
111<td>
112                <p>
113                  Constructor.
114                </p>
115              </td>
116</tr>
117</tbody>
118</table></div>
119<h5>
120<a name="boost_asio.reference.ssl__rfc2818_verification.h2"></a>
121        <span class="phrase"><a name="boost_asio.reference.ssl__rfc2818_verification.example"></a></span><a class="link" href="ssl__rfc2818_verification.html#boost_asio.reference.ssl__rfc2818_verification.example">Example</a>
122      </h5>
123<p>
124        The following example shows how to synchronously open a secure connection
125        to a given host name:
126      </p>
127<pre class="programlisting">using boost::asio::ip::tcp;
128namespace ssl = boost::asio::ssl;
129typedef ssl::stream&lt;tcp::socket&gt; ssl_socket;
130
131// Create a context that uses the default paths for finding CA certificates.
132ssl::context ctx(ssl::context::sslv23);
133ctx.set_default_verify_paths();
134
135// Open a socket and connect it to the remote host.
136boost::asio::io_context io_context;
137ssl_socket sock(io_context, ctx);
138tcp::resolver resolver(io_context);
139tcp::resolver::query query("host.name", "https");
140boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
141sock.lowest_layer().set_option(tcp::no_delay(true));
142
143// Perform SSL handshake and verify the remote host's certificate.
144sock.set_verify_mode(ssl::verify_peer);
145sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
146sock.handshake(ssl_socket::client);
147
148// ... read and write as normal ...
149</pre>
150<h5>
151<a name="boost_asio.reference.ssl__rfc2818_verification.h3"></a>
152        <span class="phrase"><a name="boost_asio.reference.ssl__rfc2818_verification.requirements"></a></span><a class="link" href="ssl__rfc2818_verification.html#boost_asio.reference.ssl__rfc2818_verification.requirements">Requirements</a>
153      </h5>
154<p>
155        <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/ssl/rfc2818_verification.hpp</code>
156      </p>
157<p>
158        <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio/ssl.hpp</code>
159      </p>
160</div>
161<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
162<td align="left"></td>
163<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
164      Kohlhoff<p>
165        Distributed under the Boost Software License, Version 1.0. (See accompanying
166        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
167      </p>
168</div></td>
169</tr></table>
170<hr>
171<div class="spirit-nav">
172<a accesskey="p" href="ssl__host_name_verification/result_type.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ssl__rfc2818_verification/operator_lp__rp_.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
173</div>
174</body>
175</html>
176