Botan 1.10.17

Public Member Functions | List of all members
Botan::TLS_Policy Class Referenceabstract

`#include <tls_policy.h>`

## Public Member Functions
virtual bool | allow_edh_dsa () const
virtual bool | allow_edh_rsa () const
virtual bool | allow_static_rsa () const
virtual bool | check_cert (const std::vector< X509_Certificate > &cert_chain) const =0
virtual byte | choose_compression (const std::vector< byte > &client) const
virtual u16bit | choose_suite (const std::vector< u16bit > &client_suites, bool rsa_ok, bool dsa_ok) const
std::vector< u16bit > | ciphersuites () const
virtual std::vector< byte > | compression () const
virtual DL_Group | dh_group () const
virtual Version_Code | min_version () const
virtual Version_Code | pref_version () const
virtual bool | require_client_auth () const
virtual size_t | rsa_export_keysize () const
virtual | ~TLS_Policy ()

## Detailed Description

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

Definition at line 22 of file tls_policy.h.

## Constructor & Destructor Documentation

## ◆ ~TLS_Policy()

virtual Botan::TLS_Policy::~TLS_Policy | ( |  | ) |
| inline virtual

Definition at line 54 of file tls_policy.h.

54 {}

## Member Function Documentation

## ◆ allow_edh_dsa()

virtual bool Botan::TLS_Policy::allow_edh_dsa | ( |  | ) | const
| inline virtual

Definition at line 36 of file tls_policy.h.

Referenced by choose_suite(), and ciphersuites().

36 { return true; }

## ◆ allow_edh_rsa()

virtual bool Botan::TLS_Policy::allow_edh_rsa | ( |  | ) | const
| inline virtual

Definition at line 35 of file tls_policy.h.

Referenced by choose_suite(), and ciphersuites().

35 { return true; }

## ◆ allow_static_rsa()

virtual bool Botan::TLS_Policy::allow_static_rsa | ( |  | ) | const
| inline virtual

Definition at line 34 of file tls_policy.h.

Referenced by choose_suite(), and ciphersuites().

34 { return true; }

## ◆ check_cert()

virtual bool Botan::TLS_Policy::check_cert | ( | const std::vector< X509_Certificate > & | cert_chain | ) | const
| pure virtual

## ◆ choose_compression()

byte Botan::TLS_Policy::choose_compression | ( | const std::vector< byte > & | client | ) | const
| virtual

Definition at line 100 of file tls_policy.cpp.

References compression(), and Botan::NO_COMPRESSION.

101 {
102 std::vector<byte> s_comp = compression();
103
104 for(size_t i = 0; i != s_comp.size(); ++i)
105 for(size_t j = 0; j != c_comp.size(); ++j)
106 if(s_comp[i] == c_comp[j])
107 return s_comp[i];
108
109 return NO_COMPRESSION;
110 }
Botan::NO_COMPRESSION
Definition: tls_magic.h:173
Botan::TLS_Policy::compression
virtual std::vector< byte > compression() const
Definition: tls_policy.cpp:68

## ◆ choose_suite()

u16bit Botan::TLS_Policy::choose_suite | ( | const std::vector< u16bit > & | client_suites,
|  | bool | rsa_ok,
|  | bool | dsa_ok
| ) |  | const
| virtual

Definition at line 78 of file tls_policy.cpp.

References allow_edh_dsa(), allow_edh_rsa(), and allow_static_rsa().

81 {
82 bool use_static_rsa = allow_static_rsa() && have_rsa;
83 bool use_edh_rsa = allow_edh_rsa() && have_rsa;
84 bool use_edh_dsa = allow_edh_dsa() && have_dsa;
85
86 std::vector<u16bit> s_suites = suite_list(use_static_rsa, use_edh_rsa,
87 use_edh_dsa);
88
89 for(size_t i = 0; i != s_suites.size(); ++i)
90 for(size_t j = 0; j != c_suites.size(); ++j)
91 if(s_suites[i] == c_suites[j])
92 return s_suites[i];
93
94 return 0;
95 }
Botan::TLS_Policy::allow_static_rsa
virtual bool allow_static_rsa() const
Definition: tls_policy.h:34
Botan::TLS_Policy::allow_edh_dsa
virtual bool allow_edh_dsa() const
Definition: tls_policy.h:36
Botan::TLS_Policy::allow_edh_rsa
virtual bool allow_edh_rsa() const
Definition: tls_policy.h:35

## ◆ ciphersuites()

std::vector< u16bit > Botan::TLS_Policy::ciphersuites | ( |  | ) | const

Definition at line 16 of file tls_policy.cpp.

References allow_edh_dsa(), allow_edh_rsa(), and allow_static_rsa().

17 {
18 return suite_list(allow_static_rsa(), allow_edh_rsa(), allow_edh_dsa());
19 }
Botan::TLS_Policy::allow_static_rsa
virtual bool allow_static_rsa() const
Definition: tls_policy.h:34
Botan::TLS_Policy::allow_edh_dsa
virtual bool allow_edh_dsa() const
Definition: tls_policy.h:36
Botan::TLS_Policy::allow_edh_rsa
virtual bool allow_edh_rsa() const
Definition: tls_policy.h:35

## ◆ compression()

std::vector< byte > Botan::TLS_Policy::compression | ( |  | ) | const
| virtual

Definition at line 68 of file tls_policy.cpp.

References Botan::NO_COMPRESSION.

Referenced by choose_compression().

69 {
70 std::vector<byte> algs;
71 algs.push_back(NO_COMPRESSION);
72 return algs;
73 }
Botan::NO_COMPRESSION
Definition: tls_magic.h:173

## ◆ dh_group()

DL_Group Botan::TLS_Policy::dh_group | ( |  | ) | const
| virtual

Definition at line 115 of file tls_policy.cpp.

116 {
117 return DL_Group("modp/ietf/1024");
118 }

## ◆ min_version()

virtual Version_Code Botan::TLS_Policy::min_version | ( |  | ) | const
| inline virtual

Definition at line 45 of file tls_policy.h.

References Botan::TLS_V10.

45 { return TLS_V10; }
Botan::TLS_V10
Definition: tls_magic.h:25

## ◆ pref_version()

virtual Version_Code Botan::TLS_Policy::pref_version | ( |  | ) | const
| inline virtual

Definition at line 50 of file tls_policy.h.

References Botan::TLS_V11.

50 { return TLS_V11; }
Botan::TLS_V11
Definition: tls_magic.h:26

## ◆ require_client_auth()

virtual bool Botan::TLS_Policy::require_client_auth | ( |  | ) | const
| inline virtual

Definition at line 37 of file tls_policy.h.

37 { return false; }

## ◆ rsa_export_keysize()

virtual size_t Botan::TLS_Policy::rsa_export_keysize | ( |  | ) | const
| inline virtual

Definition at line 40 of file tls_policy.h.

40 { return 512; }

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

- src/ssl/tls_policy.h
- src/ssl/tls_policy.cpp