5 #ifndef CRYPTOPP_IMPORTS 13 unsigned int blockSize = AuthenticationBlockSize();
14 unsigned int &num = m_bufferedDataLength;
19 if (num+len >= blockSize)
21 memcpy(data+num, input, blockSize-num);
22 AuthenticateBlocks(data, blockSize);
23 input += (blockSize-num);
24 len -= (blockSize-num);
30 memcpy(data+num, input, len);
31 num += (
unsigned int)len;
39 size_t leftOver = AuthenticateBlocks(input, len);
40 input += (len - leftOver);
45 num = (
unsigned int)len;
144 throw InvalidArgument(
AlgorithmName() +
": additional authenticated data (AAD) cannot be input after data to be encrypted or decrypted");
virtual bool AuthenticationIsOnPlaintext() const =0
An invalid argument was detected.
const byte * GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size)
Retrieves and validates the IV.
void ProcessData(byte *outString, const byte *inString, size_t length)
Encrypt or decrypt an array of bytes.
Exception thrown when the object is in the wrong state for the operation.
#define NAMESPACE_BEGIN(x)
void Resynchronize(const byte *iv, int length=-1)
Resynchronize with an IV.
lword m_totalFooterLength
virtual void AuthenticateLastHeaderBlock()=0
virtual void SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)=0
virtual lword MaxFooterLength() const
Provides the the maximum length of AAD.
virtual lword MaxHeaderLength() const =0
Provides the maximum length of AAD that can be input.
size_t ThrowIfInvalidIVLength(int length)
Validates the IV length.
virtual void AuthenticateLastFooterBlock(byte *mac, size_t macSize)=0
unsigned int m_bufferedDataLength
void SetKey(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)
Sets or reset the key of this object.
Base implementation for one direction (encryption or decryption) of a stream cipher or block cipher m...
#define CRYPTOPP_ASSERT(exp)
virtual lword MaxMessageLength() const =0
Provides the maximum length of encrypted data.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
virtual void AuthenticateLastConfidentialBlock()
void * memcpy(void *a, const void *b, size_t c)
lword m_totalHeaderLength
void AuthenticateData(const byte *data, size_t len)
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
lword m_totalMessageLength
virtual std::string AlgorithmName() const =0
Provides the name of this algorithm.
void TruncatedFinal(byte *mac, size_t macSize)
Computes the hash of the current message.
virtual void Resync(const byte *iv, size_t len)=0
Base classes for working with authenticated encryption modes of encryption.
virtual SymmetricCipher & AccessSymmetricCipher()=0
Interface for retrieving values given their names.