Botan  1.10.9
Public Member Functions | Static Public Member Functions | List of all members
Botan::CipherSuite Class Reference

#include <tls_suites.h>

Public Member Functions

std::string cipher_algo () const
 
size_t cipher_keylen () const
 
 CipherSuite (u16bit=0)
 
TLS_Ciphersuite_Algos kex_type () const
 
std::string mac_algo () const
 
TLS_Ciphersuite_Algos sig_type () const
 

Static Public Member Functions

static TLS_Ciphersuite_Algos lookup_ciphersuite (u16bit suite)
 

Detailed Description

Ciphersuite Information

Definition at line 20 of file tls_suites.h.

Constructor & Destructor Documentation

Botan::CipherSuite::CipherSuite ( u16bit  suite_code = 0)

CipherSuite Constructor

Definition at line 259 of file tls_suites.cpp.

References lookup_ciphersuite(), Botan::TLS_ALGO_KEYEXCH_MASK, Botan::TLS_ALGO_SIGNER_MASK, and Botan::to_string().

260  {
261  if(suite_code == 0)
262  return;
263 
264  TLS_Ciphersuite_Algos algos = lookup_ciphersuite(suite_code);
265 
266  if(algos == 0)
267  throw Invalid_Argument("Unknown ciphersuite: " + to_string(suite_code));
268 
269  sig_algo = TLS_Ciphersuite_Algos(algos & TLS_ALGO_SIGNER_MASK);
270 
271  kex_algo = TLS_Ciphersuite_Algos(algos & TLS_ALGO_KEYEXCH_MASK);
272 
273  std::pair<std::string, size_t> cipher_info = cipher_code_to_name(algos);
274 
275  cipher = cipher_info.first;
276  cipher_key_length = cipher_info.second;
277 
278  mac = mac_code_to_name(algos);
279  }
static TLS_Ciphersuite_Algos lookup_ciphersuite(u16bit suite)
Definition: tls_suites.cpp:16
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20
std::string to_string(u64bit n, size_t min_len)
Definition: parsing.cpp:42
TLS_Ciphersuite_Algos
Definition: tls_magic.h:145

Member Function Documentation

std::string Botan::CipherSuite::cipher_algo ( ) const
inline

Definition at line 25 of file tls_suites.h.

Referenced by Botan::SessionKeys::SessionKeys(), Botan::Record_Writer::set_keys(), and Botan::Record_Reader::set_keys().

25 { return cipher; }
size_t Botan::CipherSuite::cipher_keylen ( ) const
inline

Definition at line 28 of file tls_suites.h.

Referenced by Botan::SessionKeys::SessionKeys().

28 { return cipher_key_length; }
TLS_Ciphersuite_Algos Botan::CipherSuite::kex_type ( ) const
inline

Definition at line 30 of file tls_suites.h.

Referenced by Botan::Client_Key_Exchange::Client_Key_Exchange().

30 { return kex_algo; }
TLS_Ciphersuite_Algos Botan::CipherSuite::lookup_ciphersuite ( u16bit  suite)
static

Convert an SSL/TLS ciphersuite to algorithm fields

Definition at line 16 of file tls_suites.cpp.

References Botan::TLS_ALGO_CIPHER_3DES_CBC, Botan::TLS_ALGO_CIPHER_AES128_CBC, Botan::TLS_ALGO_CIPHER_AES256_CBC, Botan::TLS_ALGO_CIPHER_RC4_128, Botan::TLS_ALGO_CIPHER_SEED_CBC, Botan::TLS_ALGO_KEYEXCH_DH, Botan::TLS_ALGO_KEYEXCH_ECDH, Botan::TLS_ALGO_KEYEXCH_NOKEX, Botan::TLS_ALGO_MAC_MD5, Botan::TLS_ALGO_MAC_SHA1, Botan::TLS_ALGO_MAC_SHA256, Botan::TLS_ALGO_MAC_SHA384, Botan::TLS_ALGO_SIGNER_DSA, Botan::TLS_ALGO_SIGNER_ECDSA, Botan::TLS_ALGO_SIGNER_RSA, Botan::TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, Botan::TLS_DHE_DSS_WITH_AES_128_CBC_SHA, Botan::TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, Botan::TLS_DHE_DSS_WITH_AES_256_CBC_SHA, Botan::TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, Botan::TLS_DHE_DSS_WITH_SEED_CBC_SHA, Botan::TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, Botan::TLS_DHE_RSA_WITH_AES_128_CBC_SHA, Botan::TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, Botan::TLS_DHE_RSA_WITH_AES_256_CBC_SHA, Botan::TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, Botan::TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, Botan::TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, Botan::TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, Botan::TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, Botan::TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, Botan::TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, Botan::TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, Botan::TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, Botan::TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, Botan::TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, Botan::TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, Botan::TLS_ECDHE_RSA_WITH_RC4_128_SHA, Botan::TLS_RSA_WITH_3DES_EDE_CBC_SHA, Botan::TLS_RSA_WITH_AES_128_CBC_SHA, Botan::TLS_RSA_WITH_AES_128_CBC_SHA256, Botan::TLS_RSA_WITH_AES_256_CBC_SHA, Botan::TLS_RSA_WITH_AES_256_CBC_SHA256, Botan::TLS_RSA_WITH_RC4_128_MD5, Botan::TLS_RSA_WITH_RC4_128_SHA, and Botan::TLS_RSA_WITH_SEED_CBC_SHA.

Referenced by CipherSuite().

17  {
18  if(suite == TLS_RSA_WITH_RC4_128_MD5)
23 
24  if(suite == TLS_RSA_WITH_RC4_128_SHA)
29 
35 
36  if(suite == TLS_RSA_WITH_AES_128_CBC_SHA)
41 
42  if(suite == TLS_RSA_WITH_AES_256_CBC_SHA)
47 
48  if(suite == TLS_RSA_WITH_SEED_CBC_SHA)
53 
59 
65 
71 
77 
83 
89 
95 
101 
107 
113 
114  if(suite == TLS_DHE_DSS_WITH_SEED_CBC_SHA)
119 
125 
131 
137 
143 
149 
155 
161 
167 
173 
174  if(suite == TLS_ECDHE_RSA_WITH_RC4_128_SHA)
179 
185 
191 
197 
203 
209 
210  return TLS_Ciphersuite_Algos(0);
211  }
TLS_Ciphersuite_Algos
Definition: tls_magic.h:145
std::string Botan::CipherSuite::mac_algo ( ) const
inline

Definition at line 26 of file tls_suites.h.

References mac.

Referenced by Botan::SessionKeys::SessionKeys(), Botan::Record_Writer::set_keys(), and Botan::Record_Reader::set_keys().

26 { return mac; }
TLS_Ciphersuite_Algos Botan::CipherSuite::sig_type ( ) const
inline

Definition at line 31 of file tls_suites.h.

31 { return sig_algo; }

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