verify_context.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifndef BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
  11. #define BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <boost/asio/detail/noncopyable.hpp>
  17. #include <boost/asio/ssl/detail/openssl_types.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. namespace ssl {
  22. /// A simple wrapper around the X509_STORE_CTX type, used during verification of
  23. /// a peer certificate.
  24. /**
  25. * @note The verify_context does not own the underlying X509_STORE_CTX object.
  26. */
  27. class verify_context
  28. : private noncopyable
  29. {
  30. public:
  31. /// The native handle type of the verification context.
  32. typedef X509_STORE_CTX* native_handle_type;
  33. /// Constructor.
  34. explicit verify_context(native_handle_type handle)
  35. : handle_(handle)
  36. {
  37. }
  38. /// Get the underlying implementation in the native type.
  39. /**
  40. * This function may be used to obtain the underlying implementation of the
  41. * context. This is intended to allow access to context functionality that is
  42. * not otherwise provided.
  43. */
  44. native_handle_type native_handle()
  45. {
  46. return handle_;
  47. }
  48. private:
  49. // The underlying native implementation.
  50. native_handle_type handle_;
  51. };
  52. } // namespace ssl
  53. } // namespace asio
  54. } // namespace boost
  55. #include <boost/asio/detail/pop_options.hpp>
  56. #endif // BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP