Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::TLS::Policy Class Reference

`#include <tls_policy.h>`

Inheritance diagram for Botan::TLS::Policy:

## Public Member Functions
virtual bool | abort_connection_on_undesired_renegotiation () const
virtual bool | acceptable_ciphersuite (const Ciphersuite &suite) const
virtual bool | acceptable_protocol_version (Protocol_Version version) const
virtual bool | allow_client_initiated_renegotiation () const
virtual bool | allow_dtls10 () const
virtual bool | allow_dtls12 () const
virtual bool | allow_dtls_epoch0_restart () const
virtual bool | allow_insecure_renegotiation () const
virtual bool | allow_resumption_for_renegotiation () const
virtual bool | allow_server_initiated_renegotiation () const
virtual bool | allow_tls10 () const
virtual bool | allow_tls11 () const
virtual bool | allow_tls12 () const
virtual std::vector< std::string > | allowed_ciphers () const
virtual std::vector< std::string > | allowed_key_exchange_methods () const
virtual std::vector< std::string > | allowed_macs () const
bool | allowed_signature_hash (const std::string &hash) const
virtual std::vector< std::string > | allowed_signature_hashes () const
bool | allowed_signature_method (const std::string &sig_method) const
virtual std::vector< std::string > | allowed_signature_methods () const
virtual std::vector< Signature_Scheme > | allowed_signature_schemes () const
virtual void | check_peer_key_acceptable (const Public_Key &public_key) const
virtual Group_Params | choose_key_exchange_group (const std::vector< Group_Params > &peer_groups) const
virtual std::vector< uint16_t > | ciphersuite_list (Protocol_Version version, bool have_srp) const
virtual Group_Params | default_dh_group () const
virtual size_t | dtls_default_mtu () const
virtual size_t | dtls_initial_timeout () const
virtual size_t | dtls_maximum_timeout () const
virtual bool | hide_unknown_users () const
virtual bool | include_time_in_hello_random () const
virtual std::vector< Group_Params > | key_exchange_groups () const
virtual Protocol_Version | latest_supported_version (bool datagram) const
virtual size_t | maximum_certificate_chain_size () const
virtual size_t | minimum_dh_group_size () const
virtual size_t | minimum_dsa_group_size () const
virtual size_t | minimum_ecdh_group_size () const
virtual size_t | minimum_ecdsa_group_size () const
virtual size_t | minimum_rsa_bits () const
virtual size_t | minimum_signature_strength () const
virtual bool | negotiate_encrypt_then_mac () const
virtual bool | only_resume_with_exact_version () const
virtual void | print (std::ostream &o) const
virtual bool | request_client_certificate_authentication () const
virtual bool | require_cert_revocation_info () const
virtual bool | require_client_certificate_authentication () const
virtual bool | send_fallback_scsv (Protocol_Version version) const
virtual bool | server_uses_own_ciphersuite_preferences () const
virtual uint32_t | session_ticket_lifetime () const
virtual std::vector< uint16_t > | srtp_profiles () const
virtual bool | support_cert_status_message () const
std::string | to_string () const
virtual bool | use_ecc_point_compression () const
virtual | ~Policy ()=default

## Detailed Description

TLS Policy Base Class Inherit and overload as desired to suit local policy concerns

Definition at line 28 of file tls_policy.h.

## Constructor & Destructor Documentation

virtual Botan::TLS::Policy::~Policy | ( |  | ) |
| virtual default

## Member Function Documentation

bool Botan::TLS::Policy::abort_connection_on_undesired_renegotiation | ( |  | ) | const
| virtual

If true, a request to renegotiate will close the connection with a fatal alert. Otherwise, a warning alert is sent.

Definition at line 349 of file tls_policy.cpp.

349 { return false; }

bool Botan::TLS::Policy::acceptable_ciphersuite | ( | const Ciphersuite & | suite | ) | const
| virtual

Allows policy to reject any ciphersuites which are undesirable for whatever reason without having to reimplement ciphersuite_list

Definition at line 326 of file tls_policy.cpp.

References allowed_ciphers(), allowed_macs(), Botan::TLS::Ciphersuite::cipher_algo(), Botan::TLS::Ciphersuite::mac_algo(), and Botan::value_exists().

Referenced by ciphersuite_list().

327 {
328 return value_exists(allowed_ciphers(), ciphersuite.cipher_algo()) &&
329 value_exists(allowed_macs(), ciphersuite.mac_algo());
330 }
Botan::TLS::Policy::allowed_ciphers
virtual std::vector< std::string > allowed_ciphers() const
Definition: tls_policy.cpp:42
Botan::value_exists
bool value_exists(const std::vector< T > &vec, const T &val)
Definition: stl_util.h:86
Botan::TLS::Policy::allowed_macs
virtual std::vector< std::string > allowed_macs() const
Definition: tls_policy.cpp:77

bool Botan::TLS::Policy::acceptable_protocol_version | ( | Protocol_Version | version | ) | const
| virtual

Returns
  true if and only if we are willing to accept this version Default accepts TLS v1.0 and later or DTLS v1.2 or later.

Definition at line 278 of file tls_policy.cpp.

References allow_dtls10(), allow_dtls12(), allow_tls10(), allow_tls11(), allow_tls12(), Botan::TLS::Protocol_Version::DTLS_V10, Botan::TLS::Protocol_Version::DTLS_V12, Botan::TLS::Protocol_Version::TLS_V10, Botan::TLS::Protocol_Version::TLS_V11, and Botan::TLS::Protocol_Version::TLS_V12.

Referenced by Botan::TLS::Client_Hello::Client_Hello(), and latest_supported_version().

