diff options
author | lloyd <[email protected]> | 2012-04-06 15:54:32 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-04-06 15:54:32 +0000 |
commit | 45396449cd84326626c09e48af74ccb008a0aefc (patch) | |
tree | 4fc2d978bedd64ea799f461f09c468b1fe3ba0db /src/tls/tls_ciphersuite.h | |
parent | 757bf5016ad880961ee3a42f99b7bf2e99ec692a (diff) | |
parent | 682e7c46e83afbfa3983932be0838aa82b67eafa (diff) |
propagate from branch 'net.randombit.botan' (head 058444ec216dd9690938c82922d911df2da535b4)
to branch 'net.randombit.botan.tls-state-machine' (head 54985e112aecb7b7c98a7dace924a2f704e6c9c1)
Diffstat (limited to 'src/tls/tls_ciphersuite.h')
-rw-r--r-- | src/tls/tls_ciphersuite.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/tls/tls_ciphersuite.h b/src/tls/tls_ciphersuite.h new file mode 100644 index 000000000..dcb4b6a6f --- /dev/null +++ b/src/tls/tls_ciphersuite.h @@ -0,0 +1,73 @@ +/* +* 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: + /** + * Convert an SSL/TLS ciphersuite to algorithm fields + */ + static Ciphersuite by_id(u16bit suite); + + static Ciphersuite by_name(const std::string& name); + + /** + * Formats the ciphersuite back to an RFC-style ciphersuite string + */ + std::string to_string() const; + + bool psk_ciphersuite() const; + bool ecc_ciphersuite() 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) : + m_sig_algo(sig_algo), + m_kex_algo(kex_algo), + m_mac_algo(mac_algo), + m_cipher_algo(cipher_algo), + m_cipher_keylen(cipher_algo_keylen) + { + } + + private: + std::string m_sig_algo, m_kex_algo, m_mac_algo, m_cipher_algo; + size_t m_cipher_keylen; + }; + +} + +} + +#endif |