Botan 2.1.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::BSI_TR_02102_2 Class Reference

`#include <tls_policy.h>`

Inheritance diagram for Botan::TLS::BSI_TR_02102_2:

## Public Member Functions
virtual bool | acceptable_ciphersuite (const Ciphersuite &suite) const
virtual bool | acceptable_protocol_version (Protocol_Version version) const
bool | allow_dtls10 () const override
bool | allow_dtls12 () const override
bool | allow_insecure_renegotiation () const override
bool | allow_server_initiated_renegotiation () const override
bool | allow_tls10 () const override
bool | allow_tls11 () const override
bool | allow_tls12 () const override
std::vector< std::string > | allowed_ciphers () const override
bool | allowed_ecc_curve (const std::string &curve) const
std::vector< std::string > | allowed_ecc_curves () const override
std::vector< std::string > | allowed_key_exchange_methods () const override
std::vector< std::string > | allowed_macs () const override
std::vector< std::string > | allowed_signature_hashes () const override
bool | allowed_signature_method (const std::string &sig_method) const
std::vector< std::string > | allowed_signature_methods () const override
virtual void | check_peer_key_acceptable (const Public_Key &public_key) const
virtual std::string | choose_curve (const std::vector< std::string > &curve_names) const
virtual std::vector< uint16_t > | ciphersuite_list (Protocol_Version version, bool have_srp) const
virtual std::vector< uint8_t > | compression () const
virtual std::string | 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 Protocol_Version | latest_supported_version (bool datagram) const
size_t | minimum_dh_group_size () const override
size_t | minimum_dsa_group_size () const override
size_t | minimum_ecdh_group_size () const override
size_t | minimum_ecdsa_group_size () const override
size_t | minimum_rsa_bits () const override
virtual size_t | minimum_signature_strength () const
bool | negotiate_encrypt_then_mac () const override
virtual void | print (std::ostream &o) const
virtual bool | require_cert_revocation_info () const
virtual bool | send_fallback_scsv (Protocol_Version version) const
bool | server_uses_own_ciphersuite_preferences () const override
virtual uint32_t | session_ticket_lifetime () const
virtual std::vector< uint16_t > | srtp_profiles () const
std::string | to_string () const
virtual bool | use_ecc_point_compression () const

## Detailed Description

BSI TR-02102-2 Policy

Definition at line 339 of file tls_policy.h.

## Member Function Documentation

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

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

Definition at line 264 of file tls_policy.cpp.

Referenced by Botan::TLS::Policy::ciphersuite_list().

265 {
266 return true;
267 }

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

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 241 of file tls_policy.cpp.

References Botan::TLS::Policy::allow_dtls10(), Botan::TLS::Policy::allow_dtls12(), Botan::TLS::Policy::allow_tls10(), Botan::TLS::Policy::allow_tls11(), Botan::TLS::Policy::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().

242 {
243 // Uses boolean optimization:
244 // First check the current version (left part), then if it is allowed
245 // (right part)
246 // checks are ordered according to their probability
247 return (
248 ( ( version == Protocol_Version::TLS_V12) && allow_tls12() ) ||
249 ( ( version == Protocol_Version::TLS_V10) && allow_tls10() ) ||
250 ( ( version == Protocol_Version::TLS_V11) && allow_tls11() ) ||
251 ( ( version == Protocol_Version::DTLS_V12) && allow_dtls12() ) ||
252 ( ( version == Protocol_Version::DTLS_V10) && allow_dtls10() )
253 );
254 }
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:271
Botan::TLS::Policy::allow_dtls12
virtual bool allow_dtls12() const
Definition: tls_policy.cpp:275
Botan::TLS::Policy::allow_dtls10
virtual bool allow_dtls10() const
Definition: tls_policy.cpp:274
Botan::TLS::Policy::allow_tls11
virtual bool allow_tls11() const
Definition: tls_policy.cpp:272
Botan::TLS::Policy::allow_tls12
virtual bool allow_tls12() const
Definition: tls_policy.cpp:273

