We are having a requirement to store large files (~1GB) encrypted and decrypt them when reading. We are looking to use AES-CTR or AES-GCM mode to encrypt the data. There are scenarios where we want to divide the files into chunks/blocks and then decrypt these chunks in parallel. So my question is that is it possible to do it with these algorithms? If yes, what are considerable points while doing it. If no, how best to achieve it (the main requirement is to achieve parallelism).
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
With AES-CTR, it is trivial; it's actually one of the advantages of using the scheme. In AES-CTR, there is a counter which is incremented for each block, encrypted, and then XOR'ed to the ciphertext in order to obtain the plaintext. To parallelize the decryption of, e.g., 100 blocks, you simply encrypt the counter for the 1st-50th blocks in one thread and the counter of the 50th-100th blocks in another (simply add 50 to the initial counter value and start from there).
AES-GCM is more or less the same, since it also uses something like CTR internally for encryption. You will have to also check the authenticity, but this can also be done in parallel. (Some people are not confortable with starting decryption before checking the authenticity, but that's another discussion...)