I have a requirement to read-encypt-save plus its reverse i.e. read-decypt-save files through chunk/block mechanism (single operation not feasible because of huge(GBs) file sizes).
So essentially the two functionalities should work as below :
- loop (read-plain-text-block-from-external-source -> encrypt -> save-encrypted-text-block-to-external-target)
- loop (read-encrypted-text-block-from-external-source -> decrypt -> save-plain-text-block-to-external-target)
Also requirement is to have flexibility to use different chunk/block sizes while encryption / decryption. so either party (Encrypter or Decrypter) does not know other's size at all.
Now we have successfully implemented this functionality using AES/CBC/PKCS5Padding but we are facing issues while trying the same using AES/GCM/PKCS5Padding. Decryption was returning blank plain chunks and we finally received aggregated plain chunks at loop completion. this stops us from saving individual decrypted-chunks to external target during single iteration of the loop.
Any idea if AES/GCM/PKCS5Padding is even an option for our use case ? what must be causing above issue ?