bool Botan::TLS::BSI_TR_02102_2::allow_dtls10 | ( |  | ) | const
| inline override virtual

Allow DTLS v1.0

Reimplemented from Botan::TLS::Policy.

Definition at line 387 of file tls_policy.h.

387 { return false; }

bool Botan::TLS::BSI_TR_02102_2::allow_dtls12 | ( |  | ) | const
| inline override virtual

Allow DTLS v1.2

Reimplemented from Botan::TLS::Policy.

Definition at line 388 of file tls_policy.h.

388 { return false; }

bool Botan::TLS::BSI_TR_02102_2::allow_insecure_renegotiation | ( |  | ) | const
| inline override 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 from Botan::TLS::Policy.

Definition at line 372 of file tls_policy.h.

372 { return false; }

bool Botan::TLS::BSI_TR_02102_2::allow_server_initiated_renegotiation | ( |  | ) | const
| inline override virtual

Allow servers to initiate a new handshake

Reimplemented from Botan::TLS::Policy.

Definition at line 373 of file tls_policy.h.

373 { return true; }

bool Botan::TLS::BSI_TR_02102_2::allow_tls10 | ( |  | ) | const
| inline override virtual

Allow TLS v1.0

Reimplemented from Botan::TLS::Policy.

Definition at line 384 of file tls_policy.h.

384 { return false; }

bool Botan::TLS::BSI_TR_02102_2::allow_tls11 | ( |  | ) | const
| inline override virtual

Allow TLS v1.1

Reimplemented from Botan::TLS::Policy.

Definition at line 385 of file tls_policy.h.

385 { return false; }

bool Botan::TLS::BSI_TR_02102_2::allow_tls12 | ( |  | ) | const
| inline override virtual

Allow TLS v1.2

Reimplemented from Botan::TLS::Policy.

Definition at line 386 of file tls_policy.h.

386 { return true; }

std::vector<std::string> Botan::TLS::BSI_TR_02102_2::allowed_ciphers | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 342 of file tls_policy.h.

343 {
344 return std::vector<std::string>({"AES-256/GCM", "AES-128/GCM", "AES-256", "AES-128" });
345 }

bool Botan::TLS::Policy::allowed_ecc_curve | ( | const std::string & | curve | ) | const
| inherited

Definition at line 111 of file tls_policy.cpp.

References Botan::TLS::Policy::allowed_ecc_curves(), and Botan::value_exists().

Referenced by Botan::TLS::Policy::ciphersuite_list(), and Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().

112 {
113 return value_exists(allowed_ecc_curves(), curve);
114 }
Botan::TLS::Policy::allowed_ecc_curves
virtual std::vector< std::string > allowed_ecc_curves() const
Definition: tls_policy.cpp:96
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::BSI_TR_02102_2::allowed_ecc_curves | ( |  | ) | const
| inline override virtual

Return list of ECC curves we are willing to use in order of preference

Reimplemented from Botan::TLS::Policy.

Definition at line 367 of file tls_policy.h.

368 {
369 return std::vector<std::string>({"brainpool512r1", "brainpool384r1", "brainpool256r1", "secp384r1", "secp256r1"});
370 }

std::vector<std::string> Botan::TLS::BSI_TR_02102_2::allowed_key_exchange_methods | ( |  | ) | const
| inline override 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 from Botan::TLS::Policy.

Definition at line 357 of file tls_policy.h.

358 {
359 return std::vector<std::string>({"ECDH", "DH", "PSK", "ECDHE_PSK", "DHE_PSK"});
360 }

std::vector<std::string> Botan::TLS::BSI_TR_02102_2::allowed_macs | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 352 of file tls_policy.h.

353 {
354 return std::vector<std::string>({"AEAD", "SHA-384", "SHA-256"});
355 }

