Assuming that I want to encrypt a 1 GB file with e.g. AES in GCM mode or ChaCha20Poly1305.
[I'm specifically referring to the cryptography module for Python: https://cryptography.io/en/latest/hazmat/primitives/aead/ but I can't find anything in the documentation]
For "non-AEAD" ciphers, the syntax is basically
cipher = Cipher(key) cipher.encrypt(data)
and I can call .encrypt() as many times as I like.
However for AEAD ciphers, the syntax is
aead = AEAD(key) aead.encrypt(nonce, data, associated_data)
So I need to pass "nonce" and "associated_data" as arguments when I want to encrypt "data".
I understand that the last 16 bytes of the cipher text are used to ensure the integrity and that the AEAD ciphers can operate on data up to 2^31-1 bytes.
Does that mean that I can't read and encrypt the file in chunks, I have to load the whole file into memory and there's essentially no way to encrypt anything beyond 2 GB? (It can't possibly be correct to pass the nonce as an argument every time I encrypt a data chunk...)