aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_ciphersuite.h
blob: f0acc14976d74a9310ba7a19cd6fc493199b1032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* TLS Cipher Suites
* (C) 2004-2011 Jack Lloyd
*
* Released under the terms of the Botan license
*/

#ifndef BOTAN_TLS_CIPHER_SUITES_H__
#define BOTAN_TLS_CIPHER_SUITES_H__

#include <botan/types.h>
#include <string>

namespace Botan {

namespace TLS {

/**
* Ciphersuite Information
*/
class BOTAN_DLL Ciphersuite
   {
   public:
      static Ciphersuite lookup_ciphersuite(u16bit suite);

      /**
      * Formats the ciphersuite back to an RFC-style ciphersuite string
      */
      std::string to_string() const;

      std::string kex_algo() const { return m_kex_algo; }
      std::string sig_algo() const { return m_sig_algo; }

      std::string cipher_algo() const { return m_cipher_algo; }
      std::string mac_algo() const { return m_mac_algo; }

      size_t cipher_keylen() const { return m_cipher_keylen; }

      bool valid() const { return (m_cipher_keylen > 0); }

      Ciphersuite() : m_cipher_keylen(0) {}

      Ciphersuite(const std::string& sig_algo,
                  const std::string& kex_algo,
                  const std::string& mac_algo,
                  const std::string& cipher_algo,
                  size_t cipher_algo_keylen);
   private:
      std::string m_sig_algo, m_kex_algo, m_mac_algo, m_cipher_algo;
      size_t m_cipher_keylen;
   };

}

}

#endif