summaryrefslogtreecommitdiff
path: root/lib/crypto/CipherDescription.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2012-04-28 18:13:19 +0000
committerChris Wilson <chris+github@qwirx.com>2012-04-28 18:13:19 +0000
commit26c898448b0c88c9a9b1cd7609847d0df9ab52bf (patch)
treeeafa7290f1d1c7e6074173e19a351650cbe3e69b /lib/crypto/CipherDescription.h
parent3c60fe12ad2b8cb476991a3a7c7822782ce80953 (diff)
Allow ciphers to identify themselves for debugging.
Diffstat (limited to 'lib/crypto/CipherDescription.h')
-rw-r--r--lib/crypto/CipherDescription.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/crypto/CipherDescription.h b/lib/crypto/CipherDescription.h
index f825eefa..813df2ce 100644
--- a/lib/crypto/CipherDescription.h
+++ b/lib/crypto/CipherDescription.h
@@ -34,7 +34,7 @@ public:
// Return OpenSSL cipher object
virtual const EVP_CIPHER *GetCipher() const = 0;
-
+
// Setup any other parameters
virtual void SetupParameters(EVP_CIPHER_CTX *pCipherContext) const = 0;
@@ -47,6 +47,23 @@ public:
Mode_OFB = 3
} CipherMode;
+ virtual std::string GetCipherName() const = 0;
+ virtual CipherMode GetCipherMode() const = 0;
+ virtual std::string GetFullName() const
+ {
+ std::ostringstream out;
+ out << GetCipherName() << "-";
+ switch (GetCipherMode())
+ {
+ case Mode_ECB: out << "ECB"; break;
+ case Mode_CBC: out << "CBC"; break;
+ case Mode_CFB: out << "CFB"; break;
+ case Mode_OFB: out << "OFB"; break;
+ default: out << "unknown";
+ }
+ return out.str();
+ }
+
#ifdef HAVE_OLD_SSL
// For the old version of OpenSSL, we need to be able to store cipher descriptions.
virtual CipherDescription *Clone() const = 0;