279 {
280 if(version == Protocol_Version::TLS_V12 && allow_tls12())
281 return true;
282
283 if(version == Protocol_Version::DTLS_V12 && allow_dtls12())
284 return true;
285
286 #if defined(BOTAN_HAS_TLS_V10)
287
288 if(version == Protocol_Version::TLS_V11 && allow_tls11())
289 return true;
290 if(version == Protocol_Version::TLS_V10 && allow_tls10())
291 return true;
292 if(version == Protocol_Version::DTLS_V10 && allow_dtls10())
293 return true;
294
295 #endif
296
297 return false;
298 }
Botan::TLS::Protocol_Version::DTLS_V12
Definition: tls_version.h:30
Botan::TLS::Protocol_Version::DTLS_V10
Definition: tls_version.h:29
Botan::TLS::Protocol_Version::TLS_V11
Definition: tls_version.h:26
Botan::TLS::Protocol_Version::TLS_V12
Definition: tls_version.h:27
Botan::TLS::Protocol_Version::TLS_V10
Definition: tls_version.h:25
Botan::TLS::Policy::allow_tls10
virtual bool allow_tls10() const
Definition: tls_policy.cpp:335
Botan::TLS::Policy::allow_dtls12
virtual bool allow_dtls12() const
Definition: tls_policy.cpp:339
Botan::TLS::Policy::allow_dtls10
virtual bool allow_dtls10() const
Definition: tls_policy.cpp:338
Botan::TLS::Policy::allow_tls11
virtual bool allow_tls11() const
Definition: tls_policy.cpp:336
Botan::TLS::Policy::allow_tls12
virtual bool allow_tls12() const
Definition: tls_policy.cpp:337

bool Botan::TLS::Policy::allow_client_initiated_renegotiation | ( |  | ) | const
| virtual

Consulted by server side. If true, allows clients to initiate a new handshake

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 332 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::allow_client_initiated_renegotiation().

332 { return false; }

bool Botan::TLS::Policy::allow_dtls10 | ( |  | ) | const
| virtual

Allow DTLS v1.0

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::Datagram_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 338 of file tls_policy.cpp.

Referenced by acceptable_protocol_version(), Botan::TLS::Text_Policy::allow_dtls10(), print(), and Botan::TLS::Supported_Versions::Supported_Versions().

338 { return false; }

bool Botan::TLS::Policy::allow_dtls12 | ( |  | ) | const
| virtual

Allow DTLS v1.2

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::Datagram_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 339 of file tls_policy.cpp.

Referenced by acceptable_protocol_version(), Botan::TLS::Text_Policy::allow_dtls12(), print(), and Botan::TLS::Supported_Versions::Supported_Versions().

339 { return true; }

bool Botan::TLS::Policy::allow_dtls_epoch0_restart | ( |  | ) | const
| virtual

If true, then allow a DTLS client to restart a connection to the same server association as described in section 4.2.8 of the DTLS RFC

Definition at line 350 of file tls_policy.cpp.

Referenced by Botan::TLS::Channel::received_data().

350 { return false; }

bool Botan::TLS::Policy::allow_insecure_renegotiation | ( |  | ) | const
| virtual

Allow renegotiation even if the counterparty doesn't support the secure renegotiation extension.

Warning
  Changing this to true exposes you to injected plaintext attacks. Read RFC 5746 for background.

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 334 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::allow_insecure_renegotiation(), and print().

334 { return false; }

bool Botan::TLS::Policy::allow_resumption_for_renegotiation | ( |  | ) | const
| virtual

Definition at line 345 of file tls_policy.cpp.

Referenced by Botan::TLS::Channel::renegotiate().

345 { return true; }

bool Botan::TLS::Policy::allow_server_initiated_renegotiation | ( |  | ) | const
| virtual

Consulted by client side. If true, allows servers to initiate a new handshake

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 333 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::allow_server_initiated_renegotiation(), and print().

333 { return false; }

bool Botan::TLS::Policy::allow_tls10 | ( |  | ) | const
| virtual

Allow TLS v1.0

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::Datagram_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 335 of file tls_policy.cpp.

Referenced by acceptable_protocol_version(), Botan::TLS::Text_Policy::allow_tls10(), print(), and Botan::TLS::Supported_Versions::Supported_Versions().

335 { return false; }

bool Botan::TLS::Policy::allow_tls11 | ( |  | ) | const
| virtual

Allow TLS v1.1

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::Datagram_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 336 of file tls_policy.cpp.

Referenced by acceptable_protocol_version(), Botan::TLS::Text_Policy::allow_tls11(), print(), and Botan::TLS::Supported_Versions::Supported_Versions().

336 { return false; }

bool Botan::TLS::Policy::allow_tls12 | ( |  | ) | const
| virtual

Allow TLS v1.2

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::Datagram_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 337 of file tls_policy.cpp.

Referenced by acceptable_protocol_version(), Botan::TLS::Text_Policy::allow_tls12(), print(), and Botan::TLS::Supported_Versions::Supported_Versions().

337 { return true; }

std::vector< std::string > Botan::TLS::Policy::allowed_ciphers | ( |  | ) | const
| virtual

Returns a list of ciphers we are willing to negotiate, in order of preference.

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 42 of file tls_policy.cpp.

Referenced by acceptable_ciphersuite(), Botan::TLS::Text_Policy::allowed_ciphers(), ciphersuite_list(), and print().

43 {
44 return {
45 //"AES-256/OCB(12)",
46 //"AES-128/OCB(12)",
47 "ChaCha20Poly1305",
48 "AES-256/GCM",
49 "AES-128/GCM",
50 //"AES-256/CCM",
51 //"AES-128/CCM",
52 //"AES-256/CCM(8)",
53 //"AES-128/CCM(8)",
54 //"Camellia-256/GCM",
55 //"Camellia-128/GCM",
56 //"ARIA-256/GCM",
57 //"ARIA-128/GCM",
58 //"AES-256",
59 //"AES-128",
60 //"Camellia-256",
61 //"Camellia-128",
62 //"SEED",
63 //"3DES",
64 };
65 }

std::vector< std::string > Botan::TLS::Policy::allowed_key_exchange_methods | ( |  | ) | const
| virtual

Returns a list of key exchange algorithms we are willing to use, in order of preference. Allowed values: DH, empty string (representing RSA using server certificate key)

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 92 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::allowed_key_exchange_methods(), ciphersuite_list(), and print().

93 {
94 return {
95 //"SRP_SHA",
96 //"ECDHE_PSK",
97 //"DHE_PSK",
98 //"PSK",
99 "CECPQ1",
100 "ECDH",
101 "DH",
102 //"RSA",
103 };
104 }

