I'm trying to decide on which ciphermode to use for a programming excercise. I have a file that I need to encrypt without saving unencrypted data to storage and without storing the entire file in memory.
I've opted for streaming the file, in a fixed size into a buffer, encrypting said buffer, write said buffer to storage and clear the buffer before doing it all again with the next slice of data.
Once the encrypted chunks had been written to storage, they could be consolidated into a single file, which would have to be split into chunks again for decryption.
The above seems like a standard way of doing it, from what I could gather, but I'm not entirely sure as to which ciphermode to use.
I was wondering which of AES-GCM and AES-CBC would be best to use?
Ideally I'd like to choose a solution that is "encrypt-then-mac", but I'm unsure which of those fit the bill here?
The programming language I'm doing this in is Golang, if that matters to anyone.