• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 5079590438

25 May 2023 12:28PM UTC coverage: 92.228% (+0.5%) from 91.723%
5079590438

Pull #3502

github

Pull Request #3502: Apply clang-format to the codebase

75589 of 81959 relevant lines covered (92.23%)

12139530.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.41
/src/lib/tls/tls_policy.h
1
/*
2
* Hooks for application level policies on TLS connections
3
* (C) 2004-2006,2013 Jack Lloyd
4
*     2017 Harry Reimann, Rohde & Schwarz Cybersecurity
5
*     2022 René Meusel, Rohde & Schwarz Cybersecurity
6
*
7
* Botan is released under the Simplified BSD License (see license.txt)
8
*/
9

10
#ifndef BOTAN_TLS_POLICY_H_
11
#define BOTAN_TLS_POLICY_H_
12

13
#include <botan/tls_ciphersuite.h>
14
#include <botan/tls_signature_scheme.h>
15
#include <botan/tls_version.h>
16
#include <chrono>
17
#include <map>
18
#include <optional>
19
#include <vector>
20

21
namespace Botan {
22

23
class Public_Key;
24

25
namespace TLS {
26

27
/**
28
* TLS Policy Base Class
29
* Inherit and overload as desired to suit local policy concerns
30
*/
31
class BOTAN_PUBLIC_API(2, 0) Policy {
5,807✔
32
   public:
33
      /**
34
      * Returns a list of ciphers we are willing to negotiate, in
35
      * order of preference.
36
      */
37
      virtual std::vector<std::string> allowed_ciphers() const;
38

39
      /**
40
      * Returns a list of hash algorithms we are willing to use for
41
      * signatures, in order of preference.
42
      */
43
      virtual std::vector<std::string> allowed_signature_hashes() const;
44

45
      /**
46
      * Returns a list of MAC algorithms we are willing to use.
47
      */
48
      virtual std::vector<std::string> allowed_macs() const;
49

50
      /**
51
      * Returns a list of key exchange algorithms we are willing to
52
      * use, in order of preference. Allowed values: DH, empty string
53
      * (representing RSA using server certificate key)
54
      */
55
      virtual std::vector<std::string> allowed_key_exchange_methods() const;
56

57
      /**
58
      * Returns a list of signature algorithms we are willing to
59
      * use, in order of preference.
60
      */
61
      virtual std::vector<std::string> allowed_signature_methods() const;
62

63
      virtual std::vector<Signature_Scheme> allowed_signature_schemes() const;
64

65
      /**
66
      * Return a list of schemes we are willing to accept
67
      */
68
      virtual std::vector<Signature_Scheme> acceptable_signature_schemes() const;
69

70
      virtual std::optional<std::vector<Signature_Scheme>> acceptable_certificate_signature_schemes() const;
71

72
      /**
73
      * The minimum signature strength we will accept
74
      * Returning 80 allows RSA 1024 and SHA-1. Values larger than 80 disable SHA-1 support.
75
      * Returning 110 allows RSA 2048.
76
      * Return 128 to force ECC (P-256) or large (~3000 bit) RSA keys.
77
      * Default is 110
78
      */
79
      virtual size_t minimum_signature_strength() const;
80

81
      /**
82
      * Return if cert revocation info (CRL/OCSP) is required
83
      * If true, validation will fail unless a valid CRL or OCSP response
84
      * was examined.
85
      */
86
      virtual bool require_cert_revocation_info() const;
87

88
      bool allowed_signature_method(std::string_view sig_method) const;
89
      bool allowed_signature_hash(std::string_view hash) const;
90

91
      /**
92
      * Return list of ECC curves and FFDHE groups we are willing to
93
      * use in order of preference.
94
      */
95
      virtual std::vector<Group_Params> key_exchange_groups() const;
96

97
      /**
98
      * Return a list of groups to provide prepared key share offers in the
99
      * initial client hello for. Groups in this list must be reflected in
100
      * key_exchange_groups() and in the same order. By default this returns
101
      * the most preferred group from key_exchange_groups().
102
      * If an empty list is returned, no prepared key share offers are sent
103
      * and the decision of the group to use is left to the server.
104
      *
105
      * @note Has an effect on TLS 1.3 clients, only.
106
      */
107
      virtual std::vector<Group_Params> key_exchange_groups_to_offer() const;
108

109
      /**
110
      * Request that ECC curve points are sent compressed
111
      *
112
      * @note Has no effect for TLS 1.3 connections.
113
      *       RFC 8446 4.2.8.2
114
      *          Versions of TLS prior to 1.3 permitted point format
115
      *          negotiation; TLS 1.3 removes this feature in favor of a single
116
      *          point format for each curve.
117
      */
118
      virtual bool use_ecc_point_compression() const;
119

120
      /**
121
      * Select a key exchange group to use, from the list of groups sent by the
122
      * peer. In TLS 1.3 handshakes the peer might have provided cryptographic material
123
      * for a subset of its available groups. Choosing a group for which no share was
124
      * provided will result in an additional round trip. If none are acceptable, return
125
      * Group_Params::NONE.
126
      *
127
      * By default this will try to optimize for less round trips even if this results
128
      * in the usage of a less preferred group.
129
      */
130
      virtual Group_Params choose_key_exchange_group(const std::vector<Group_Params>& supported_by_peer,
131
                                                     const std::vector<Group_Params>& offered_by_peer) const;
132

133
      /**
134
      * Allow renegotiation even if the counterparty doesn't
135
      * support the secure renegotiation extension.
136
      *
137
      * @warning Changing this to true exposes you to injected
138
      *          plaintext attacks. Read RFC 5746 for background.
139
      *
140
      * @note Has no effect for TLS 1.3 connections.
141
      */
142
      virtual bool allow_insecure_renegotiation() const;
143

144
      /**
145
      * The protocol dictates that the first 32 bits of the random
146
      * field are the current time in seconds. However this allows
147
      * client fingerprinting attacks. Set to false to disable, in
148
      * which case random bytes will be used instead.
149
      */
150
      virtual bool include_time_in_hello_random() const;
151

152
      /**
153
      * Consulted by server side. If true, allows clients to initiate a new handshake
154
      *
155
      * @note Has no effect for TLS 1.3 connections.
156
      */
157
      virtual bool allow_client_initiated_renegotiation() const;
158

159
      /**
160
      * Consulted by client side. If true, allows servers to initiate a new handshake
161
      *
162
      * @note Has no effect for TLS 1.3 connections.
163
      */
164
      virtual bool allow_server_initiated_renegotiation() const;
165

166
      /**
167
      * If true, a request to renegotiate will close the connection with
168
      * a fatal alert. Otherwise, a warning alert is sent.
169
      *
170
      * @note Has no effect for TLS 1.3 connections.
171
      */
172
      virtual bool abort_connection_on_undesired_renegotiation() const;
173

174
      virtual bool only_resume_with_exact_version() const;
175

176
      /**
177
      * Allow TLS v1.2
178
      */
179
      virtual bool allow_tls12() const;
180

181
      /**
182
      * Allow TLS v1.3
183
      */
184
      virtual bool allow_tls13() const;
185

186
      /**
187
      * Allow DTLS v1.2
188
      */
189
      virtual bool allow_dtls12() const;
190

191
      /**
192
      * @note Has no effect for TLS 1.3 connections.
193
      */
194
      virtual Group_Params default_dh_group() const;
195

196
      /**
197
      * Return the minimum DH group size we're willing to use
198
      * Default is currently 1024 (insecure), should be 2048
199
      */
200
      virtual size_t minimum_dh_group_size() const;
201

202
      /**
203
      * For ECDSA authenticated ciphersuites, the smallest key size the
204
      * client will accept.
205
      * This policy is currently only enforced on the server by the client.
206
      */
207
      virtual size_t minimum_ecdsa_group_size() const;
208

209
      /**
210
      * Return the minimum ECDH group size we're willing to use
211
      * for key exchange
212
      *
213
      * Default 255, allowing x25519 and larger
214
      * x25519 is the smallest curve we will negotiate
215
      * P-521 is the largest
216
      */
217
      virtual size_t minimum_ecdh_group_size() const;
218

219
      /**
220
      * Return the minimum bit size we're willing to accept for RSA
221
      * key exchange or server signatures.
222
      *
223
      * It does not place any requirements on the size of any RSA signature(s)
224
      * which were used to check the server certificate. This is only
225
      * concerned with the server's public key.
226
      *
227
      * Default is 2048 which is smallest RSA key size still secure
228
      * for medium term security.
229
      */
230
      virtual size_t minimum_rsa_bits() const;
231

232
      /**
233
      * Throw an exception if you don't like the peer's key.
234
      * Default impl checks the key size against minimum_rsa_bits, minimum_ecdsa_group_size,
235
      * or minimum_ecdh_group_size depending on the key's type.
236
      * Override if you'd like to perform some other kind of test on
237
      * (or logging of) the peer's keys.
238
      */
239
      virtual void check_peer_key_acceptable(const Public_Key& public_key) const;
240

241
      /**
242
      * If this function returns false, unknown PSK identifiers
243
      * will be rejected with an unknown_psk_identifier alert as soon
244
      * as the non-existence is identified. Otherwise, a false
245
      * identifier value will be used and the protocol allowed to
246
      * proceed, causing the handshake to eventually fail without
247
      * revealing that the username does not exist on this system.
248
      */
249
      virtual bool hide_unknown_users() const;
250

251
      /**
252
      * Defines the maximum number of session tickets a client might
253
      * offer in a single resumption attempt. Must be greater than 0.
254
      *
255
      * TODO: Currently, the TLS 1.3 client implementation supports
256
      *       exactly one ticket per handshake. RFC 8446 allows for
257
      *       an arbitrary amount, though.
258
      *
259
      * @note Has an effect on TLS 1.3 connections, only.
260
      */
261
      virtual size_t maximum_session_tickets_per_client_hello() const;
262

263
      /**
264
      * Return the allowed lifetime of a session ticket. If 0, session
265
      * tickets do not expire until the session ticket key rolls over.
266
      * For TLS 1.3 session tickets the lifetime must not be longer than
267
      * seven days. Expired session tickets cannot be used to resume a
268
      * session.
269
      */
270
      virtual std::chrono::seconds session_ticket_lifetime() const;
271

272
      /**
273
       * Decides whether stored session tickets should be used multiple
274
       * times (until their lifetime runs out). This might allow passive
275
       * observers to correlate connections (RFC 8446 Appendix C.4). This
276
       * has no effect on TLS 1.2 resumptions based on session IDs as those
277
       * are negotiated in the clear anyway.
278
       */
279
      virtual bool reuse_session_tickets() const;
280

281
      /**
282
      * Return the number of new session tickets a TLS 1.3 server should issue
283
      * automatically upon a successful handshake. Note that applications can
284
      * use `TLS::Server::send_new_session_tickets()` regardless of this policy.
285
      *
286
      * For convenience (and compatibility with the TLS 1.2 behaviour), this
287
      * returns '1' by default.
288
      *
289
      * @note Has an effect on TLS 1.3 connections, only.
290
      */
291
      virtual size_t new_session_tickets_upon_handshake_success() const;
292

293
      /**
294
      * If this returns a non-empty vector, and DTLS is negotiated,
295
      * then we will also attempt to negotiate the SRTP extension from
296
      * RFC 5764 using the returned values as the profile ids.
297
      */
298
      virtual std::vector<uint16_t> srtp_profiles() const;
299

300
      /**
301
      * @return true if and only if we are willing to accept this version
302
      * Default accepts TLS v1.2 and later or DTLS v1.2 or later.
303
      */
304
      virtual bool acceptable_protocol_version(Protocol_Version version) const;
305

306
      /**
307
      * Returns the most recent protocol version we are willing to
308
      * use, for either TLS or DTLS depending on datagram param.
309
      * Shouldn't ever need to override this unless you want to allow
310
      * a user to disable specific TLS versions.
311
      */
312
      virtual Protocol_Version latest_supported_version(bool datagram) const;
313

314
      /**
315
      * Allows policy to reject any ciphersuites which are undesirable
316
      * for whatever reason without having to reimplement ciphersuite_list
317
      */
318
      virtual bool acceptable_ciphersuite(const Ciphersuite& suite) const;
319

320
      /**
321
      * @return true if servers should choose the ciphersuite matching
322
      *         their highest preference, rather than the clients.
323
      *         Has no effect on client side.
324
      */
325
      virtual bool server_uses_own_ciphersuite_preferences() const;
326

327
      /**
328
      * Indicates whether the encrypt-then-MAC extension should be negotiated
329
      * (RFC 7366)
330
      *
331
      * @note Has no effect for TLS 1.3 connections.
332
      */
333
      virtual bool negotiate_encrypt_then_mac() const;
334

335
      /**
336
       * Defines the maximum TLS record length for TLS connections.
337
       * This is based on the Record Size Limit extension described in RFC 8449.
338
       * By default (i.e. if std::nullopt is returned), TLS clients will omit
339
       * this extension altogether.
340
       *
341
       * This value may be between 64 and 16385 (TLS 1.3) or 16384 (TLS 1.2).
342
       *
343
       * @note This is currently not implemented for TLS 1.2, hence the limit
344
       *       won't be negotiated by TLS 1.3 clients that support downgrading
345
       *       to TLS 1.2 (i.e. ::allow_tls12() returning true).
346
       */
347
      virtual std::optional<uint16_t> record_size_limit() const;
348

349
      /**
350
      * Indicates whether certificate status messages should be supported
351
      */
352
      virtual bool support_cert_status_message() const;
353

354
      /**
355
      * Indicate if client certificate authentication is required.
356
      * If true, then a cert will be requested and if the client does
357
      * not send a certificate the connection will be closed.
358
      */
359
      virtual bool require_client_certificate_authentication() const;
360

361
      /**
362
      * Indicate if client certificate authentication is requested.
363
      * If true, then a cert will be requested.
364
      */
365
      virtual bool request_client_certificate_authentication() const;
366

367
      /**
368
      * If true, then allow a DTLS client to restart a connection to the
369
      * same server association as described in section 4.2.8 of the DTLS RFC
370
      */
371
      virtual bool allow_dtls_epoch0_restart() const;
372

373
      /**
374
      * Return allowed ciphersuites, in order of preference for the provided
375
      * protocol version.
376
      *
377
      * @param version  the exact protocol version to select supported and allowed
378
      *                 ciphersuites for
379
      */
380
      virtual std::vector<uint16_t> ciphersuite_list(Protocol_Version version) const;
381

382
      /**
383
      * @return the default MTU for DTLS
384
      */
385
      virtual size_t dtls_default_mtu() const;
386

387
      /**
388
      * @return the initial timeout for DTLS
389
      */
390
      virtual size_t dtls_initial_timeout() const;
391

392
      /**
393
      * @return the maximum timeout for DTLS
394
      */
395
      virtual size_t dtls_maximum_timeout() const;
396

397
      /**
398
      * @return the maximum size of the certificate chain, in bytes.
399
      * Return 0 to disable this and accept any size.
400
      */
401
      virtual size_t maximum_certificate_chain_size() const;
402

403
      /**
404
      * @note Has no effect for TLS 1.3 connections.
405
      */
406
      virtual bool allow_resumption_for_renegotiation() const;
407

408
      /**
409
      * Defines whether or not the middlebox compatibility mode should be
410
      * used. Enabled by default.
411
      *
412
      * RFC 8446 Appendix D.4
413
      *    [This makes] the TLS 1.3 handshake resemble TLS 1.2 session resumption,
414
      *    which improves the chance of successfully connecting through middleboxes.
415
      *
416
      * @note Has an effect on TLS 1.3 connections, only.
417
      */
418
      virtual bool tls_13_middlebox_compatibility_mode() const;
419

420
      /**
421
       * Hash the RNG output for the client/server hello random. This is a pre-caution
422
       * to avoid writing "raw" RNG output to the wire.
423
       *
424
       * There's not normally a reason to disable this, except when deterministic output
425
       * is required for testing.
426
       */
427
      virtual bool hash_hello_random() const;
428

429
      /**
430
      * Convert this policy to a printable format.
431
      * @param o stream to be printed to
432
      */
433
      virtual void print(std::ostream& o) const;
434

435
      /**
436
      * Convert this policy to a printable format.
437
      * Same as calling `print` on a ostringstream and reading o.str()
438
      */
439
      std::string to_string() const;
440

441
      virtual ~Policy() = default;
2,676✔
442
};
443

444
typedef Policy Default_Policy;
445

446
/**
447
* NSA Suite B 128-bit security level (RFC 6460)
448
*
449
* @warning As of August 2015 NSA indicated only the 192-bit Suite B
450
* should be used for all classification levels.
451
*/
452
class BOTAN_PUBLIC_API(2, 0) NSA_Suite_B_128 : public Policy {
3✔
453
   public:
454
      std::vector<std::string> allowed_ciphers() const override { return std::vector<std::string>({"AES-128/GCM"}); }
1,359✔
455

456
      std::vector<std::string> allowed_signature_hashes() const override {
77✔
457
         return std::vector<std::string>({"SHA-256"});
231✔
458
      }
459

460
      std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); }
108✔
461

462
      std::vector<std::string> allowed_key_exchange_methods() const override {
6✔
463
         return std::vector<std::string>({"ECDH"});
18✔
464
      }
465

466
      std::vector<std::string> allowed_signature_methods() const override {
80✔
467
         return std::vector<std::string>({"ECDSA"});
240✔
468
      }
469

470
      std::vector<Group_Params> key_exchange_groups() const override { return {Group_Params::SECP256R1}; }
10✔
471

472
      size_t minimum_signature_strength() const override { return 128; }
3✔
473

474
      bool allow_tls12() const override { return true; }
20✔
475

476
      bool allow_tls13() const override { return false; }
5✔
477

478
      bool allow_dtls12() const override { return false; }
1✔
479
};
480