std::vector<std::string> Botan::TLS::BSI_TR_02102_2::allowed_signature_hashes | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 347 of file tls_policy.h.

348 {
349 return std::vector<std::string>({"SHA-384", "SHA-256"});
350 }

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

Definition at line 91 of file tls_policy.cpp.

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

Referenced by Botan::TLS::Handshake_State::parse_sig_format().

92 {
93 return value_exists(allowed_signature_methods(), sig_method);
94 }
Botan::TLS::Policy::allowed_signature_methods
virtual std::vector< std::string > allowed_signature_methods() const
Definition: tls_policy.cpp:81
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::BSI_TR_02102_2::allowed_signature_methods | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 362 of file tls_policy.h.

363 {
364 return std::vector<std::string>({"ECDSA", "RSA", "DSA"});
365 }

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

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 186 of file tls_policy.cpp.

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

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

187 {
188 const std::string algo_name = public_key.algo_name();
189
190 const size_t keylength = public_key.key_length();
191 size_t expected_keylength = 0;
192
193 if(algo_name == "RSA")
194 {
195 expected_keylength = minimum_rsa_bits();
196 }
197 else if(algo_name == "DH")
198 {
199 expected_keylength = minimum_dh_group_size();
200 }
201 else if(algo_name == "DSA")
202 {
203 expected_keylength = minimum_dsa_group_size();
204 }
205 else if(algo_name == "ECDH" || algo_name == "Curve25519")
206 {
207 expected_keylength = minimum_ecdh_group_size();
208 }
209 else if(algo_name == "ECDSA")
210 {
211 expected_keylength = minimum_ecdsa_group_size();
212 }
213 // else some other algo, so leave expected_keylength as zero and the check is a no-op
214
215 if(keylength < expected_keylength)
216 throw TLS_Exception(Alert::INSUFFICIENT_SECURITY,
217 "Peer sent " +
218 std::to_string(keylength) + " bit " + algo_name + " key"
219 ", policy requires at least " +
220 std::to_string(expected_keylength));
221 }
Botan::TLS::Policy::minimum_dh_group_size
virtual size_t minimum_dh_group_size() const
Definition: tls_policy.cpp:141
Botan::ASN1::to_string
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:47
Botan::TLS::Policy::minimum_ecdh_group_size
virtual size_t minimum_ecdh_group_size() const
Definition: tls_policy.cpp:152
Botan::TLS::Policy::minimum_dsa_group_size
virtual size_t minimum_dsa_group_size() const
Definition: tls_policy.cpp:180
Botan::TLS::Policy::minimum_ecdsa_group_size
virtual size_t minimum_ecdsa_group_size() const
Definition: tls_policy.cpp:146
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:168

std::string Botan::TLS::Policy::choose_curve | ( | const std::vector< std::string > & | curve_names | ) | const
| virtual inherited

Choose an elliptic curve to use

Definition at line 124 of file tls_policy.cpp.

References Botan::TLS::Policy::allowed_ecc_curves(), and Botan::value_exists().

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

125 {
126 const std::vector<std::string> our_curves = allowed_ecc_curves();
127
128 for(size_t i = 0; i != our_curves.size(); ++i)
129 if(value_exists(curve_names, our_curves[i]))
130 return our_curves[i];
131
132 return ""; // no shared curve
133 }
Botan::TLS::Policy::allowed_ecc_curves
virtual std::vector< std::string > allowed_ecc_curves() const
Definition: tls_policy.cpp:96
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 inherited

Return allowed ciphersuites, in order of preference

Definition at line 369 of file tls_policy.cpp.

References Botan::TLS::Policy::acceptable_ciphersuite(), Botan::TLS::Ciphersuite::all_known_ciphersuites(), Botan::TLS::Policy::allowed_ciphers(), Botan::TLS::Policy::allowed_ecc_curve(), Botan::TLS::Policy::allowed_key_exchange_methods(), Botan::TLS::Policy::allowed_macs(), Botan::TLS::Policy::allowed_signature_methods(), Botan::TLS::Protocol_Version::supports_aead_modes(), and Botan::value_exists().

