How to update part of the encrypted data with newly encrypted data?

耗尽温柔 提交于 2019-12-03 21:52:46

I suggest you update several things:

  1. you are opening multiple outputstreams to the SAME file, which is very strange, the runtime should not allow you to do that. So - write only with a single output if you want any predictable results.

  2. You may read about the mode of operations see the CRT mode uses no padding and allows you to update only a portion of the ciphertext (assuming you use no authenticated encryption). So AES/CTR/NoPadding could solve your problem. (and there should be no extra bytes if you do it correctly)

  3. you can update a portion of the file using the RandomAccessFile and overwrite portion of the ciphertext what is needed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!