481
/**
482
* NSA Suite B 192-bit security level (RFC 6460)
483
*/
484
class BOTAN_PUBLIC_API(2, 7) NSA_Suite_B_192 : public Policy {
2✔
485
   public:
486
      std::vector<std::string> allowed_ciphers() const override { return std::vector<std::string>({"AES-256/GCM"}); }
273✔
487

488
      std::vector<std::string> allowed_signature_hashes() const override {
1✔
489
         return std::vector<std::string>({"SHA-384"});
3✔
490
      }
491

492
      std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); }
24✔
493

494
      std::vector<std::string> allowed_key_exchange_methods() const override {
2✔
495
         return std::vector<std::string>({"ECDH"});
6✔
496
      }
497

498
      std::vector<std::string> allowed_signature_methods() const override {
2✔
499
         return std::vector<std::string>({"ECDSA"});
6✔
500
      }
501

502
      std::vector<Group_Params> key_exchange_groups() const override { return {Group_Params::SECP384R1}; }
2✔
503

504
      size_t minimum_signature_strength() const override { return 192; }
1✔
505

506
      bool allow_tls12() const override { return true; }
2✔
507

508
      bool allow_tls13() const override { return false; }
1✔
509

510
      bool allow_dtls12() const override { return false; }
1✔
511
};
512

