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

@ -26,26 +26,32 @@
#include "base/Registry.h"
#include "base/shared_ptr.h"
#include "base/types.h"
#include "cipher/CipherKey.h"
namespace encfs {
static const char NAME_AES_CFB[] = "AES/CFB";
static const char NAME_BLOWFISH_CFB[] = "Blowfish/CFB";
class StreamCipher
{
public:
static Registry<StreamCipher>& GetRegistry();
DECLARE_REGISTERABLE_TYPE(StreamCipher);
struct Properties {
Range keySize;
std::string cipher;
std::string mode;
std::string library;
std::string toString() const {
return cipher + "/" + mode;
}
};
StreamCipher();
virtual ~StreamCipher();
virtual bool setKey(const byte *key, int keyLength) =0;
virtual bool randomKey(int keyLength) =0;
virtual bool setKey(const CipherKey& key) =0;
virtual bool encrypt(const byte *iv, const byte *in,
byte *out, int numBytes) =0;