Hi there.

I'm working on a feature, which needs to receive a bunch of parts of a
file (from resumableJS), and then encrypt them, upload them to S3, and
stich them together.

Firstly: The files are extremely large - thus the need for resumableJS
on the front-end - so the application cannot keep them in memory. This
means that I need to encrypt each part when I receive it, and them push
it to S3 directly using a multipart upload.

I'm using this implementation of the AES-256-CBC algorithm:

  # ruby
  data = aes.update(part)
  data << aes.final if final_part?
  s3_object.write(data)

Because of the asynchronous nature of the code, I can't be certain to
receive the parts in order. This means, that I might receive the last
part in the middle, which means I will be calling `final` before the
actual final part of the encryption.

So my question is: Does `final` actually finalize the encryption in the
sense that you cannot use the algorithm instance after it has been
called? or?

Best regards, and thanks in advance

Emil

-- 
Posted via http://www.ruby-forum.com/.