Apologies if this has been asked before.

I am looking to encrypt documents before storing in the cloud.

There will be a separate metadata storage, which could be either internal or cloud hosted.

My strategy would be to generate a new symmetric key for each document (or batch of documents if key generation is expensive), and then to encrypt the key used with another 'global' key (symmetric or asymmetric) and recording this encrypted key within the metadata storage.

The documents are safe so long as the global key is not compromised, but it could make key management easier since changing the global key means reencrypting the key used in metadata only, rather than having to reencrypt the cloud hosted document.

Does this sound a sensible strategy, or is there a better one you could recommend?

  • what have you defined as your threat? what is the purpose of encrypting the per-document key? have you considered an encrypted volume that you store in the cloud and place all your documents in that volume?
    – schroeder
    Apr 7, 2015 at 23:17
  • Have you looked into Safe Monk for Drop Box?
    – KnightHawk
    Apr 8, 2015 at 3:49
  • Defining your threats is important here, as @schroeder mentioned. In particular, are you concerned about authentication of the documents? AES-CBC (for example) doesn't provide this, and it is relatively easy to tamper with encrypted files, injecting data without knowing the key used to encrypt.
    – randomdude
    Apr 8, 2015 at 12:16

1 Answer 1


First, it's no problem to use a different symmetric key for each document, generation is easy as you just have to generate a 16-64 byte random string, a matter of a millisecond (mostly).

As threats I guess you consider your cloud hoster and anyone who can get their hands on the documents.

The approach you propose should work.
The document needs to be encrypted and authenticated using an AEAD mode like AES-GCM.
You add a header (which may be stored on the metadata storage, no matter where), which is authenticated and encrypted (using an AEAD mode like AES-GCM) using your master-key.

Scenario 1: You do this for personal access. You can store the metadata locally or on the cloud, it won't make a difference.
You should use password-based key derivation to derive the master key from your password. The master-key will be symmetric and be used to encrypt+authenticate/decrypt+verify the file-header.

Scenario 2: You do this for a company, or a larger group of people. You should go with cloud-hosting the meta-data so everyone has access if needed.
You store the header encrypted as described above.
You give everyone a copy of the master-key, so they can encrypt it using their very own password (again using authenticaed encryption + PBKDF)

  • Thanks for the response. I just need to validate with our InfoSec team before accepting :-)
    – toolkit
    Apr 8, 2015 at 15:51

You must log in to answer this question.

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