371 {
372 const std::vector<std::string> ciphers = allowed_ciphers();
373 const std::vector<std::string> macs = allowed_macs();
374 const std::vector<std::string> kex = allowed_key_exchange_methods();
375 const std::vector<std::string> sigs = allowed_signature_methods();
376
377 std::vector<Ciphersuite> ciphersuites;
378
379 for(auto&& suite : Ciphersuite::all_known_ciphersuites())
380 {
381 // Can we use it?
382 if(suite.valid() == false)
383 continue;
384
385 // Is it acceptable to the policy?
386 if(!this->acceptable_ciphersuite(suite))
387 continue;
388
389 // Are we doing SRP?
390 if(!have_srp && suite.kex_algo() == "SRP_SHA")
391 continue;
392
393 if(!version.supports_aead_modes())
394 {
395 // Are we doing AEAD in a non-AEAD version?
396 if(suite.mac_algo() == "AEAD")
397 continue;
398
399 // Older (v1.0/v1.1) versions also do not support any hash but SHA-1
400 if(suite.mac_algo() != "SHA-1")
401 continue;
402 }
403
404 if(!value_exists(kex, suite.kex_algo()))
405 continue; // unsupported key exchange
406
407 if(!value_exists(ciphers, suite.cipher_algo()))
408 continue; // unsupported cipher
409
410 if(!value_exists(macs, suite.mac_algo()))
411 continue; // unsupported MAC algo
412
413 if(!value_exists(sigs, suite.sig_algo()))
414 {
415 // allow if it's an empty sig algo and we want to use PSK
416 if(suite.sig_algo() != "" || !suite.psk_ciphersuite())
417 continue;
418 }
419
420 /*
421 CECPQ1 always uses x25519 for ECDH, so treat the applications
422 removal of x25519 from the ECC curve list as equivalent to
423 saying they do not trust CECPQ1
424 */
425 if(suite.kex_algo() == "CECPQ1" && allowed_ecc_curve("x25519") == false)
426 continue;
427
428 // OK, consider it
429 ciphersuites.push_back(suite);
430 }
431
432 if(ciphersuites.empty())
433 {
434 throw Exception("Policy does not allow any available cipher suite");
435 }
436
437 Ciphersuite_Preference_Ordering order(ciphers, macs, kex, sigs);
438 std::sort(ciphersuites.begin(), ciphersuites.end(), order);
439
440 std::vector<uint16_t> ciphersuite_codes;
441 for(auto i : ciphersuites)
442 ciphersuite_codes.push_back(i.ciphersuite_code());
443 return ciphersuite_codes;
444 }
Botan::TLS::Policy::allowed_ciphers
virtual std::vector< std::string > allowed_ciphers() const
Definition: tls_policy.cpp:19
Botan::TLS::Policy::allowed_signature_methods
virtual std::vector< std::string > allowed_signature_methods() const
Definition: tls_policy.cpp:81
Botan::TLS::Policy::allowed_ecc_curve
bool allowed_ecc_curve(const std::string &curve) const
Definition: tls_policy.cpp:111
Botan::value_exists
bool value_exists(const std::vector< T > &vec, const T &val)
Definition: stl_util.h:86
Botan::TLS::Policy::acceptable_ciphersuite
virtual bool acceptable_ciphersuite(const Ciphersuite &suite) const
Definition: tls_policy.cpp:264
Botan::TLS::Policy::allowed_key_exchange_methods
virtual std::vector< std::string > allowed_key_exchange_methods() const
Definition: tls_policy.cpp:67
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:52

std::vector< uint8_t > Botan::TLS::Policy::compression | ( |  | ) | const
| virtual inherited

Returns a list of compression algorithms we are willing to use, in order of preference. Allowed values any value of Compression_Method.