513
/**
514
* BSI TR-02102-2 Policy
515
*/
516
class BOTAN_PUBLIC_API(2, 0) BSI_TR_02102_2 : public Policy {
1✔
517
   public:
518
      std::vector<std::string> allowed_ciphers() const override {
1✔
519
         return std::vector<std::string>(
1✔
520
            {"AES-256/GCM", "AES-128/GCM", "AES-256/CCM", "AES-128/CCM", "AES-256", "AES-128"});
8✔
521
      }
522

523
      std::vector<std::string> allowed_signature_hashes() const override {
1✔
524
         return std::vector<std::string>({"SHA-512", "SHA-384", "SHA-256"});
5✔
525
      }
526

527
      std::vector<std::string> allowed_macs() const override {
1✔
528
         return std::vector<std::string>({"AEAD", "SHA-384", "SHA-256"});
5✔
529
      }
530

531
      std::vector<std::string> allowed_key_exchange_methods() const override {
1✔
532
         return std::vector<std::string>({"ECDH", "DH", "ECDHE_PSK"});
5✔
533
      }
534

535
      std::vector<std::string> allowed_signature_methods() const override {
1✔
536
         return std::vector<std::string>({"ECDSA", "RSA", "DSA"});
5✔
537
      }
538

539
      std::vector<Group_Params> key_exchange_groups() const override {
2✔
540
         return std::vector<Group_Params>({Group_Params::BRAINPOOL512R1,
2✔
541
                                           Group_Params::BRAINPOOL384R1,
542
                                           Group_Params::BRAINPOOL256R1,
543
                                           Group_Params::SECP384R1,
544
                                           Group_Params::SECP256R1,
545
                                           Group_Params::FFDHE_4096,
546
                                           Group_Params::FFDHE_3072,
547
                                           Group_Params::FFDHE_2048});
2✔
548
      }
549

550
      bool allow_insecure_renegotiation() const override { return false; }
1✔
551

552
      bool allow_server_initiated_renegotiation() const override { return true; }
1✔
553

554
      bool server_uses_own_ciphersuite_preferences() const override { return true; }
1✔
555

556
      bool negotiate_encrypt_then_mac() const override { return true; }
1✔
557

558
      size_t minimum_rsa_bits() const override { return 2000; }
1✔
559

560
      size_t minimum_dh_group_size() const override { return 2000; }
1✔
561

562
      size_t minimum_ecdh_group_size() const override { return 250; }
1✔
563

564
      size_t minimum_ecdsa_group_size() const override { return 250; }
×
565

566
      bool allow_tls12() const override { return true; }
1✔
567

568
      bool allow_tls13() const override { return false; }
1✔
569

570
      bool allow_dtls12() const override { return false; }
1✔
571
};
572

