1 //
2 // ssl/verify_context.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
12 #define BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include <boost/asio/detail/config.hpp>
19 
20 #include <boost/asio/detail/noncopyable.hpp>
21 #include <boost/asio/ssl/detail/openssl_types.hpp>
22 
23 #include <boost/asio/detail/push_options.hpp>
24 
25 namespace boost {
26 namespace asio {
27 namespace ssl {
28 
29 /// A simple wrapper around the X509_STORE_CTX type, used during verification of
30 /// a peer certificate.
31 /**
32  * @note The verify_context does not own the underlying X509_STORE_CTX object.
33  */
34 class verify_context
35   : private noncopyable
36 {
37 public:
38   /// The native handle type of the verification context.
39   typedef X509_STORE_CTX* native_handle_type;
40 
41   /// Constructor.
verify_context(native_handle_type handle)42   explicit verify_context(native_handle_type handle)
43     : handle_(handle)
44   {
45   }
46 
47   /// Get the underlying implementation in the native type.
48   /**
49    * This function may be used to obtain the underlying implementation of the
50    * context. This is intended to allow access to context functionality that is
51    * not otherwise provided.
52    */
native_handle()53   native_handle_type native_handle()
54   {
55     return handle_;
56   }
57 
58 private:
59   // The underlying native implementation.
60   native_handle_type handle_;
61 };
62 
63 } // namespace ssl
64 } // namespace asio
65 } // namespace boost
66 
67 #include <boost/asio/detail/pop_options.hpp>
68 
69 #endif // BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
70