std::vector< std::string > Botan::TLS::Policy::allowed_macs | ( |  | ) | const
| virtual

Returns a list of MAC algorithms we are willing to use.

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::Datagram_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 77 of file tls_policy.cpp.

Referenced by acceptable_ciphersuite(), Botan::TLS::Text_Policy::allowed_macs(), ciphersuite_list(), and print().

78 {
79 /*
80 SHA-256 is preferred because the Lucky13 countermeasure works
81 somewhat better for SHA-256 vs SHA-384:
82 https://github.com/randombit/botan/pull/675
83 */
84 return {
85 "AEAD",
86 "SHA-256",
87 "SHA-384",
88 "SHA-1",
89 };
90 }

bool Botan::TLS::Policy::allowed_signature_hash | ( | const std::string & | hash | ) | const

Definition at line 122 of file tls_policy.cpp.

References allowed_signature_hashes(), and Botan::value_exists().

Referenced by allowed_signature_schemes(), and Botan::TLS::Handshake_State::choose_sig_format().

123 {
124 return value_exists(allowed_signature_hashes(), sig_hash);
125 }
Botan::TLS::Policy::allowed_signature_hashes
virtual std::vector< std::string > allowed_signature_hashes() const
Definition: tls_policy.cpp:67
Botan::value_exists
bool value_exists(const std::vector< T > &vec, const T &val)
Definition: stl_util.h:86

std::vector< std::string > Botan::TLS::Policy::allowed_signature_hashes | ( |  | ) | const
| virtual

Returns a list of hash algorithms we are willing to use for signatures, in order of preference.

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::Strict_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 67 of file tls_policy.cpp.

Referenced by allowed_signature_hash(), Botan::TLS::Text_Policy::allowed_signature_hashes(), and print().

68 {
69 return {
70 "SHA-512",
71 "SHA-384",
72 "SHA-256",
73 //"SHA-1",
74 };
75 }

bool Botan::TLS::Policy::allowed_signature_method | ( | const std::string & | sig_method | ) | const

Definition at line 117 of file tls_policy.cpp.

References allowed_signature_methods(), and Botan::value_exists().

Referenced by allowed_signature_schemes(), and Botan::TLS::Handshake_State::parse_sig_format().

118 {
119 return value_exists(allowed_signature_methods(), sig_method);
120 }
Botan::TLS::Policy::allowed_signature_methods
virtual std::vector< std::string > allowed_signature_methods() const
Definition: tls_policy.cpp:106
Botan::value_exists
bool value_exists(const std::vector< T > &vec, const T &val)
Definition: stl_util.h:86

std::vector< std::string > Botan::TLS::Policy::allowed_signature_methods | ( |  | ) | const
| virtual

Returns a list of signature algorithms we are willing to use, in order of preference. Allowed values RSA and DSA.

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 106 of file tls_policy.cpp.

Referenced by allowed_signature_method(), Botan::TLS::Text_Policy::allowed_signature_methods(), ciphersuite_list(), and print().

107 {
108 return {
109 "ECDSA",
110 "RSA",
111 //"DSA",
112 //"IMPLICIT",
113 //"ANONYMOUS" (anon)
114 };
115 }

std::vector< Signature_Scheme > Botan::TLS::Policy::allowed_signature_schemes | ( |  | ) | const
| virtual

Definition at line 22 of file tls_policy.cpp.

References Botan::TLS::all_signature_schemes(), allowed_signature_hash(), allowed_signature_method(), Botan::TLS::hash_function_of_scheme(), Botan::TLS::signature_algorithm_of_scheme(), and Botan::TLS::signature_scheme_is_known().

Referenced by Botan::TLS::Handshake_State::choose_sig_format(), and Botan::TLS::Client_Hello::Client_Hello().

23 {
24 std::vector<Signature_Scheme> schemes;
25
26 for(Signature_Scheme scheme : all_signature_schemes())
27 {
28 if(signature_scheme_is_known(scheme) == false)
29 continue;
30 const bool sig_allowed = allowed_signature_method(signature_algorithm_of_scheme(scheme));
31 const bool hash_allowed = allowed_signature_hash(hash_function_of_scheme(scheme));
32
33 if(sig_allowed && hash_allowed)
34 {
35 schemes.push_back(scheme);
36 }
37 }
38
39 return schemes;
40 }
Botan::TLS::hash_function_of_scheme
std::string hash_function_of_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:191
Botan::TLS::Policy::allowed_signature_method
bool allowed_signature_method(const std::string &sig_method) const
Definition: tls_policy.cpp:117
Botan::TLS::Signature_Scheme
Signature_Scheme
Definition: tls_algos.h:86
Botan::TLS::signature_scheme_is_known
bool signature_scheme_is_known(Signature_Scheme scheme)
Definition: tls_algos.cpp:262
Botan::TLS::all_signature_schemes
const std::vector< Signature_Scheme > & all_signature_schemes()
Definition: tls_algos.cpp:229
Botan::TLS::Policy::allowed_signature_hash
bool allowed_signature_hash(const std::string &hash) const
Definition: tls_policy.cpp:122
Botan::TLS::signature_algorithm_of_scheme
std::string signature_algorithm_of_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:291

void Botan::TLS::Policy::check_peer_key_acceptable | ( | const Public_Key & | public_key | ) | const
| virtual

Throw an exception if you don't like the peer's key. Default impl checks the key size against minimum_rsa_bits, minimum_ecdsa_group_size, or minimum_ecdh_group_size depending on the key's type. Override if you'd like to perform some other kind of test on (or logging of) the peer's keys.

Definition at line 231 of file tls_policy.cpp.

References Botan::Public_Key::algo_name(), Botan::TLS::Alert::INSUFFICIENT_SECURITY, Botan::Public_Key::key_length(), minimum_dh_group_size(), minimum_dsa_group_size(), minimum_ecdh_group_size(), minimum_ecdsa_group_size(), minimum_rsa_bits(), and Botan::ASN1::to_string().

