| 202 | } |
| 203 | |
| 204 | void AuthenticatedSymmetricCipher::SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength) |
| 205 | { |
| 206 | if (headerLength > MaxHeaderLength()) |
| 207 | throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": header length " + IntToString(headerLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength())); |
| 208 | |
| 209 | if (messageLength > MaxMessageLength()) |
| 210 | throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": message length " + IntToString(messageLength) + " exceeds the maximum of " + IntToString(MaxMessageLength())); |
| 211 | |
| 212 | if (footerLength > MaxFooterLength()) |
| 213 | throw InvalidArgument(GetAlgorithm().AlgorithmName() + ": footer length " + IntToString(footerLength) + " exceeds the maximum of " + IntToString(MaxFooterLength())); |
| 214 | |
| 215 | UncheckedSpecifyDataLengths(headerLength, messageLength, footerLength); |
| 216 | } |
| 217 | |
| 218 | 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) |
| 219 | { |