| 252 | } |
| 253 | |
| 254 | void AuthenticatedSymmetricCipher::SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength) |
| 255 | { |
| 256 | if (headerLength > MaxHeaderLength()) |
| 257 | throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": header length " + IntToString(headerLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength())); |
| 258 | |
| 259 | if (messageLength > MaxMessageLength()) |
| 260 | throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": message length " + IntToString(messageLength) + " exceeds the maximum of " + IntToString(MaxMessageLength())); |
| 261 | |
| 262 | if (footerLength > MaxFooterLength()) |
| 263 | throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": footer length " + IntToString(footerLength) + " exceeds the maximum of " + IntToString(MaxFooterLength())); |
| 264 | |
| 265 | UncheckedSpecifyDataLengths(headerLength, messageLength, footerLength); |
| 266 | } |
| 267 | |
| 268 | 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) |
| 269 | { |