1

I have an integration workflow where:


  1. A server retrieves remote file via an encrypted connection. The file is unencrypted. The server runs linux (Ubuntu 14.04LTS).

  2. The file is downloaded to a temporary staging directory. It could be large (100MB-2GB) so it's not practical to keep it in memory.

  3. The file is encrypted and stored in a secure location for data at rest. The unencrypted file (from step #2) is deleted using srm.


My question is about step #2

Under this workflow, there is a brief window of time in step #2 where the file sits unencrypted on the server, before it is purged by srm. Is this a reasonable way to deal with unavoidable file staging-before-encryption, or is there a more contemporary way to perform this staging?

Thanks in advance.

1 Answer 1

5

I'd recommend simply encrypting the file while it's being uploaded, and before it's written to disk. i.e. encrypt the file while it's being streamed. Assuming you're getting the file in order you can just use standard AES-CBC to encrypt all the blocks of the file and save it to disk.

The window of time while the file isn't encrypted isn't terribly worrisome, but it's inefficient to write the file 2 times to disk, then have to wipe the file. That way you only write once to the disk for every byte instead of 3 times.

2
  • I wasn't aware that was possible with AES, so this is a great answer, thanks!
    – tohster
    Commented Mar 16, 2015 at 16:26
  • @tohster AES is just a block cipher that works on one block at a time. CBC mode only requires the previous block, so you don't need the entire file to start encrypting the first part. Commented Mar 16, 2015 at 21:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .