I touched on this in an above comment[1] (after you posted so I didn't expect you to see it), but essentially because of how AES CBC[2] encryption works, an encrypted block relies on the previous block to correctly be decrypted. Uploading and replacing blocks that are different will not work; the next time that file is decrypted every block after the first newly uploaded one will not be correct.
You could for example use ECB, OFB or CTR mode and actually update the file (some options are obviously a bad choice) but I thought of storing the file and the diff together and only apply the diff after decryption so there is no need to mess with the encrypted data in the first place.
Comments
I touched on this in an above comment[1] (after you posted so I didn't expect you to see it), but essentially because of how AES CBC[2] encryption works, an encrypted block relies on the previous block to correctly be decrypted. Uploading and replacing blocks that are different will not work; the next time that file is decrypted every block after the first newly uploaded one will not be correct.
[1] -- https://news.ycombinator.com/item?id=7787791
[2] -- http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#...
You could for example use ECB, OFB or CTR mode and actually update the file (some options are obviously a bad choice) but I thought of storing the file and the diff together and only apply the diff after decryption so there is no need to mess with the encrypted data in the first place.