Referenced by Botan::TLS::Callbacks::tls_dh_agree(), Botan::TLS::Callbacks::tls_ecdh_agree(), Botan::TLS::Certificate_Verify::verify(), and Botan::TLS::Server_Key_Exchange::verify().

232 {
233 const std::string algo_name = public_key.algo_name();
234
235 const size_t keylength = public_key.key_length();
236 size_t expected_keylength = 0;
237
238 if(algo_name == "RSA")
239 {
240 expected_keylength = minimum_rsa_bits();
241 }
242 else if(algo_name == "DH")
243 {
244 expected_keylength = minimum_dh_group_size();
245 }
246 else if(algo_name == "DSA")
247 {
248 expected_keylength = minimum_dsa_group_size();
249 }
250 else if(algo_name == "ECDH" || algo_name == "Curve25519")
251 {
252 expected_keylength = minimum_ecdh_group_size();
253 }
254 else if(algo_name == "ECDSA")
255 {
256 expected_keylength = minimum_ecdsa_group_size();
257 }
258 // else some other algo, so leave expected_keylength as zero and the check is a no-op
259
260 if(keylength < expected_keylength)
261 throw TLS_Exception(Alert::INSUFFICIENT_SECURITY,
262 "Peer sent " +
263 std::to_string(keylength) + " bit " + algo_name + " key"
264 ", policy requires at least " +
265 std::to_string(expected_keylength));
266 }
Botan::TLS::Policy::minimum_dh_group_size
virtual size_t minimum_dh_group_size() const
Definition: tls_policy.cpp:186
Botan::ASN1::to_string
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213
Botan::TLS::Policy::minimum_ecdh_group_size
virtual size_t minimum_ecdh_group_size() const
Definition: tls_policy.cpp:197
Botan::TLS::Policy::minimum_dsa_group_size
virtual size_t minimum_dsa_group_size() const
Definition: tls_policy.cpp:225
Botan::TLS::Policy::minimum_ecdsa_group_size
virtual size_t minimum_ecdsa_group_size() const
Definition: tls_policy.cpp:191
Botan::TLS::Alert::INSUFFICIENT_SECURITY
Definition: tls_alert.h:48
Botan::TLS::Policy::minimum_rsa_bits
virtual size_t minimum_rsa_bits() const
Definition: tls_policy.cpp:213

Group_Params Botan::TLS::Policy::choose_key_exchange_group | ( | const std::vector< Group_Params > & | peer_groups | ) | const
| virtual

Select a key exchange group to use, from the list of groups sent by the peer. If none are acceptable, return Group_Params::NONE

Definition at line 132 of file tls_policy.cpp.

References key_exchange_groups(), Botan::TLS::NONE, and Botan::value_exists().

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().

133 {
134 if(peer_groups.empty())
135 return Group_Params::NONE;
136
137 const std::vector<Group_Params> our_groups = key_exchange_groups();
138
139 for(auto g : our_groups)
140 {
141 if(value_exists(peer_groups, g))
142 return g;
143 }
144
145 return Group_Params::NONE;
146 }
Botan::TLS::Signature_Scheme::NONE
Botan::TLS::Policy::key_exchange_groups
virtual std::vector< Group_Params > key_exchange_groups() const
Definition: tls_policy.cpp:162
Botan::value_exists
bool value_exists(const std::vector< T > &vec, const T &val)
Definition: stl_util.h:86

std::vector< uint16_t > Botan::TLS::Policy::ciphersuite_list | ( | Protocol_Version | version,
|  | bool | have_srp
| ) |  | const
| virtual

Return allowed ciphersuites, in order of preference

Definition at line 442 of file tls_policy.cpp.

References acceptable_ciphersuite(), Botan::TLS::Ciphersuite::all_known_ciphersuites(), allowed_ciphers(), allowed_key_exchange_methods(), allowed_macs(), allowed_signature_methods(), Botan::TLS::CECPQ1, Botan::TLS::IMPLICIT, key_exchange_groups(), Botan::TLS::SRP_SHA, Botan::value_exists(), and Botan::TLS::X25519.

444 {
445 const std::vector<std::string> ciphers = allowed_ciphers();
446 const std::vector<std::string> macs = allowed_macs();
447 const std::vector<std::string> kex = allowed_key_exchange_methods();
448 const std::vector<std::string> sigs = allowed_signature_methods();
449
450 std::vector<Ciphersuite> ciphersuites;
451
452 for(auto&& suite : Ciphersuite::all_known_ciphersuites())
453 {
454 // Can we use it?
455 if(!suite.valid())
456 continue;
457
458 // Can we use it in this version?
459 if(!suite.usable_in_version(version))
460 continue;
461
462 // Is it acceptable to the policy?
463 if(!this->acceptable_ciphersuite(suite))
464 continue;
465
466 // Are we doing SRP?
467 if(!have_srp && suite.kex_method() == Kex_Algo::SRP_SHA)
468 continue;
469
470 if(!value_exists(kex, suite.kex_algo()))
471 continue; // unsupported key exchange
472
473 if(!value_exists(ciphers, suite.cipher_algo()))
474 continue; // unsupported cipher
475
476 if(!value_exists(macs, suite.mac_algo()))
477 continue; // unsupported MAC algo
478
479 if(!value_exists(sigs, suite.sig_algo()))
480 {
481 // allow if it's an empty sig algo and we want to use PSK
482 if(suite.auth_method() != Auth_Method::IMPLICIT || !suite.psk_ciphersuite())
483 continue;
484 }
485
486 /*
487 CECPQ1 always uses x25519 for ECDH, so treat the applications
488 removal of x25519 from the ECC curve list as equivalent to
489 saying they do not trust CECPQ1
490 */
491 if(suite.kex_method() == Kex_Algo::CECPQ1)
492 {
493 if(value_exists(key_exchange_groups(), Group_Params::X25519) == false)
494 continue;
495 }
496
497 // OK, consider it
498 ciphersuites.push_back(suite);
499 }
500
501 if(ciphersuites.empty())
502 {
503 throw Invalid_State("Policy does not allow any available cipher suite");
504 }
505
506 Ciphersuite_Preference_Ordering order(ciphers, macs, kex, sigs);
507 std::sort(ciphersuites.begin(), ciphersuites.end(), order);
508
509 std::vector<uint16_t> ciphersuite_codes;
510 for(auto i : ciphersuites)
511 ciphersuite_codes.push_back(i.ciphersuite_code());
512 return ciphersuite_codes;
513 }
Botan::TLS::Policy::allowed_ciphers
virtual std::vector< std::string > allowed_ciphers() const
Definition: tls_policy.cpp:42
Botan::TLS::Kex_Algo::CECPQ1
Botan::TLS::Policy::allowed_signature_methods
virtual std::vector< std::string > allowed_signature_methods() const
Definition: tls_policy.cpp:106
Botan::TLS::Group_Params::X25519
Botan::TLS::Policy::key_exchange_groups
virtual std::vector< Group_Params > key_exchange_groups() const
Definition: tls_policy.cpp:162
Botan::TLS::Auth_Method::IMPLICIT
Botan::value_exists
bool value_exists(const std::vector< T > &vec, const T &val)
Definition: stl_util.h:86
Botan::TLS::Kex_Algo::SRP_SHA
Botan::TLS::Policy::acceptable_ciphersuite
virtual bool acceptable_ciphersuite(const Ciphersuite &suite) const
Definition: tls_policy.cpp:326
Botan::TLS::Policy::allowed_key_exchange_methods
virtual std::vector< std::string > allowed_key_exchange_methods() const
Definition: tls_policy.cpp:92
Botan::TLS::Ciphersuite::all_known_ciphersuites
static const std::vector< Ciphersuite > & all_known_ciphersuites()
Definition: tls_suite_info.cpp:18
Botan::TLS::Policy::allowed_macs
virtual std::vector< std::string > allowed_macs() const
Definition: tls_policy.cpp:77