Note
  Compression is not currently supported

Definition at line 226 of file tls_policy.cpp.

References Botan::TLS::NO_COMPRESSION.

227 {
228 return std::vector<uint8_t>{ NO_COMPRESSION };
229 }
Botan::TLS::NO_COMPRESSION
Definition: tls_magic.h:62

std::string Botan::TLS::Policy::dh_group | ( |  | ) | const
| virtual inherited

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 135 of file tls_policy.cpp.

Referenced by Botan::TLS::Text_Policy::dh_group(), Botan::TLS::Policy::print(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().

136 {
137 // We offer 2048 bit DH because we can
138 return "modp/ietf/2048";
139 }

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

Returns
  the default MTU for DTLS

Definition at line 285 of file tls_policy.cpp.

286 {
287 // default MTU is IPv6 min MTU minus UDP/IP headers
288 return 1280 - 40 - 8;
289 }

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

Returns
  the initial timeout for DTLS

Definition at line 282 of file tls_policy.cpp.

282 { return 1*1000; }

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

Returns
  the maximum timeout for DTLS

Definition at line 283 of file tls_policy.cpp.

283 { return 60*1000; }

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

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 277 of file tls_policy.cpp.

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

277 { return false; }

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

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 276 of file tls_policy.cpp.

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

276 { return true; }

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

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 256 of file tls_policy.cpp.

References Botan::TLS::Protocol_Version::latest_dtls_version(), and Botan::TLS::Protocol_Version::latest_tls_version().

Referenced by Botan::TLS::Policy::send_fallback_scsv().

257 {
258 if(datagram)
259 return Protocol_Version::latest_dtls_version();
260 else
261 return Protocol_Version::latest_tls_version();
262 }
Botan::TLS::Protocol_Version::latest_dtls_version
static Protocol_Version latest_dtls_version()
Definition: tls_version.h:44
Botan::TLS::Protocol_Version::latest_tls_version
static Protocol_Version latest_tls_version()
Definition: tls_version.h:36

size_t Botan::TLS::BSI_TR_02102_2::minimum_dh_group_size | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 378 of file tls_policy.h.

378 { return 2000; }

size_t Botan::TLS::BSI_TR_02102_2::minimum_dsa_group_size | ( |  | ) | const
| inline override virtual

Minimum DSA group size, default 2048 bits

Reimplemented from Botan::TLS::Policy.

Definition at line 379 of file tls_policy.h.

379 { return 2000; }

size_t Botan::TLS::BSI_TR_02102_2::minimum_ecdh_group_size | ( |  | ) | const
| inline override 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 from Botan::TLS::Policy.

Definition at line 381 of file tls_policy.h.

381 { return 250; }

size_t Botan::TLS::BSI_TR_02102_2::minimum_ecdsa_group_size | ( |  | ) | const
| inline override 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 from Botan::TLS::Policy.

Definition at line 382 of file tls_policy.h.

382 { return 250; }

size_t Botan::TLS::BSI_TR_02102_2::minimum_rsa_bits | ( |  | ) | const
| inline override 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 from Botan::TLS::Policy.

Definition at line 377 of file tls_policy.h.

377 { return 2000; }

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

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, and Botan::TLS::NSA_Suite_B_128.

Definition at line 158 of file tls_policy.cpp.

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

159 {
160 return 110;
161 }

bool Botan::TLS::BSI_TR_02102_2::negotiate_encrypt_then_mac | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 375 of file tls_policy.h.

375 { return true; }

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

Convert this policy to a printable format.

Parameters

  o | stream to be printed to

Definition at line 470 of file tls_policy.cpp.

References Botan::TLS::Policy::allow_dtls10(), Botan::TLS::Policy::allow_dtls12(), Botan::TLS::Policy::allow_insecure_renegotiation(), Botan::TLS::Policy::allow_server_initiated_renegotiation(), Botan::TLS::Policy::allow_tls10(), Botan::TLS::Policy::allow_tls11(), Botan::TLS::Policy::allow_tls12(), Botan::TLS::Policy::allowed_ciphers(), Botan::TLS::Policy::allowed_ecc_curves(), Botan::TLS::Policy::allowed_key_exchange_methods(), Botan::TLS::Policy::allowed_macs(), Botan::TLS::Policy::allowed_signature_hashes(), Botan::TLS::Policy::allowed_signature_methods(), Botan::TLS::Policy::dh_group(), Botan::TLS::Policy::hide_unknown_users(), Botan::TLS::Policy::include_time_in_hello_random(), Botan::TLS::Policy::minimum_dh_group_size(), Botan::TLS::Policy::minimum_ecdh_group_size(), Botan::TLS::Policy::minimum_rsa_bits(), Botan::TLS::Policy::minimum_signature_strength(), Botan::TLS::Policy::negotiate_encrypt_then_mac(), Botan::TLS::Policy::server_uses_own_ciphersuite_preferences(), and Botan::TLS::Policy::session_ticket_lifetime().

Referenced by Botan::TLS::Policy::to_string().

471 {
472 print_bool(o, "allow_tls10", allow_tls10());
473 print_bool(o, "allow_tls11", allow_tls11());
474 print_bool(o, "allow_tls12", allow_tls12());
475 print_bool(o, "allow_dtls10", allow_dtls10());
476 print_bool(o, "allow_dtls12", allow_dtls12());
477 print_vec(o, "ciphers", allowed_ciphers());
478 print_vec(o, "macs", allowed_macs());
479 print_vec(o, "signature_hashes", allowed_signature_hashes());
480 print_vec(o, "signature_methods", allowed_signature_methods());
481 print_vec(o, "key_exchange_methods", allowed_key_exchange_methods());
482 print_vec(o, "ecc_curves", allowed_ecc_curves());
483
484 print_bool(o, "allow_insecure_renegotiation", allow_insecure_renegotiation());
485 print_bool(o, "include_time_in_hello_random", include_time_in_hello_random());
486 print_bool(o, "allow_server_initiated_renegotiation", allow_server_initiated_renegotiation());
487 print_bool(o, "hide_unknown_users", hide_unknown_users());
488 print_bool(o, "server_uses_own_ciphersuite_preferences", server_uses_own_ciphersuite_preferences());
489 print_bool(o, "negotiate_encrypt_then_mac", negotiate_encrypt_then_mac());
490 o << "session_ticket_lifetime = " << session_ticket_lifetime() << '\n';
491 o << "dh_group = " << dh_group() << '\n';
492 o << "minimum_dh_group_size = " << minimum_dh_group_size() << '\n';
493 o << "minimum_ecdh_group_size = " << minimum_ecdh_group_size() << '\n';
494 o << "minimum_rsa_bits = " << minimum_rsa_bits() << '\n';
495 o << "minimum_signature_strength = " << minimum_signature_strength() << '\n';
496 }
Botan::TLS::Policy::allowed_ciphers
virtual std::vector< std::string > allowed_ciphers() const
Definition: tls_policy.cpp:19
Botan::TLS::Policy::minimum_dh_group_size
virtual size_t minimum_dh_group_size() const
Definition: tls_policy.cpp:141
Botan::TLS::Policy::allow_insecure_renegotiation
virtual bool allow_insecure_renegotiation() const
Definition: tls_policy.cpp:270
Botan::TLS::Policy::allowed_ecc_curves
virtual std::vector< std::string > allowed_ecc_curves() const
Definition: tls_policy.cpp:96
Botan::TLS::Policy::allowed_signature_methods
virtual std::vector< std::string > allowed_signature_methods() const
Definition: tls_policy.cpp:81
Botan::TLS::Policy::server_uses_own_ciphersuite_preferences
virtual bool server_uses_own_ciphersuite_preferences() const
Definition: tls_policy.cpp:278
Botan::TLS::Policy::minimum_ecdh_group_size
virtual size_t minimum_ecdh_group_size() const
Definition: tls_policy.cpp:152
Botan::TLS::Policy::hide_unknown_users
virtual bool hide_unknown_users() const
Definition: tls_policy.cpp:277
Botan::TLS::Policy::dh_group
virtual std::string dh_group() const
Definition: tls_policy.cpp:135
Botan::TLS::Policy::allow_server_initiated_renegotiation
virtual bool allow_server_initiated_renegotiation() const
Definition: tls_policy.cpp:269
Botan::TLS::Policy::allowed_signature_hashes
virtual std::vector< std::string > allowed_signature_hashes() const
Definition: tls_policy.cpp:42
Botan::TLS::Policy::minimum_rsa_bits
virtual size_t minimum_rsa_bits() const
Definition: tls_policy.cpp:168
Botan::TLS::Policy::session_ticket_lifetime
virtual uint32_t session_ticket_lifetime() const
Definition: tls_policy.cpp:231
Botan::TLS::Policy::allow_tls10
virtual bool allow_tls10() const
Definition: tls_policy.cpp:271
Botan::TLS::Policy::minimum_signature_strength
virtual size_t minimum_signature_strength() const
Definition: tls_policy.cpp:158
Botan::TLS::Policy::allow_dtls12
virtual bool allow_dtls12() const
Definition: tls_policy.cpp:275
Botan::TLS::Policy::allow_dtls10
virtual bool allow_dtls10() const
Definition: tls_policy.cpp:274
Botan::TLS::Policy::include_time_in_hello_random
virtual bool include_time_in_hello_random() const
Definition: tls_policy.cpp:276
Botan::TLS::Policy::allowed_key_exchange_methods
virtual std::vector< std::string > allowed_key_exchange_methods() const
Definition: tls_policy.cpp:67
Botan::TLS::Policy::allow_tls11
virtual bool allow_tls11() const
Definition: tls_policy.cpp:272
Botan::TLS::Policy::allowed_macs
virtual std::vector< std::string > allowed_macs() const
Definition: tls_policy.cpp:52
Botan::TLS::Policy::negotiate_encrypt_then_mac
virtual bool negotiate_encrypt_then_mac() const
Definition: tls_policy.cpp:279
Botan::TLS::Policy::allow_tls12
virtual bool allow_tls12() const
Definition: tls_policy.cpp:273

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

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

Definition at line 163 of file tls_policy.cpp.

Referenced by Botan::TLS::Callbacks::tls_verify_cert_chain().

164 {
165 return true;
166 }

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

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 236 of file tls_policy.cpp.

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

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

237 {
238 return version != latest_supported_version(version.is_datagram_protocol());
239 }
Botan::TLS::Policy::latest_supported_version
virtual Protocol_Version latest_supported_version(bool datagram) const
Definition: tls_policy.cpp:256

bool Botan::TLS::BSI_TR_02102_2::server_uses_own_ciphersuite_preferences | ( |  | ) | const
| inline override virtual

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

Reimplemented from Botan::TLS::Policy.

Definition at line 374 of file tls_policy.h.

374 { return true; }

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

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 231 of file tls_policy.cpp.

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

232 {
233 return 86400; // ~1 day
234 }

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

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 291 of file tls_policy.cpp.

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

292 {
293 return std::vector<uint16_t>();
294 }

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

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

Definition at line 498 of file tls_policy.cpp.

References Botan::TLS::Policy::print().

499 {
500 std::ostringstream oss;
501 this->print(oss);
502 return oss.str();
503 }
Botan::TLS::Policy::print
virtual void print(std::ostream &o) const
Definition: tls_policy.cpp:470

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

Request that ECC curve points are sent compressed

Reimplemented in Botan::TLS::Text_Policy.

Definition at line 116 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().

117 {
118 return false;
119 }

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

- src/lib/tls/tls_policy.h