Is there any way to encrypt a file incrementally? The problem is that I receive a file a chunk at a time via Internet (it's a client-server application and I send byte arrays via a WCF service) and I don't know when the next chunk is going to arrive (if any) and what is it's size. Everything I know is that I can't store it into RAM, I immediately need to cypher it and append it to the previous chunks.
Constraints:
- I can't impose a chunk size;
- I would like (if possible) to decrypt the file like if it was encrypted as a single file;
- I can't store the chunks without cyphering them;
- I can't store the various chunk sizes nor store the chunks into different files;
- I'm using an AES algorithm;
- I can't change my job.
Any ideas or suggestions?