31 #ifndef BASELIB_SECURITY_GCRYPT_H_ 32 #define BASELIB_SECURITY_GCRYPT_H_ 34 #include "../Exception.h" 78 unsigned int _flags = 0;
83 gcry_cipher_hd_t _handle =
nullptr;
94 Gcrypt(
int algorithm,
int mode,
unsigned int flags);
119 static std::string getError(int32_t errorCode);
124 size_t getBlockSize();
131 template<
typename Data>
void setIv(
const Data& iv);
138 void setIv(
const void* iv,
const size_t length);
145 template<
typename Data>
void setCounter(
const Data& counter);
152 void setCounter(
const void* counter,
const size_t length);
159 template<
typename Data>
void setKey(
const Data& key);
166 void setKey(
const void* key,
const size_t length);
173 void encrypt(
void* out,
const size_t outLength,
const void* in,
const size_t inLength);
180 template<
typename DataOut,
typename DataIn>
void encrypt(DataOut& out,
const DataIn& in);
187 void decrypt(
void* out,
const size_t outLength,
const void* in,
const size_t inLength);
194 template<
typename DataOut,
typename DataIn>
void decrypt(DataOut& out,
const DataIn& in);
199 bool authenticate(
const void* in,
const size_t inLength);
204 template<
typename DataIn>
bool authenticate(
const DataIn& in);
Definition: BaseLib.cpp:34
std::shared_ptr< Gcrypt > PGcrypt
Definition: Gcrypt.h:207
Exception class for Gcrypt.
Definition: Gcrypt.h:51
gcry_cipher_hd_t getHandle()
Returns the underlying gcry_cipher_hd_t.
Definition: Gcrypt.h:111
GcryptException(const std::string &message)
Definition: Gcrypt.h:54
Base class for all exceptions defined in Homegear.
Definition: Exception.h:41