Clementine
context_base.hpp
1 //
2 // ssl/context_base.hpp
3 // ~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2020 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 ASIO_SSL_CONTEXT_BASE_HPP
12 #define ASIO_SSL_CONTEXT_BASE_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include "asio/ssl/detail/openssl_types.hpp"
20 
21 #include "asio/detail/push_options.hpp"
22 
23 namespace asio {
24 namespace ssl {
25 
29 {
30 public:
32  enum method
33  {
36 
39 
42 
45 
48 
51 
54 
57 
60 
63 
66 
69 
72 
75 
78 
81 
84 
87 
90 
93 
96 
98  tls,
99 
102 
105  };
106 
108  typedef long options;
109 
110 #if defined(GENERATING_DOCUMENTATION)
111  static const long default_workarounds = implementation_defined;
113 
115  static const long single_dh_use = implementation_defined;
116 
118  static const long no_sslv2 = implementation_defined;
119 
121  static const long no_sslv3 = implementation_defined;
122 
124  static const long no_tlsv1 = implementation_defined;
125 
127  static const long no_tlsv1_1 = implementation_defined;
128 
130  static const long no_tlsv1_2 = implementation_defined;
131 
133  static const long no_tlsv1_3 = implementation_defined;
134 
136  static const long no_compression = implementation_defined;
137 #else
138  ASIO_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL);
139  ASIO_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE);
140  ASIO_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2);
141  ASIO_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3);
142  ASIO_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1);
143 # if defined(SSL_OP_NO_TLSv1_1)
144  ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = SSL_OP_NO_TLSv1_1);
145 # else // defined(SSL_OP_NO_TLSv1_1)
146  ASIO_STATIC_CONSTANT(long, no_tlsv1_1 = 0x10000000L);
147 # endif // defined(SSL_OP_NO_TLSv1_1)
148 # if defined(SSL_OP_NO_TLSv1_2)
149  ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = SSL_OP_NO_TLSv1_2);
150 # else // defined(SSL_OP_NO_TLSv1_2)
151  ASIO_STATIC_CONSTANT(long, no_tlsv1_2 = 0x08000000L);
152 # endif // defined(SSL_OP_NO_TLSv1_2)
153 # if defined(SSL_OP_NO_TLSv1_3)
154  ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = SSL_OP_NO_TLSv1_3);
155 # else // defined(SSL_OP_NO_TLSv1_3)
156  ASIO_STATIC_CONSTANT(long, no_tlsv1_3 = 0x20000000L);
157 # endif // defined(SSL_OP_NO_TLSv1_3)
158 # if defined(SSL_OP_NO_COMPRESSION)
159  ASIO_STATIC_CONSTANT(long, no_compression = SSL_OP_NO_COMPRESSION);
160 # else // defined(SSL_OP_NO_COMPRESSION)
161  ASIO_STATIC_CONSTANT(long, no_compression = 0x20000L);
162 # endif // defined(SSL_OP_NO_COMPRESSION)
163 #endif
164 
167  {
170 
173  };
174 
175 #if !defined(GENERATING_DOCUMENTATION)
176  // The following types and constants are preserved for backward compatibility.
177  // New programs should use the equivalents of the same names that are defined
178  // in the asio::ssl namespace.
179  typedef int verify_mode;
180  ASIO_STATIC_CONSTANT(int, verify_none = SSL_VERIFY_NONE);
181  ASIO_STATIC_CONSTANT(int, verify_peer = SSL_VERIFY_PEER);
182  ASIO_STATIC_CONSTANT(int,
183  verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
184  ASIO_STATIC_CONSTANT(int, verify_client_once = SSL_VERIFY_CLIENT_ONCE);
185 #endif
186 
189  {
192 
195  };
196 
197 protected:
200  {
201  }
202 };
203 
204 } // namespace ssl
205 } // namespace asio
206 
207 #include "asio/detail/pop_options.hpp"
208 
209 #endif // ASIO_SSL_CONTEXT_BASE_HPP
Generic TLS version 1.3.
Definition: context_base.hpp:89
The password is needed for reading/decryption.
Definition: context_base.hpp:191
TLS version 1.2 server.
Definition: context_base.hpp:86
~context_base()
Protected destructor to prevent deletion through this type.
Definition: context_base.hpp:199
SSL version 2 server.
Definition: context_base.hpp:41
TLS version 1.1 client.
Definition: context_base.hpp:74
Generic TLS.
Definition: context_base.hpp:98
SSL version 2 client.
Definition: context_base.hpp:38
SSL/TLS client.
Definition: context_base.hpp:65
Generic SSL version 2.
Definition: context_base.hpp:35
TLS version 1.2 client.
Definition: context_base.hpp:83
TLS version 1 server.
Definition: context_base.hpp:59
ASN.1 file.
Definition: context_base.hpp:169
method
Different methods supported by a context.
Definition: context_base.hpp:32
TLS version 1.1 server.
Definition: context_base.hpp:77
TLS server.
Definition: context_base.hpp:104
PEM file.
Definition: context_base.hpp:172
password_purpose
Purpose of PEM password.
Definition: context_base.hpp:188
Generic SSL/TLS.
Definition: context_base.hpp:62
TLS version 1 client.
Definition: context_base.hpp:56
TLS version 1.3 client.
Definition: context_base.hpp:92
SSL version 3 server.
Definition: context_base.hpp:50
Generic TLS version 1.2.
Definition: context_base.hpp:80
SSL/TLS server.
Definition: context_base.hpp:68
Generic TLS version 1.
Definition: context_base.hpp:53
SSL version 3 client.
Definition: context_base.hpp:47
The password is needed for writing/encryption.
Definition: context_base.hpp:194
long options
Bitmask type for SSL options.
Definition: context_base.hpp:108
TLS version 1.3 server.
Definition: context_base.hpp:95
TLS client.
Definition: context_base.hpp:101
Definition: any_io_executor.hpp:28
The context_base class is used as a base for the basic_context class template so that we have a commo...
Definition: context_base.hpp:28
Generic SSL version 3.
Definition: context_base.hpp:44
file_format
File format types.
Definition: context_base.hpp:166
Generic TLS version 1.1.
Definition: context_base.hpp:71