Using cryptopp 8.9 on debian 12.11 with gcc 14.2 I have an AES/GCM encryption program which I am running on a large file (75GB). It is failing with the error "AES/GCM: message length exceeds maximum". I searched around and found information which suggests the maximum file size should be 2**39-256, which is a bit less than 550GB. So it is not clear to me why I am getting this error message. Any ideas on what kind of bug I should be looking for? As a second question, anyone have any advice on ways to handle large files which it is desirable to encrypt? This is not the largest file I would like to encrypt and it is plausible I would hit the 2**39-256 limit.
The relevant code looks like this:
CryptoPP::GCM<CryptoPP::AES>::Encryption encryptor;
encryptor.SetKeyWithIV(reinterpret_cast<const CryptoPP::byte *>(key.data())
, KeyBytes
, iv.bytes
, IVBytes
);
CryptoPP::AuthenticatedEncryptionFilter filter(encryptor);
CryptoPP::FileSource source(plainfile.c_str(), false);
CryptoPP::FileSink sink(cipherfile.c_str());
CryptoPP::ArraySource(iv.bytes, IVBytes, true, new CryptoPP::Redirector(sink));
source.Attach(new CryptoPP::Redirector(filter));
filter.Attach(new CryptoPP::Redirector(sink));
while (!EndOfFile(source) && !source.SourceExhausted())
{
source.Pump(TransferBytes);
filter.Flush(false);
}
filter.MessageEnd();