Group_Params Botan::TLS::Policy::default_dh_group | ( |  | ) | const
| virtual

Definition at line 148 of file tls_policy.cpp.

References Botan::TLS::FFDHE_2048, Botan::TLS::group_param_is_dh(), and key_exchange_groups().

Referenced by Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().

149 {
150 /*
151 * Return the first listed or just default to 2048
152 */
153 for(auto g : key_exchange_groups())
154 {
155 if(group_param_is_dh(g))
156 return g;
157 }
158
159 return Group_Params::FFDHE_2048;
160 }
Botan::TLS::group_param_is_dh
bool group_param_is_dh(Group_Params group)
Definition: tls_algos.cpp:118
Botan::TLS::Policy::key_exchange_groups
virtual std::vector< Group_Params > key_exchange_groups() const
Definition: tls_policy.cpp:162
Botan::TLS::Group_Params::FFDHE_2048

size_t Botan::TLS::Policy::dtls_default_mtu | ( |  | ) | const
| virtual

Returns
  the default MTU for DTLS

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 358 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::dtls_default_mtu().

359 {
360 // default MTU is IPv6 min MTU minus UDP/IP headers
361 return 1280 - 40 - 8;
362 }

size_t Botan::TLS::Policy::dtls_initial_timeout | ( |  | ) | const
| virtual

Returns
  the initial timeout for DTLS

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 355 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::dtls_initial_timeout().

355 { return 1*1000; }

size_t Botan::TLS::Policy::dtls_maximum_timeout | ( |  | ) | const
| virtual

Returns
  the maximum timeout for DTLS

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 356 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::dtls_maximum_timeout().

356 { return 60*1000; }

bool Botan::TLS::Policy::hide_unknown_users | ( |  | ) | const
| virtual