573
/**
574
* Policy for DTLS. We require DTLS v1.2 and an AEAD mode.
575
*/
576
class BOTAN_PUBLIC_API(2, 0) Datagram_Policy : public Policy {
1✔
577
   public:
578
      std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); }
3✔
579

580
      bool allow_tls12() const override { return false; }
1✔
581

582
      bool allow_tls13() const override { return false; }
1✔
583

584
      bool allow_dtls12() const override { return true; }
1✔
585
};
586

587
/*
588
* This policy requires a secure version of TLS and disables all insecure
589
* algorithms. It is compatible with other botan TLSes (including those using the
590
* default policy) and with many other recent implementations. It is a great idea
591
* to use if you control both sides of the protocol and don't have to worry
592
* about ancient and/or bizarre TLS implementations.
593
*/
594
class BOTAN_PUBLIC_API(2, 0) Strict_Policy : public Policy {
3✔
595
   public:
596
      std::vector<std::string> allowed_ciphers() const override;
597

598
      std::vector<std::string> allowed_signature_hashes() const override;
599

600
      std::vector<std::string> allowed_macs() const override;
601

602
      std::vector<std::string> allowed_key_exchange_methods() const override;
603
};
604

605
class BOTAN_PUBLIC_API(2, 0) Text_Policy : public Policy {
65✔
606
   public:
607
      std::vector<std::string> allowed_ciphers() const override;
608

609
      std::vector<std::string> allowed_signature_hashes() const override;
610

611
      std::vector<std::string> allowed_macs() const override;
612

613
      std::vector<std::string> allowed_key_exchange_methods() const override;
614

615
      std::vector<std::string> allowed_signature_methods() const override;
616

617
      std::vector<Group_Params> key_exchange_groups() const override;
618

619
      std::vector<Group_Params> key_exchange_groups_to_offer() const override;
620

621
      bool use_ecc_point_compression() const override;
622

623
      bool allow_tls12() const override;
624

625
      bool allow_tls13() const override;
626

627
      bool allow_dtls12() const override;
628

629
      bool allow_insecure_renegotiation() const override;
630

631
      bool include_time_in_hello_random() const override;
632

633
      bool allow_client_initiated_renegotiation() const override;
634
      bool allow_server_initiated_renegotiation() const override;
635

636
      bool server_uses_own_ciphersuite_preferences() const override;
637

638
      bool negotiate_encrypt_then_mac() const override;
639

640
      std::optional<uint16_t> record_size_limit() const override;
641

642
      bool support_cert_status_message() const override;
643

644
      bool require_client_certificate_authentication() const override;
645

646
      size_t minimum_ecdh_group_size() const override;
647

648
      size_t minimum_ecdsa_group_size() const override;
649

650
      size_t minimum_dh_group_size() const override;
651

652
      size_t minimum_rsa_bits() const override;
653

654
      size_t minimum_signature_strength() const override;
655

656
      size_t dtls_default_mtu() const override;
657

658
      size_t dtls_initial_timeout() const override;
659

660
      size_t dtls_maximum_timeout() const override;
661

662
      bool require_cert_revocation_info() const override;
663

664
      bool hide_unknown_users() const override;
665

666
      size_t maximum_session_tickets_per_client_hello() const override;
667

668
      std::chrono::seconds session_ticket_lifetime() const override;
669

670
      bool reuse_session_tickets() const override;
671

672
      size_t new_session_tickets_upon_handshake_success() const override;
673

674
      bool tls_13_middlebox_compatibility_mode() const override;
675

676
      bool hash_hello_random() const override;
677

678
      std::vector<uint16_t> srtp_profiles() const override;
679

680
      void set(const std::string& key, const std::string& value);
681

682
      explicit Text_Policy(std::string_view s);
683

684
      explicit Text_Policy(std::istream& in);
685

686
   protected:
687
      std::vector<std::string> get_list(const std::string& key, const std::vector<std::string>& def) const;
688

689
      std::vector<Group_Params> read_group_list(std::string_view group_str) const;
690

691
      size_t get_len(const std::string& key, size_t def) const;
692

693
      std::chrono::seconds get_duration(const std::string& key, std::chrono::seconds def) const;
694

695
      bool get_bool(const std::string& key, bool def) const;
696

697
      std::string get_str(const std::string& key, const std::string& def = "") const;
698

699
      bool set_value(const std::string& key, std::string_view val, bool overwrite);
700

701
   private:
702
      std::map<std::string, std::string> m_kv;
703
};
704

705
}
706

707
}
708

709
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc