encapsulate old cipher support layer

git-svn-id: http://encfs.googlecode.com/svn/trunk@95 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough
2013-03-05 06:36:32 +00:00
parent f00ef5c6d3
commit 7e95ff90c8
57 changed files with 1705 additions and 2320 deletions

View File

@ -21,18 +21,40 @@
#ifndef _CipherKey_incl_
#define _CipherKey_incl_
#include <cstring>
#include "base/shared_ptr.h"
#include "base/types.h"
namespace encfs {
class AbstractCipherKey
class SecureMem;
class CipherKey
{
public:
AbstractCipherKey();
virtual ~AbstractCipherKey();
public:
CipherKey(); // Creates a key for which valid() returns false.
explicit CipherKey(int length);
CipherKey(const byte *data, int length);
CipherKey(const CipherKey& src);
~CipherKey();
void operator = (const CipherKey& src);
byte *data() const;
int size() const;
// Clear memory associated with key.
void reset();
bool valid() const;
private:
bool _valid;
shared_ptr<SecureMem> _mem;
};
typedef shared_ptr<AbstractCipherKey> CipherKey;
bool operator == (const CipherKey &a, const CipherKey &b);
} // namespace encfs