verify_context.hpp 1.8 KB

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