void BlockOrientedCipherModeBase::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) { m_cipher->SetKey(key, length, params); ResizeBuffers(); if (IsResynchronizable()) Resynchronize(GetIVAndThrowIfInvalid(params)); }
bool AuthenticatedSymmetricCipher::DecryptAndVerify(byte *message, const byte *mac, size_t macLength, const byte *iv, int ivLength, const byte *header, size_t headerLength, const byte *ciphertext, size_t ciphertextLength) { Resynchronize(iv, ivLength); SpecifyDataLengths(headerLength, ciphertextLength); Update(header, headerLength); ProcessString(message, ciphertext, ciphertextLength); return TruncatedVerify(mac, macLength); }
void AuthenticatedSymmetricCipher::EncryptAndAuthenticate(byte *ciphertext, byte *mac, size_t macSize, const byte *iv, int ivLength, const byte *header, size_t headerLength, const byte *message, size_t messageLength) { Resynchronize(iv, ivLength); SpecifyDataLengths(headerLength, messageLength); Update(header, headerLength); ProcessString(ciphertext, message, messageLength); TruncatedFinal(mac, macSize); }
void AuthenticatedSymmetricCipherBase::SetKey(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) { m_bufferedDataLength = 0; m_state = State_Start; SetKeyWithoutResync(userKey, keylength, params); m_state = State_KeySet; size_t length; const byte *iv = GetIVAndThrowIfInvalid(params, length); if (iv) Resynchronize(iv, (int)length); }