encfs/cipher/MAC.h
Valient Gough 63c2d1c539 add CommonCrypto support, other misc fixes
git-svn-id: http://encfs.googlecode.com/svn/trunk@97 db9cf616-1c43-0410-9cb8-a902689de0d6
2013-03-05 06:39:51 +00:00

47 lines
916 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