mirror of
https://github.com/vgough/encfs.git
synced 2024-11-29 03:15:07 +01:00
a89752dfe7
git-svn-id: http://encfs.googlecode.com/svn/trunk@121 db9cf616-1c43-0410-9cb8-a902689de0d6
44 lines
908 B
C++
44 lines
908 B
C++
#ifndef ENCFS_MAC_H
|
|
#define ENCFS_MAC_H
|
|
|
|
#include <string>
|
|
|
|
#include "base/Registry.h"
|
|
#include "base/types.h"
|
|
#include "cipher/CipherKey.h"
|
|
|
|
namespace encfs {
|
|
|
|
static const char NAME_SHA1_HMAC[] = "SHA-1/HMAC";
|
|
|
|
// MAC provides keyed MessageAuthenticationCode algorithms, eg HMAC.
|
|
class MAC {
|
|
public:
|
|
DECLARE_REGISTERABLE_TYPE(MAC);
|
|
|
|
struct Properties {
|
|
int blockSize; // Block length of hash function.
|
|
std::string hashFunction;
|
|
std::string mode;
|
|
std::string library;
|
|
|
|
std::string toString() const { return hashFunction + "/" + mode; }
|
|
};
|
|
|
|
MAC();
|
|
virtual ~MAC();
|
|
|
|
virtual int outputSize() const = 0;
|
|
|
|
virtual bool setKey(const CipherKey &key) = 0;
|
|
|
|
// Init must be called before any calls to update.
|
|
virtual void init() = 0;
|
|
virtual bool update(const byte *in, int length) = 0;
|
|
virtual bool write(byte *out) = 0;
|
|
};
|
|
|
|
} // namespace encfs
|
|
|
|
#endif // ENCFS_MAC_H
|