source: box/trunk/lib/crypto/CipherAES.h @ 3098

Revision 3098, 1.5 KB checked in by chris, 4 weeks ago (diff)

Allow ciphers to identify themselves for debugging.

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    CipherAES.h
5//              Purpose: AES cipher description
6//              Created: 27/4/04
7//
8// --------------------------------------------------------------------------
9
10#ifndef CIPHERAES__H
11#define CIPHERAES__H
12
13// Only available in new versions of openssl
14#ifndef HAVE_OLD_SSL
15
16#include "CipherDescription.h"
17
18// --------------------------------------------------------------------------
19//
20// Class
21//              Name:    CipherAES
22//              Purpose: AES cipher description
23//              Created: 27/4/04
24//
25// --------------------------------------------------------------------------
26class CipherAES : public CipherDescription
27{
28public:
29        CipherAES(CipherDescription::CipherMode Mode, const void *pKey, unsigned int KeyLength, const void *pInitialisationVector = 0);
30        CipherAES(const CipherAES &rToCopy);
31        virtual ~CipherAES();
32        CipherAES &operator=(const CipherAES &rToCopy);
33       
34        // Return OpenSSL cipher object
35        virtual const EVP_CIPHER *GetCipher() const;
36       
37        // Setup any other parameters
38        virtual void SetupParameters(EVP_CIPHER_CTX *pCipherContext) const;
39
40        virtual std::string GetCipherName() const
41        {
42                std::ostringstream out;
43                out << "AES";
44                out << mKeyLength;
45                return out.str();
46        }
47        virtual CipherMode GetCipherMode() const { return mMode; }
48
49private:
50        CipherDescription::CipherMode mMode;
51        const void *mpKey;
52        unsigned int mKeyLength;
53        const void *mpInitialisationVector;
54};
55
56#endif // n HAVE_OLD_SSL
57
58#endif // CIPHERAES__H
59
Note: See TracBrowser for help on using the repository browser.