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

Revision 3098, 1.8 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:    CipherBlowfish.h
5//              Purpose: Blowfish cipher description
6//              Created: 1/12/03
7//
8// --------------------------------------------------------------------------
9
10#ifndef CIPHERBLOWFISH__H
11#define CIPHERBLOWFISH__H
12
13#ifdef HAVE_OLD_SSL
14        #include <string>
15#endif
16
17#include "CipherDescription.h"
18
19// --------------------------------------------------------------------------
20//
21// Class
22//              Name:    CipherBlowfish
23//              Purpose: Description of Blowfish cipher parameters -- note that copies are not made of key material and IV, careful with object lifetimes.
24//              Created: 1/12/03
25//
26// --------------------------------------------------------------------------
27class CipherBlowfish : public CipherDescription
28{
29public:
30        CipherBlowfish(CipherDescription::CipherMode Mode, const void *pKey, unsigned int KeyLength, const void *pInitialisationVector = 0);
31        CipherBlowfish(const CipherBlowfish &rToCopy);
32        virtual ~CipherBlowfish();
33        CipherBlowfish &operator=(const CipherBlowfish &rToCopy);
34       
35        // Return OpenSSL cipher object
36        virtual const EVP_CIPHER *GetCipher() const;
37       
38        // Setup any other parameters
39        virtual void SetupParameters(EVP_CIPHER_CTX *pCipherContext) const;
40
41        virtual std::string GetCipherName() const
42        {
43                std::ostringstream out;
44                out << "AES";
45                out << mKeyLength;
46                return out.str();
47        }
48        virtual CipherMode GetCipherMode() const { return mMode; }
49
50#ifdef HAVE_OLD_SSL
51        CipherDescription *Clone() const;
52        void SetIV(const void *pIV);
53#endif
54
55private:
56        CipherDescription::CipherMode mMode;
57#ifndef HAVE_OLD_SSL
58        const void *mpKey;
59        unsigned int mKeyLength;
60        const void *mpInitialisationVector;
61#else
62        std::string mKey;
63        uint8_t mInitialisationVector[8];
64#endif
65};
66
67
68#endif // CIPHERBLOWFISH__H
69
Note: See TracBrowser for help on using the repository browser.