7.2 CHUNKY GCM
EXERCISE 7.2: CHUNKY GCM
Modify the document encryption code from earlier in the chapter to encrypt in chunks no larger than \(4096\) bytes. Each encryption will use the same key, but a different nonce. This change means that rather than storing one IV and one tag at the top of the file, you will need to store an IV and a tag with each encrypted chunk.
This is an exercise for purely theoretical purposes. This is because, it doesn’t make sense to encrypt by “chunks” for on-disk purposes.
As mentioned in the book, this makes sense when you are using AES-GCM for over the network communications.