Botan 3.6.1
Crypto and TLS for C&
tls_policy.h
Go to the documentation of this file.
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_extensions.h>
15#include <botan/tls_signature_scheme.h>
16#include <botan/tls_version.h>
17#include <chrono>
18#include <map>
19#include <optional>
20#include <vector>
21
22namespace Botan {
23
24class Public_Key;
25
26namespace TLS {
27
28/**
29* TLS Policy Base Class
30* Inherit and overload as desired to suit local policy concerns
31*/
33 public:
34 /**
35 * Allow ssl key log file
36 * @note If function returns true, then Callbacks::tls_ssl_key_log_data
37 * will be invoked containing secret information for logging purposes
38 */
39 virtual bool allow_ssl_key_log_file() const;
40
41 /**
42 * Returns a list of ciphers we are willing to negotiate, in
43 * order of preference.
44 */
45 virtual std::vector<std::string> allowed_ciphers() const;
46
47 /**
48 * Returns a list of hash algorithms we are willing to use for
49 * signatures, in order of preference.
50 */
51 virtual std::vector<std::string> allowed_signature_hashes() const;
52
53 /**
54 * Returns a list of MAC algorithms we are willing to use.
55 */
56 virtual std::vector<std::string> allowed_macs() const;
57
58 /**
59 * Returns a list of key exchange algorithms we are willing to
60 * use, in order of preference. Allowed values: DH, empty string
61 * (representing RSA using server certificate key)
62 */
63 virtual std::vector<std::string> allowed_key_exchange_methods() const;
64
65 /**
66 * Returns a list of signature algorithms we are willing to
67 * use, in order of preference.
68 */
69 virtual std::vector<std::string> allowed_signature_methods() const;
70
71 virtual std::vector<Signature_Scheme> allowed_signature_schemes() const;
72
73 /**
74 * Return a list of schemes we are willing to accept
75 */
76 virtual std::vector<Signature_Scheme> acceptable_signature_schemes() const;
77
78 /**
79 * Return a list of schemes we are willing to accept for signatures in
80 * certificates.
81 *
82 * By default, the same restrictions as in acceptable_signature_schemes()
83 * apply.
84 *
85 * @return std::nullopt if the same restrictions as defined in
86 * acceptable_signature_schemes() should apply
87 */
88 virtual std::optional<std::vector<Signature_Scheme>> acceptable_certificate_signature_schemes() const;
89
90 /**
91 * The minimum signature strength we will accept
92 *
93 * Returning 80 allows RSA 1024 and SHA-1. Values larger than 80 disable
94 * SHA-1 support. Returning 110 allows RSA 2048. Return 128 to force ECC
95 * (P-256) or large (~3000 bit) RSA keys.
96 *
97 * Default is 110
98 */
99 virtual size_t minimum_signature_strength() const;
100
101 /**
102 * Return if certificate revocation info (CRL/OCSP) is required
103 *
104 * If true, certificates won't be trusted unless a valid CRL or OCSP
105 * response was examined.
106 *
107 * Default: true
108 */
109 virtual bool require_cert_revocation_info() const;
110
111 bool allowed_signature_method(std::string_view sig_method) const;
112 bool allowed_signature_hash(std::string_view hash) const;
113
114 /**
115 * Return a list of ECC curve and DH group TLS identifiers we are willing
116 * to use, in order of preference. The default ordering puts the best
117 * performing ECC first.
118 *
119 * Default: Group_Params::X25519, Group_Params::SECP256R1,
120 * Group_Params::BRAINPOOL256R1, Group_Params::SECP384R1,
121 * Group_Params::BRAINPOOL384R1, Group_Params::SECP521R1,
122 * Group_Params::BRAINPOOL512R1, Group_Params::FFDHE_2048,
123 * Group_Params::FFDHE_3072, Group_Params::FFDHE_4096,
124 * Group_Params::FFDHE_6144, Group_Params::FFDHE_8192
125 *
126 * No other values are currently defined.
127 */
128 virtual std::vector<Group_Params> key_exchange_groups() const;
129
130 /**
131 * Return a list of groups to provide prepared key share offers in the
132 * initial client hello for. Groups in this list must be reflected in
133 * key_exchange_groups() and in the same order.
134 * If an empty list is returned, no prepared key share offers are sent
135 * and the decision of the group to use is left to the server.
136 *
137 * Default: the most preferred group from key_exchange_groups().
138 *
139 * @note Has an effect on TLS 1.3 clients, only.
140 */
141 virtual std::vector<Group_Params> key_exchange_groups_to_offer() const;
142
143 /**
144 * Request that ECC curve points are sent compressed
145 *
146 * Signals that we prefer ECC points to be compressed when transmitted to
147 * us. The other party may not support ECC point compression and therefore
148 * may still send points uncompressed.
149 *
150 * Note that the certificate used during authentication must also follow
151 * the other party's preference.
152 *
153 * @note Support for EC point compression is deprecated and will be removed
154 * in a future major release. TLS 1.3 does not support point compression
155 * at all (see RFC 8446 4.2.8.2)
156 */
157 virtual bool use_ecc_point_compression() const;
158
159 /**
160 * Select a key exchange group to use, from the list of groups sent by the
161 * peer. In TLS 1.3 handshakes the peer might have provided cryptographic material
162 * for a subset of its available groups. Choosing a group for which no share was
163 * provided will result in an additional round trip. If none are acceptable, return
164 * Group_Params::NONE.
165 *
166 * By default this will try to optimize for less round trips even if this results
167 * in the usage of a less preferred group.
168 */
169 virtual Group_Params choose_key_exchange_group(const std::vector<Group_Params>& supported_by_peer,
170 const std::vector<Group_Params>& offered_by_peer) const;
171
172 /**
173 * Allow renegotiation even if the counterparty doesn't support the secure
174 * renegotiation extension.
175 *
176 * Default: false
177 *
178 * @warning Changing this to true exposes you to injected plaintext
179 * attacks. Read RFC 5746 for background.
180 *
181 * @note Has no effect for TLS 1.3 connections.
182 */
183 virtual bool allow_insecure_renegotiation() const;
184
185 /**
186 * The protocol dictates that the first 32 bits of the random
187 * field are the current time in seconds. However this allows
188 * client fingerprinting attacks. Set to false to disable, in
189 * which case random bytes will be used instead.
190 *
191 * Default: true
192 */
193 virtual bool include_time_in_hello_random() const;
194
195 /**
196 * Consulted by server side. If true, allows clients to initiate a new
197 * handshake
198 *
199 * If this function returns true, a server will accept a client-initiated
200 * renegotiation attempt. Otherwise it will send the client a non-fatal
201 * TLS::AlertType::NoRenegotiation alert.
202 *
203 * Default: false
204 *
205 * @note Has no effect for TLS 1.3 connections.
206 */
207 virtual bool allow_client_initiated_renegotiation() const;
208
209 /**
210 * Consulted by client side. If true, allows servers to initiate a new
211 * handshake
212 *
213 * If this function returns true, a client will accept a server-initiated
214 * renegotiation attempt. Otherwise it will send the server a non-fatal
215 * TLS::AlertType::NoRenegotiation alert.
216 *
217 * Default: false
218 *
219 * @note Has no effect for TLS 1.3 connections.
220 */
221 virtual bool allow_server_initiated_renegotiation() const;
222
223 /**
224 * If true, a request to renegotiate will close the connection with
225 * a fatal alert. Otherwise, a warning alert is sent.
226 *
227 * @sa allow_client_initiated_renegotiation
228 * @sa allow_server_initiated_renegotiation
229 *
230 * Default: false
231 *
232 * @note Has no effect for TLS 1.3 connections.
233 */
234 virtual bool abort_connection_on_undesired_renegotiation() const;
235
236 /**
237 * Only resume sessions when their original protocol version matches
238 * the current version exactly.
239 *
240 * Default: true
241 */
242 virtual bool only_resume_with_exact_version() const;
243
244 /**
245 * Allow TLS v1.2
246 */
247 virtual bool allow_tls12() const;
248
249 /**
250 * Allow TLS v1.3
251 */
252 virtual bool allow_tls13() const;
253
254 /**
255 * Allow DTLS v1.2
256 */
257 virtual bool allow_dtls12() const;
258
259 /**
260 * For ephemeral Diffie-Hellman key exchange, the server sends a group
261 * parameter. Return the 2 Byte TLS group identifier specifying the group
262 * parameter a server should use.
263 *
264 * Default: 2048 bit IETF IPsec group ("modp/ietf/2048")
265 *
266 * @note Has no effect for TLS 1.3 connections.
267 */
268 virtual Group_Params default_dh_group() const;
269
270 /**
271 * Return the minimum DH group size we're willing to use
272 *
273 * Return the minimum size in bits for a Diffie-Hellman group that a client
274 * will accept. Due to the design of the protocol the client has only two
275 * options - accept the group, or reject it with a fatal alert then attempt
276 * to reconnect after disabling ephemeral Diffie-Hellman.
277 *
278 * Default: 2048 bits
279 */
280 virtual size_t minimum_dh_group_size() const;
281
282 /**
283 * For ECDSA authenticated ciphersuites, the smallest key size the
284 * client will accept.
285 * This policy is currently only enforced on the server by the client.
286 *
287 * Default: 256
288 */
289 virtual size_t minimum_ecdsa_group_size() const;
290
291 /**
292 * Return the minimum ECDH group size we're willing to use
293 * for key exchange
294 *
295 * Default 255, allowing x25519 and larger
296 * x25519 is the smallest curve we will negotiate
297 * P-521 is the largest
298 */
299 virtual size_t minimum_ecdh_group_size() const;
300
301 /**
302 * Return the minimum bit size we're willing to accept for RSA
303 * key exchange or server signatures.
304 *
305 * It does not place any requirements on the size of any RSA signature(s)
306 * which were used to check the server certificate. This is only
307 * concerned with the server's public key.
308 *
309 * Default is 2048 which is smallest RSA key size still secure
310 * for medium term security.
311 */
312 virtual size_t minimum_rsa_bits() const;
313
314 /**
315 * Allows the policy to examine peer public keys. Throw an exception if the
316 * key should be rejected. Default implementation checks against policy
317 * values minimum_dh_group_size(), minimum_rsa_bits(),
318 * minimum_ecdsa_group_size(), and minimum_ecdh_group_size().
319 *
320 * Override if you'd like to perform some other kind of test on (or logging
321 * of) the peer's keys.
322 */
323 virtual void check_peer_key_acceptable(const Public_Key& public_key) const;
324
325 /**
326 * The PSK suites work using an identifier along with a shared secret. If
327 * this function returns true, when an identifier that the server does not
328 * recognize is provided by a client, a random shared secret will be
329 * generated in such a way that a client should not be able to tell the
330 * difference between the identifier not being known and the secret being
331 * wrong. This can help protect against some username probing attacks. If
332 * it returns false, the server will instead send an
333 * TLS::AlertType::UnknownPSKIdentity alert when an unknown identifier is
334 * used.
335 *
336 * Default: false
337 */
338 virtual bool hide_unknown_users() const;
339
340 /**
341 * Defines the maximum number of session tickets a client might
342 * offer in a single resumption attempt. Must be greater than 0.
343 *
344 * TODO: Currently, the TLS 1.3 client implementation supports
345 * exactly one ticket per handshake. RFC 8446 allows for
346 * an arbitrary amount, though.
347 *
348 * Default: 1
349 *
350 * @note Has an effect on TLS 1.3 connections, only.
351 */
352 virtual size_t maximum_session_tickets_per_client_hello() const;
353
354 /**
355 * Return the allowed lifetime of a session ticket. If 0, session
356 * tickets do not expire until the session ticket key rolls over.
357 * For TLS 1.3 session tickets the lifetime must not be longer than
358 * seven days. Expired session tickets cannot be used to resume a
359 * session.
360 *
361 * Default: 1 day
362 */
363 virtual std::chrono::seconds session_ticket_lifetime() const;
364
365 /**
366 * Decides whether stored session tickets should be used multiple
367 * times (until their lifetime runs out). This might allow passive
368 * observers to correlate connections (RFC 8446 Appendix C.4). This
369 * has no effect on TLS 1.2 resumptions based on session IDs as those
370 * are negotiated in the clear anyway.
371 *
372 * Default: false
373 */
374 virtual bool reuse_session_tickets() const;
375
376 /**
377 * Return the number of new session tickets a TLS 1.3 server should issue
378 * automatically upon a successful handshake. Note that applications can
379 * use `TLS::Server::send_new_session_tickets()` regardless of this policy.
380 *
381 * For convenience (and compatibility with the TLS 1.2 behaviour), this
382 * returns '1' by default.
383 *
384 * @note Has an effect on TLS 1.3 connections, only.
385 */
386 virtual size_t new_session_tickets_upon_handshake_success() const;
387
388 /**
389 * If this returns a non-empty vector, and DTLS is negotiated,
390 * then we will also attempt to negotiate the SRTP extension from
391 * RFC 5764 using the returned values as the profile ids.
392 */
393 virtual std::vector<uint16_t> srtp_profiles() const;
394
395 /**
396 * @return true if and only if we are willing to accept this version
397 * Default accepts TLS v1.2 and later or DTLS v1.2 or later.
398 */
399 virtual bool acceptable_protocol_version(Protocol_Version version) const;
400
401 /**
402 * Returns the most recent protocol version we are willing to
403 * use, for either TLS or DTLS depending on datagram param.
404 * Shouldn't ever need to override this unless you want to allow
405 * a user to disable specific TLS versions.
406 */
407 virtual Protocol_Version latest_supported_version(bool datagram) const;
408
409 /**
410 * Allows policy to reject any ciphersuites which are undesirable
411 * for whatever reason without having to reimplement ciphersuite_list
412 */
413 virtual bool acceptable_ciphersuite(const Ciphersuite& suite) const;
414
415 /**
416 * Default: true
417 *
418 * @return true if servers should choose the ciphersuite matching
419 * their highest preference, rather than the clients.
420 * Has no effect on client side.
421 */
422 virtual bool server_uses_own_ciphersuite_preferences() const;
423
424 /**
425 * Indicates whether the encrypt-then-MAC extension should be negotiated
426 * (RFC 7366)
427 *
428 * @note Has no effect for TLS 1.3 connections.
429 */
430 virtual bool negotiate_encrypt_then_mac() const;
431
432 /**
433 * Defines the maximum TLS record length for TLS connections.
434 * This is based on the Record Size Limit extension described in RFC 8449.
435 * By default (i.e. if std::nullopt is returned), TLS clients will omit
436 * this extension altogether.
437 *
438 * This value may be between 64 and 16385 (TLS 1.3) or 16384 (TLS 1.2).
439 *
440 * @note This is currently not implemented for TLS 1.2, hence the limit
441 * won't be negotiated by TLS 1.3 clients that support downgrading
442 * to TLS 1.2 (i.e. #allow_tls12() returning true).
443 */
444 virtual std::optional<uint16_t> record_size_limit() const;
445
446 /**
447 * Indicates whether certificate status messages should be supported
448 */
449 virtual bool support_cert_status_message() const;
450
451 /**
452 * Indicate if client certificate authentication is required.
453 * If true, then a cert will be requested and if the client does
454 * not send a certificate the connection will be closed.
455 */
456 virtual bool require_client_certificate_authentication() const;
457
458 /**
459 * Indicate if client certificate authentication is requested.
460 * If true, then a cert will be requested.
461 */
462 virtual bool request_client_certificate_authentication() const;
463
464 /**
465 * Returns a list of accepted certificate types for client authentication
466 * in order of preference. See RFC 7250 and RFC 8446 4.4.2 for details.
467 * Defaults to X509 only.
468 *
469 * Note that it is the application's responsibility to provide public keys
470 * and/or certificates according to the specification in this list via the
471 * Credentials_Manager.
472 */
473 virtual std::vector<Certificate_Type> accepted_client_certificate_types() const;
474
475 /**
476 * Returns a list of accepted certificate types for server authentication
477 * in order of preference. See RFC 7250 and RFC 8446 4.4.2 for details.
478 * Defaults to X509 only.
479 *
480 * Note that it is the application's responsibility to provide public keys
481 * and/or certificates according to the specification in this list via the
482 * Credentials_Manager.
483 */
484 virtual std::vector<Certificate_Type> accepted_server_certificate_types() const;
485
486 /**
487 * If true, then allow a DTLS client to restart a connection to the
488 * same server association as described in section 4.2.8 of the DTLS RFC
489 */
490 virtual bool allow_dtls_epoch0_restart() const;
491
492 /**
493 * Return allowed ciphersuites, in order of preference for the provided
494 * protocol version.
495 *
496 * @param version the exact protocol version to select supported and allowed
497 * ciphersuites for
498 */
499 virtual std::vector<uint16_t> ciphersuite_list(Protocol_Version version) const;
500
501 /**
502 * @return the default MTU for DTLS
503 */
504 virtual size_t dtls_default_mtu() const;
505
506 /**
507 * @return the initial timeout for DTLS
508 */
509 virtual size_t dtls_initial_timeout() const;
510
511 /**
512 * @return the maximum timeout for DTLS
513 */
514 virtual size_t dtls_maximum_timeout() const;
515
516 /**
517 * @return the maximum size of the certificate chain, in bytes.
518 * Return 0 to disable this and accept any size.
519 */
520 virtual size_t maximum_certificate_chain_size() const;
521
522 /**
523 * @note Has no effect for TLS 1.3 connections.
524 */
525 virtual bool allow_resumption_for_renegotiation() const;
526
527 /**
528 * Defines whether or not the middlebox compatibility mode should be
529 * used. Enabled by default.
530 *
531 * RFC 8446 Appendix D.4
532 * [This makes] the TLS 1.3 handshake resemble TLS 1.2 session resumption,
533 * which improves the chance of successfully connecting through middleboxes.
534 *
535 * Default: true
536 *
537 * @note Has an effect on TLS 1.3 connections, only.
538 */
539 virtual bool tls_13_middlebox_compatibility_mode() const;
540
541 /**
542 * Hash the RNG output for the client/server hello random. This is a pre-caution
543 * to avoid writing "raw" RNG output to the wire.
544 *
545 * There's not normally a reason to disable this, except when deterministic output
546 * is required for testing.
547 *
548 * Default: true
549 */
550 virtual bool hash_hello_random() const;
551
552 /**
553 * Convert this policy to a printable format.
554 * @param o stream to be printed to
555 */
556 virtual void print(std::ostream& o) const;
557
558 /**
559 * Convert this policy to a printable format.
560 * Same as calling `print` on a ostringstream and reading o.str()
561 */
562 std::string to_string() const;
563
564 virtual ~Policy() = default;
565};
566
568
569/**
570* NSA Suite B 128-bit security level (RFC 6460)
571*
572* @warning As of August 2015 NSA indicated only the 192-bit Suite B
573* should be used for all classification levels.
574*/
576 public:
577 std::vector<std::string> allowed_ciphers() const override { return std::vector<std::string>({"AES-128/GCM"}); }
578
579 std::vector<std::string> allowed_signature_hashes() const override {
580 return std::vector<std::string>({"SHA-256"});
581 }
582
583 std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); }
584
585 std::vector<std::string> allowed_key_exchange_methods() const override {
586 return std::vector<std::string>({"ECDH"});
587 }
588
589 std::vector<std::string> allowed_signature_methods() const override {
590 return std::vector<std::string>({"ECDSA"});
591 }
592
593 std::vector<Group_Params> key_exchange_groups() const override { return {Group_Params::SECP256R1}; }
594
595 size_t minimum_signature_strength() const override { return 128; }
596
597 bool allow_tls12() const override { return true; }
598
599 bool allow_tls13() const override { return false; }
600
601 bool allow_dtls12() const override { return false; }
602};
603
604/**
605* NSA Suite B 192-bit security level (RFC 6460)
606*/
608 public:
609 std::vector<std::string> allowed_ciphers() const override { return std::vector<std::string>({"AES-256/GCM"}); }
610
611 std::vector<std::string> allowed_signature_hashes() const override {
612 return std::vector<std::string>({"SHA-384"});
613 }
614
615 std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); }
616
617 std::vector<std::string> allowed_key_exchange_methods() const override {
618 return std::vector<std::string>({"ECDH"});
619 }
620
621 std::vector<std::string> allowed_signature_methods() const override {
622 return std::vector<std::string>({"ECDSA"});
623 }
624
625 std::vector<Group_Params> key_exchange_groups() const override { return {Group_Params::SECP384R1}; }
626
627 size_t minimum_signature_strength() const override { return 192; }
628
629 bool allow_tls12() const override { return true; }
630
631 bool allow_tls13() const override { return false; }
632
633 bool allow_dtls12() const override { return false; }
634};
635
636/**
637* BSI TR-02102-2 Policy
638*/
640 public:
641 std::vector<std::string> allowed_ciphers() const override {
642 return std::vector<std::string>(
643 {"AES-256/GCM", "AES-128/GCM", "AES-256/CCM", "AES-128/CCM", "AES-256", "AES-128"});
644 }
645
646 std::vector<std::string> allowed_signature_hashes() const override {
647 return std::vector<std::string>({"SHA-512", "SHA-384", "SHA-256"});
648 }
649
650 std::vector<std::string> allowed_macs() const override {
651 return std::vector<std::string>({"AEAD", "SHA-384", "SHA-256"});
652 }
653
654 std::vector<std::string> allowed_key_exchange_methods() const override {
655 return std::vector<std::string>({"ECDH", "DH", "ECDHE_PSK"});
656 }
657
658 std::vector<std::string> allowed_signature_methods() const override {
659 return std::vector<std::string>({"ECDSA", "RSA", "DSA"});
660 }
661
662 std::vector<Group_Params> key_exchange_groups() const override {
663 return std::vector<Group_Params>({Group_Params::BRAINPOOL512R1,
664 Group_Params::BRAINPOOL384R1,
665 Group_Params::BRAINPOOL256R1,
666 Group_Params::SECP521R1,
667 Group_Params::SECP384R1,
668 Group_Params::SECP256R1,
669 Group_Params::FFDHE_4096,
670 Group_Params::FFDHE_3072});
671 }
672
673 size_t minimum_signature_strength() const override { return 120; }
674
675 bool allow_insecure_renegotiation() const override { return false; }
676
677 bool allow_server_initiated_renegotiation() const override { return true; }
678
679 bool server_uses_own_ciphersuite_preferences() const override { return true; }
680
681 bool negotiate_encrypt_then_mac() const override { return true; }
682
683 size_t minimum_rsa_bits() const override { return 3000; }
684
685 size_t minimum_dh_group_size() const override { return 3000; }
686
687 size_t minimum_ecdh_group_size() const override { return 250; }
688
689 size_t minimum_ecdsa_group_size() const override { return 250; }
690
691 bool allow_tls12() const override { return true; }
692
693 bool allow_tls13() const override { return true; }
694
695 bool allow_dtls12() const override { return false; }
696};
697
698/**
699* Policy for DTLS. We require DTLS v1.2 and an AEAD mode.
700*/
702 public:
703 std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); }
704
705 bool allow_tls12() const override { return false; }
706
707 bool allow_tls13() const override { return false; }
708
709 bool allow_dtls12() const override { return true; }
710};
711
712/*
713* This policy requires a secure version of TLS and disables all insecure
714* algorithms. It is compatible with other botan TLSes (including those using the
715* default policy) and with many other recent implementations. It is a great idea
716* to use if you control both sides of the protocol and don't have to worry
717* about ancient and/or bizarre TLS implementations.
718*/
720 public:
721 std::vector<std::string> allowed_ciphers() const override;
722
723 std::vector<std::string> allowed_signature_hashes() const override;
724
725 std::vector<std::string> allowed_macs() const override;
726
727 std::vector<std::string> allowed_key_exchange_methods() const override;
728};
729
730class BOTAN_PUBLIC_API(2, 0) Text_Policy : public Policy {
731 public:
732 bool allow_ssl_key_log_file() const override;
733
734 std::vector<std::string> allowed_ciphers() const override;
735
736 std::vector<std::string> allowed_signature_hashes() const override;
737
738 std::vector<std::string> allowed_macs() const override;
739
740 std::vector<std::string> allowed_key_exchange_methods() const override;
741
742 std::vector<std::string> allowed_signature_methods() const override;
743
744 std::vector<Group_Params> key_exchange_groups() const override;
745
746 std::vector<Group_Params> key_exchange_groups_to_offer() const override;
747
748 bool use_ecc_point_compression() const override;
749
750 bool allow_tls12() const override;
751
752 bool allow_tls13() const override;
753
754 bool allow_dtls12() const override;
755
756 bool allow_insecure_renegotiation() const override;
757
758 bool include_time_in_hello_random() const override;
759
760 bool allow_client_initiated_renegotiation() const override;
761 bool allow_server_initiated_renegotiation() const override;
762
763 bool server_uses_own_ciphersuite_preferences() const override;
764
765 bool negotiate_encrypt_then_mac() const override;
766
767 std::optional<uint16_t> record_size_limit() const override;
768
769 bool support_cert_status_message() const override;
770
771 bool require_client_certificate_authentication() const override;
772
773 std::vector<Certificate_Type> accepted_client_certificate_types() const override;
774 std::vector<Certificate_Type> accepted_server_certificate_types() const override;
775
776 size_t minimum_ecdh_group_size() const override;
777
778 size_t minimum_ecdsa_group_size() const override;
779
780 size_t minimum_dh_group_size() const override;
781
782 size_t minimum_rsa_bits() const override;
783
784 size_t minimum_signature_strength() const override;
785
786 size_t dtls_default_mtu() const override;
787
788 size_t dtls_initial_timeout() const override;
789
790 size_t dtls_maximum_timeout() const override;
791
792 bool require_cert_revocation_info() const override;
793
794 bool hide_unknown_users() const override;
795
796 size_t maximum_session_tickets_per_client_hello() const override;
797
798 std::chrono::seconds session_ticket_lifetime() const override;
799
800 bool reuse_session_tickets() const override;
801
802 size_t new_session_tickets_upon_handshake_success() const override;
803
804 bool tls_13_middlebox_compatibility_mode() const override;
805
806 bool hash_hello_random() const override;
807
808 std::vector<uint16_t> srtp_profiles() const override;
809
810 void set(const std::string& key, const std::string& value);
811
812 explicit Text_Policy(std::string_view s);
813
814 explicit Text_Policy(std::istream& in);
815
816 protected:
817 std::vector<std::string> get_list(const std::string& key, const std::vector<std::string>& def) const;
818
819 std::vector<Group_Params> read_group_list(std::string_view group_str) const;
820 std::vector<Certificate_Type> read_cert_type_list(const std::string& cert_type_str) const;
821
822 size_t get_len(const std::string& key, size_t def) const;
823
824 std::chrono::seconds get_duration(const std::string& key, std::chrono::seconds def) const;
825
826 bool get_bool(const std::string& key, bool def) const;
827
828 std::string get_str(const std::string& key, const std::string& def = "") const;
829
830 bool set_value(const std::string& key, std::string_view val, bool overwrite);
831
832 private:
833 std::map<std::string, std::string> m_kv;
834};
835
836} // namespace TLS
837
838} // namespace Botan
839
840#endif
bool allow_dtls12() const override
Definition tls_policy.h:695
size_t minimum_ecdh_group_size() const override
Definition tls_policy.h:687
std::vector< std::string > allowed_signature_hashes() const override
Definition tls_policy.h:646
bool negotiate_encrypt_then_mac() const override
Definition tls_policy.h:681
std::vector< std::string > allowed_ciphers() const override
Definition tls_policy.h:641
std::vector< std::string > allowed_signature_methods() const override
Definition tls_policy.h:658
bool allow_server_initiated_renegotiation() const override
Definition tls_policy.h:677
bool server_uses_own_ciphersuite_preferences() const override
Definition tls_policy.h:679
bool allow_tls12() const override
Definition tls_policy.h:691
std::vector< std::string > allowed_macs() const override
Definition tls_policy.h:650
size_t minimum_rsa_bits() const override
Definition tls_policy.h:683
bool allow_tls13() const override
Definition tls_policy.h:693
std::vector< Group_Params > key_exchange_groups() const override
Definition tls_policy.h:662
size_t minimum_dh_group_size() const override
Definition tls_policy.h:685
bool allow_insecure_renegotiation() const override
Definition tls_policy.h:675
size_t minimum_ecdsa_group_size() const override
Definition tls_policy.h:689
std::vector< std::string > allowed_key_exchange_methods() const override
Definition tls_policy.h:654
size_t minimum_signature_strength() const override
Definition tls_policy.h:673
bool allow_dtls12() const override
Definition tls_policy.h:709
bool allow_tls13() const override
Definition tls_policy.h:707
bool allow_tls12() const override
Definition tls_policy.h:705
std::vector< std::string > allowed_macs() const override
Definition tls_policy.h:703
std::vector< std::string > allowed_macs() const override
Definition tls_policy.h:583
bool allow_dtls12() const override
Definition tls_policy.h:601
std::vector< Group_Params > key_exchange_groups() const override
Definition tls_policy.h:593
size_t minimum_signature_strength() const override
Definition tls_policy.h:595
std::vector< std::string > allowed_signature_methods() const override
Definition tls_policy.h:589
std::vector< std::string > allowed_key_exchange_methods() const override
Definition tls_policy.h:585
std::vector< std::string > allowed_signature_hashes() const override
Definition tls_policy.h:579
std::vector< std::string > allowed_ciphers() const override
Definition tls_policy.h:577
bool allow_tls12() const override
Definition tls_policy.h:597
bool allow_tls13() const override
Definition tls_policy.h:599
std::vector< Group_Params > key_exchange_groups() const override
Definition tls_policy.h:625
bool allow_tls12() const override
Definition tls_policy.h:629
bool allow_tls13() const override
Definition tls_policy.h:631
std::vector< std::string > allowed_macs() const override
Definition tls_policy.h:615
bool allow_dtls12() const override
Definition tls_policy.h:633
std::vector< std::string > allowed_ciphers() const override
Definition tls_policy.h:609
std::vector< std::string > allowed_key_exchange_methods() const override
Definition tls_policy.h:617
size_t minimum_signature_strength() const override
Definition tls_policy.h:627
std::vector< std::string > allowed_signature_methods() const override
Definition tls_policy.h:621
std::vector< std::string > allowed_signature_hashes() const override
Definition tls_policy.h:611
virtual ~Policy()=default
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
Policy Default_Policy
Definition tls_policy.h:567