I want to use XChaCha20-Poly1305 to a encrypt plaintext and then decrypt the result. I want to do this by splitting large data into chunks to reduce memory usage.
The encryption and decryption methods without splitting the plaintext into chunks are described below:
But I couldn't find a way to encrypt and decrypt the chunked plaintext. How can I do this? I want the final results of encryption and decryption to be the same for the chunked plaintext and the non-chunked plaintext.
You mean whether you get the same data after decryption as before encryption? Well, obviously yes. But encrypted data will be bigger since it will contain an additional MAC tag for each processed chunk instead of one tag for the whole message as with the "classical" AEAD.
I want to get the ciphertext and the tag for the whole message as with the "classical" AEAD. So I don't think the STREAM construction will achieve my purpose.