0
$\begingroup$

Here is a hypothetical application of AES-CTR encryption.

Encryption:

  • Step 1: Generate random key and IV for new object;
  • Step 2: Use said key and iv to encrypt some data, which is then stored on a content server;
  • Step 3: Encrypt key and IV using some secret master key, and store the wrapped keys in a database table.

Important: For each new object that we want to encrypt, a new key and IV are randomly generated.

Decryption:

  • Step 1: Retrieve encrypted key and IV relevant to object that we want to decrypt
  • Step 2: Decrypt key and IV using master key
  • Step 3: Use decrypted key and IV to decrypt object

I would like to know if this is an acceptable way to proceed with AES-CTR (assuming the master key is handled securely, and we are also hashing content to ensure integrity)?

If not, could you please suggest a more secure way to manage key and iv for a given object?

$\endgroup$
1
$\begingroup$

Yes this seems secure.

Note that for CTR we use a nonce not an IV but it has similar role. Depending on your operational requirements there may be simpler secure methods. The key question is how the shared secret is managed, of course.

$\endgroup$
  • $\begingroup$ Thanks for the answer. Do you see a problem with key/nonce combo to re-encrypt the same object? Is that something that should be avoided? $\endgroup$ – Locust5304 Oct 20 '17 at 13:45
  • $\begingroup$ I'm not sure what you mean. Encrypting the same plaintext many times with different keys is fine. Decrypting and reencrypting with a new key is fine. Encrypting an object key with several different master keys is also fine(to allow sharing). $\endgroup$ – Meir Maor Oct 20 '17 at 14:40
  • $\begingroup$ Sorry, my question was not really clear. I see from your answer that we must avoid reencrypting the same content with the same key. Is that correct? $\endgroup$ – Locust5304 Oct 20 '17 at 15:48
  • $\begingroup$ Using same key for same object with different nonce/IV is fine. If you encrypt the same object with same nonce&key an observer could know it is the same object. The big no no is to reuse both key and nonce for different data. $\endgroup$ – Meir Maor Oct 20 '17 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.