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();


-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/cryptopp-users/579512a3-7dd1-4734-be29-74920f25fa2en%40googlegroups.com.

Reply via email to