If this function returns false, unknown SRP/PSK identifiers will be rejected with an unknown_psk_identifier alert as soon as the non-existence is identified. Otherwise, a false identifier value will be used and the protocol allowed to proceed, causing the handshake to eventually fail without revealing that the username does not exist on this system.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 341 of file tls_policy.cpp.

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Text_Policy::hide_unknown_users(), print(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().

341 { return false; }

bool Botan::TLS::Policy::include_time_in_hello_random | ( |  | ) | const
| virtual

The protocol dictates that the first 32 bits of the random field are the current time in seconds. However this allows client fingerprinting attacks. Set to false to disable, in which case random bytes will be used instead.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 340 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::include_time_in_hello_random(), Botan::TLS::make_hello_random(), and print().

340 { return true; }

std::vector< Group_Params > Botan::TLS::Policy::key_exchange_groups | ( |  | ) | const
| virtual

Return list of ECC curves and FFDHE groups we are willing to use in order of preference.

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::BSI_TR_02102_2, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 162 of file tls_policy.cpp.

References Botan::TLS::BRAINPOOL256R1, Botan::TLS::BRAINPOOL384R1, Botan::TLS::BRAINPOOL512R1, Botan::TLS::FFDHE_2048, Botan::TLS::FFDHE_3072, Botan::TLS::FFDHE_4096, Botan::TLS::FFDHE_6144, Botan::TLS::FFDHE_8192, Botan::TLS::SECP256R1, Botan::TLS::SECP384R1, Botan::TLS::SECP521R1, and Botan::TLS::X25519.

Referenced by choose_key_exchange_group(), ciphersuite_list(), Botan::TLS::Client_Hello::Client_Hello(), default_dh_group(), Botan::TLS::Text_Policy::key_exchange_groups(), and print().

163 {
164 // Default list is ordered by performance
165 return {
166
167 #if defined(BOTAN_HAS_CURVE_25519)
168 Group_Params::X25519,
169 #endif
170
171 Group_Params::SECP256R1,
172 Group_Params::BRAINPOOL256R1,
173 Group_Params::SECP384R1,
174 Group_Params::BRAINPOOL384R1,
175 Group_Params::SECP521R1,
176 Group_Params::BRAINPOOL512R1,
177
178 Group_Params::FFDHE_2048,
179 Group_Params::FFDHE_3072,
180 Group_Params::FFDHE_4096,
181 Group_Params::FFDHE_6144,
182 Group_Params::FFDHE_8192,
183 };
184 }
Botan::TLS::Group_Params::BRAINPOOL256R1
Botan::TLS::Group_Params::SECP521R1
Botan::TLS::Group_Params::SECP256R1
Botan::TLS::Group_Params::X25519
Botan::TLS::Group_Params::BRAINPOOL512R1
Botan::TLS::Group_Params::FFDHE_4096
Botan::TLS::Group_Params::SECP384R1
Botan::TLS::Group_Params::FFDHE_6144
Botan::TLS::Group_Params::FFDHE_2048
Botan::TLS::Group_Params::BRAINPOOL384R1
Botan::TLS::Group_Params::FFDHE_3072
Botan::TLS::Group_Params::FFDHE_8192

Protocol_Version Botan::TLS::Policy::latest_supported_version | ( | bool | datagram | ) | const
| virtual

Returns the more recent protocol version we are willing to use, for either TLS or DTLS depending on datagram param. Shouldn't ever need to override this unless you want to allow a user to disable use of TLS v1.2 (which is not recommended)

Definition at line 300 of file tls_policy.cpp.

References acceptable_protocol_version(), Botan::TLS::Protocol_Version::DTLS_V10, Botan::TLS::Protocol_Version::DTLS_V12, Botan::TLS::Protocol_Version::TLS_V10, Botan::TLS::Protocol_Version::TLS_V11, and Botan::TLS::Protocol_Version::TLS_V12.

Referenced by send_fallback_scsv().

301 {
302 if(datagram)
303 {
304 if(acceptable_protocol_version(Protocol_Version::DTLS_V12))
305 return Protocol_Version::DTLS_V12;
306 #if defined(BOTAN_HAS_TLS_V10)
307 if(acceptable_protocol_version(Protocol_Version::DTLS_V10))
308 return Protocol_Version::DTLS_V10;
309 #endif
310 throw Invalid_State("Policy forbids all available DTLS version");
311 }
312 else
313 {
314 if(acceptable_protocol_version(Protocol_Version::TLS_V12))
315 return Protocol_Version::TLS_V12;
316 #if defined(BOTAN_HAS_TLS_V10)
317 if(acceptable_protocol_version(Protocol_Version::TLS_V11))
318 return Protocol_Version::TLS_V11;
319 if(acceptable_protocol_version(Protocol_Version::TLS_V10))
320 return Protocol_Version::TLS_V10;
321 #endif
322 throw Invalid_State("Policy forbids all available TLS version");
323 }
324 }
Botan::TLS::Protocol_Version::DTLS_V12
Definition: tls_version.h:30
Botan::TLS::Protocol_Version::DTLS_V10
Definition: tls_version.h:29
Botan::TLS::Protocol_Version::TLS_V11
Definition: tls_version.h:26
Botan::TLS::Policy::acceptable_protocol_version
virtual bool acceptable_protocol_version(Protocol_Version version) const
Definition: tls_policy.cpp:278
Botan::TLS::Protocol_Version::TLS_V12
Definition: tls_version.h:27
Botan::TLS::Protocol_Version::TLS_V10
Definition: tls_version.h:25

size_t Botan::TLS::Policy::maximum_certificate_chain_size | ( |  | ) | const
| virtual

Returns
  the maximum size of the certificate chain, in bytes. Return 0 to disable this and accept any size.

Definition at line 352 of file tls_policy.cpp.

Referenced by Botan::TLS::Certificate::Certificate().

352 { return 0; }

size_t Botan::TLS::Policy::minimum_dh_group_size | ( |  | ) | const
| virtual

Return the minimum DH group size we're willing to use Default is currently 1024 (insecure), should be 2048

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 186 of file tls_policy.cpp.

Referenced by check_peer_key_acceptable(), Botan::TLS::Text_Policy::minimum_dh_group_size(), and print().

187 {
188 return 2048;
189 }

size_t Botan::TLS::Policy::minimum_dsa_group_size | ( |  | ) | const
| virtual

Minimum DSA group size, default 2048 bits

Reimplemented in Botan::TLS::BSI_TR_02102_2.

Definition at line 225 of file tls_policy.cpp.

Referenced by check_peer_key_acceptable().

226 {
227 // FIPS 186-3
228 return 2048;
229 }

size_t Botan::TLS::Policy::minimum_ecdh_group_size | ( |  | ) | const
| virtual

Return the minimum ECDH group size we're willing to use for key exchange

Default 255, allowing x25519 and larger x25519 is the smallest curve we will negotiate P-521 is the largest

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 197 of file tls_policy.cpp.

Referenced by check_peer_key_acceptable(), Botan::TLS::Text_Policy::minimum_ecdh_group_size(), and print().

198 {
199 // x25519 is smallest curve currently supported for TLS key exchange
200 return 255;
201 }

size_t Botan::TLS::Policy::minimum_ecdsa_group_size | ( |  | ) | const
| virtual

For ECDSA authenticated ciphersuites, the smallest key size the client will accept. This policy is currently only enforced on the server by the client.

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 191 of file tls_policy.cpp.

Referenced by check_peer_key_acceptable(), and Botan::TLS::Text_Policy::minimum_ecdsa_group_size().

192 {
193 // Here we are at the mercy of whatever the CA signed, but most certs should be 256 bit by now
194 return 256;
195 }

size_t Botan::TLS::Policy::minimum_rsa_bits | ( |  | ) | const
| virtual

Return the minimum bit size we're willing to accept for RSA key exchange or server signatures.

It does not place any requirements on the size of any RSA signature(s) which were used to check the server certificate. This is only concerned with the server's public key.

Default is 2048 which is smallest RSA key size still secure for medium term security.

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 213 of file tls_policy.cpp.

Referenced by check_peer_key_acceptable(), Botan::TLS::Text_Policy::minimum_rsa_bits(), and print().

214 {
215 /* Default assumption is all end-entity certificates should
216 be at least 2048 bits these days.
217
218 If you are connecting to arbitrary servers on the Internet
219 (ie as a web browser or SMTP client) you'll probably have to reduce this
220 to 1024 bits, or perhaps even lower.
221 */
222 return 2048;
223 }

size_t Botan::TLS::Policy::minimum_signature_strength | ( |  | ) | const
| virtual

The minimum signature strength we will accept Returning 80 allows RSA 1024 and SHA-1. Values larger than 80 disable SHA-1 support. Returning 110 allows RSA 2048. Return 128 to force ECC (P-256) or large (~3000 bit) RSA keys. Default is 110

Reimplemented in Botan::TLS::Text_Policy, Botan::TLS::NSA_Suite_B_192, and Botan::TLS::NSA_Suite_B_128.

Definition at line 203 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::minimum_signature_strength(), print(), and Botan::TLS::Callbacks::tls_verify_cert_chain().

204 {
205 return 110;
206 }

bool Botan::TLS::Policy::negotiate_encrypt_then_mac | ( |  | ) | const
| virtual

Indicates whether the encrypt-then-MAC extension should be negotiated (RFC 7366)

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 343 of file tls_policy.cpp.

Referenced by Botan::TLS::Client_Hello::Client_Hello(), Botan::TLS::Text_Policy::negotiate_encrypt_then_mac(), print(), and Botan::TLS::Server_Hello::Server_Hello().

343 { return true; }

bool Botan::TLS::Policy::only_resume_with_exact_version | ( |  | ) | const
| virtual

Definition at line 346 of file tls_policy.cpp.

346 { return true; }

void Botan::TLS::Policy::print | ( | std::ostream & | o | ) | const
| virtual

Convert this policy to a printable format.

Parameters

  o | stream to be printed to

Definition at line 553 of file tls_policy.cpp.

References allow_dtls10(), allow_dtls12(), allow_insecure_renegotiation(), allow_server_initiated_renegotiation(), allow_tls10(), allow_tls11(), allow_tls12(), allowed_ciphers(), allowed_key_exchange_methods(), allowed_macs(), allowed_signature_hashes(), allowed_signature_methods(), hide_unknown_users(), include_time_in_hello_random(), key_exchange_groups(), minimum_dh_group_size(), minimum_ecdh_group_size(), minimum_rsa_bits(), minimum_signature_strength(), negotiate_encrypt_then_mac(), server_uses_own_ciphersuite_preferences(), session_ticket_lifetime(), and support_cert_status_message().

Referenced by to_string().

554 {
555 print_bool(o, "allow_tls10", allow_tls10());
556 print_bool(o, "allow_tls11", allow_tls11());
557 print_bool(o, "allow_tls12", allow_tls12());
558 print_bool(o, "allow_dtls10", allow_dtls10());
559 print_bool(o, "allow_dtls12", allow_dtls12());
560 print_vec(o, "ciphers", allowed_ciphers());
561 print_vec(o, "macs", allowed_macs());
562 print_vec(o, "signature_hashes", allowed_signature_hashes());
563 print_vec(o, "signature_methods", allowed_signature_methods());
564 print_vec(o, "key_exchange_methods", allowed_key_exchange_methods());
565 print_vec(o, "key_exchange_groups", key_exchange_groups());
566
567 print_bool(o, "allow_insecure_renegotiation", allow_insecure_renegotiation());
568 print_bool(o, "include_time_in_hello_random", include_time_in_hello_random());
569 print_bool(o, "allow_server_initiated_renegotiation", allow_server_initiated_renegotiation());
570 print_bool(o, "hide_unknown_users", hide_unknown_users());
571 print_bool(o, "server_uses_own_ciphersuite_preferences", server_uses_own_ciphersuite_preferences());
572 print_bool(o, "negotiate_encrypt_then_mac", negotiate_encrypt_then_mac());
573 print_bool(o, "support_cert_status_message", support_cert_status_message());
574 o << "session_ticket_lifetime = " << session_ticket_lifetime() << '\n';
575 o << "minimum_dh_group_size = " << minimum_dh_group_size() << '\n';
576 o << "minimum_ecdh_group_size = " << minimum_ecdh_group_size() << '\n';
577 o << "minimum_rsa_bits = " << minimum_rsa_bits() << '\n';
578 o << "minimum_signature_strength = " << minimum_signature_strength() << '\n';
579 }
Botan::TLS::Policy::allowed_ciphers
virtual std::vector< std::string > allowed_ciphers() const
Definition: tls_policy.cpp:42
Botan::TLS::Policy::minimum_dh_group_size
virtual size_t minimum_dh_group_size() const
Definition: tls_policy.cpp:186
Botan::TLS::Policy::allow_insecure_renegotiation
virtual bool allow_insecure_renegotiation() const
Definition: tls_policy.cpp:334
Botan::TLS::Policy::support_cert_status_message
virtual bool support_cert_status_message() const
Definition: tls_policy.cpp:344
Botan::TLS::Policy::allowed_signature_methods
virtual std::vector< std::string > allowed_signature_methods() const
Definition: tls_policy.cpp:106
Botan::TLS::Policy::server_uses_own_ciphersuite_preferences
virtual bool server_uses_own_ciphersuite_preferences() const
Definition: tls_policy.cpp:342
Botan::TLS::Policy::minimum_ecdh_group_size
virtual size_t minimum_ecdh_group_size() const
Definition: tls_policy.cpp:197
Botan::TLS::Policy::hide_unknown_users
virtual bool hide_unknown_users() const
Definition: tls_policy.cpp:341
Botan::TLS::Policy::key_exchange_groups
virtual std::vector< Group_Params > key_exchange_groups() const
Definition: tls_policy.cpp:162
Botan::TLS::Policy::allow_server_initiated_renegotiation
virtual bool allow_server_initiated_renegotiation() const
Definition: tls_policy.cpp:333
Botan::TLS::Policy::allowed_signature_hashes
virtual std::vector< std::string > allowed_signature_hashes() const
Definition: tls_policy.cpp:67
Botan::TLS::Policy::minimum_rsa_bits
virtual size_t minimum_rsa_bits() const
Definition: tls_policy.cpp:213
Botan::TLS::Policy::session_ticket_lifetime
virtual uint32_t session_ticket_lifetime() const
Definition: tls_policy.cpp:268
Botan::TLS::Policy::allow_tls10
virtual bool allow_tls10() const
Definition: tls_policy.cpp:335
Botan::TLS::Policy::minimum_signature_strength
virtual size_t minimum_signature_strength() const
Definition: tls_policy.cpp:203
Botan::TLS::Policy::allow_dtls12
virtual bool allow_dtls12() const
Definition: tls_policy.cpp:339
Botan::TLS::Policy::allow_dtls10
virtual bool allow_dtls10() const
Definition: tls_policy.cpp:338
Botan::TLS::Policy::include_time_in_hello_random
virtual bool include_time_in_hello_random() const
Definition: tls_policy.cpp:340
Botan::TLS::Policy::allowed_key_exchange_methods
virtual std::vector< std::string > allowed_key_exchange_methods() const
Definition: tls_policy.cpp:92
Botan::TLS::Policy::allow_tls11
virtual bool allow_tls11() const
Definition: tls_policy.cpp:336
Botan::TLS::Policy::allowed_macs
virtual std::vector< std::string > allowed_macs() const
Definition: tls_policy.cpp:77
Botan::TLS::Policy::negotiate_encrypt_then_mac
virtual bool negotiate_encrypt_then_mac() const
Definition: tls_policy.cpp:343
Botan::TLS::Policy::allow_tls12
virtual bool allow_tls12() const
Definition: tls_policy.cpp:337

bool Botan::TLS::Policy::request_client_certificate_authentication | ( |  | ) | const
| virtual

Indicate if client certificate authentication is requested. If true, then a cert will be requested.

Definition at line 348 of file tls_policy.cpp.

References require_client_certificate_authentication().

348 { return require_client_certificate_authentication(); }
Botan::TLS::Policy::require_client_certificate_authentication
virtual bool require_client_certificate_authentication() const
Definition: tls_policy.cpp:347

bool Botan::TLS::Policy::require_cert_revocation_info | ( |  | ) | const
| virtual

Return if cert revocation info (CRL/OCSP) is required If true, validation will fail unless a valid CRL or OCSP response was examined.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 208 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::require_cert_revocation_info(), and Botan::TLS::Callbacks::tls_verify_cert_chain().

209 {
210 return true;
211 }

bool Botan::TLS::Policy::require_client_certificate_authentication | ( |  | ) | const
| virtual

Indicate if client certificate authentication is required. If true, then a cert will be requested and if the client does not send a certificate the connection will be closed.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 347 of file tls_policy.cpp.

Referenced by request_client_certificate_authentication(), and Botan::TLS::Text_Policy::require_client_certificate_authentication().

347 { return false; }

bool Botan::TLS::Policy::send_fallback_scsv | ( | Protocol_Version | version | ) | const
| virtual

When offering this version, should we send a fallback SCSV? Default returns true iff version is not the latest version the policy allows, exists to allow override in case of interop problems.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 273 of file tls_policy.cpp.

References Botan::TLS::Protocol_Version::is_datagram_protocol(), and latest_supported_version().

Referenced by Botan::TLS::Client_Hello::Client_Hello(), and Botan::TLS::Text_Policy::send_fallback_scsv().

274 {
275 return version != latest_supported_version(version.is_datagram_protocol());
276 }
Botan::TLS::Policy::latest_supported_version
virtual Protocol_Version latest_supported_version(bool datagram) const
Definition: tls_policy.cpp:300

bool Botan::TLS::Policy::server_uses_own_ciphersuite_preferences | ( |  | ) | const
| virtual

Returns
  true if servers should choose the ciphersuite matching their highest preference, rather than the clients. Has no effect on client side.

Reimplemented in Botan::TLS::Text_Policy, and Botan::TLS::BSI_TR_02102_2.

Definition at line 342 of file tls_policy.cpp.

Referenced by print(), and Botan::TLS::Text_Policy::server_uses_own_ciphersuite_preferences().

342 { return true; }

uint32_t Botan::TLS::Policy::session_ticket_lifetime | ( |  | ) | const
| virtual

Return the allowed lifetime of a session ticket. If 0, session tickets do not expire until the session ticket key rolls over. Expired session tickets cannot be used to resume a session.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 268 of file tls_policy.cpp.

Referenced by print(), and Botan::TLS::Text_Policy::session_ticket_lifetime().

269 {
270 return 86400; // ~1 day
271 }

std::vector< uint16_t > Botan::TLS::Policy::srtp_profiles | ( |  | ) | const
| virtual

If this returns a non-empty vector, and DTLS is negotiated, then we will also attempt to negotiate the SRTP extension from RFC 5764 using the returned values as the profile ids.

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 364 of file tls_policy.cpp.

Referenced by Botan::TLS::Client_Hello::Client_Hello(), and Botan::TLS::Server_Hello::Server_Hello().

365 {
366 return std::vector<uint16_t>();
367 }

bool Botan::TLS::Policy::support_cert_status_message | ( |  | ) | const
| virtual

Indicates whether certificate status messages should be supported

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 344 of file tls_policy.cpp.

Referenced by Botan::TLS::Client_Hello::Client_Hello(), print(), Botan::TLS::Server_Hello::Server_Hello(), and Botan::TLS::Text_Policy::support_cert_status_message().

344 { return true; }

std::string Botan::TLS::Policy::to_string | ( |  | ) | const

Convert this policy to a printable format. Same as calling `print` on a ostringstream and reading o.str()

Definition at line 581 of file tls_policy.cpp.

References print().

582 {
583 std::ostringstream oss;
584 this->print(oss);
585 return oss.str();
586 }
Botan::TLS::Policy::print
virtual void print(std::ostream &o) const
Definition: tls_policy.cpp:553

bool Botan::TLS::Policy::use_ecc_point_compression | ( |  | ) | const
| virtual

Request that ECC curve points are sent compressed

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 127 of file tls_policy.cpp.

Referenced by Botan::TLS::Client_Hello::Client_Hello(), Botan::TLS::Server_Hello::Server_Hello(), and Botan::TLS::Text_Policy::use_ecc_point_compression().

128 {
129 return false;
130 }

The documentation for this class was generated from the following files:

- src/lib/tls/tls_policy.h
- src/lib/tls/tls_policy.cpp