1

Are there any security benefits to having a different key(it is encrypted by a master key and that encrypted key is included in the metadata for the file) used to encrypt each file versus just one key that is the same for all?

Assuming the crypto is fairly well designed, there shouldn't be any real security benefits, but from an architectural point of view I suppose it does provide some flexibility for changing keys.

Is that right?

1

Are there any security benefits to having a different key(it is encrypted by a master key and that encrypted key is included in the metadata for the file) used to encrypt each file versus just one key that is the same for all?

Maybe I misunderstand, but if you encrypt all files with "the same [key] for all", then once that key gets disclosed, all your files are potentially endangered. That's the "drawback" of the system.

On the other hand if you use a different key for every file, this cannot happen.

By not using the key directly, but rather using the key to encrypt a random presumaby unique nonce, and using the nonce to encrypt/decrypt the file, you get the unrelated benefit of being able to change a file's access token without need to reencrypt it.

It is to be noted, though, that when the file has been decrypted at least once, the nonce is to be considered known. At that point, changing the access token only protects the file against someone who has never read the file:

Alice chooses a nonce ("ABCDEF"). Maybe she is even unaware of its value.
Alice encrypts the nonce with a password "FOO", obtaining "XWSQPR".
Alice encrypts a very large file with "ABCDEF".
<XWSQPR:FILEABCDEF> is the new encrypted file.

Eve receives "FOO" from Alice, decrypts "XWSQPR" obtaining "ABCDEF",
and uses "ABCDEF" to successfully decrypt the file.

Alice fears that Eve may misuse the file. She knows that Eve has not
had the time nor the storage space to copy the decrypted file anywhere.
So she changes the password to "BAR". "ABCDEF" encrypts now to "PHWIIN"
and <PHWIIN:FILEABCDEF> is the new encrypted file. Only the header has
been rewritten, so the operation is very fast.

Bob, not knowing "BAR", cannot decrypt "PHWIIN" and cannot read the file.

Eve, on the other hand, cannot decrypt "PHWIIN" either, but does not need
to; the body of "FILEABCDEF" is still decryptable using the "ABCDEF" nonce
which is known to her. As soon as she gains access to the encrypted file,
she will be able to decrypt it even if she may need a specific tool to do
so, not the standard encryption/decryption tool used by Alice and Bob.

Using the same nonce for all files, encrypted with different passwords, yields the worst of both worlds - once one access token is revealed, all files are disclosed, whatever their access tokens.

1
  • Yeah, for sure, I see from a high level architectural view the benefits (and they're very good) But I'm wondering if there is any attacks which can benefit from using the same key for multiple files versus a different key for each file. The only one I came up with was some kind of known text attack, but the argument is that a well design crypto using IVs would defeat that.
    – Blaze
    Apr 25 '14 at 6:12
0

You are correct. Per-file encryption gives the benefit of changing the keys or passwords used to decrypt it without re-encrypting the file. It also lets you encrypt a file to multiple keys. That's basically how PGP works when you encrypt a file. The password that needs to be entered to decrypt the file can be changed without rewriting the whole file. Furthermore, with PGP, you can change the password to a file that has been encrypted to your public key by changing the password to your secret key, and it can be done even if you don't have the encrypted file yet! It's the extra indirection that provides this ability.

The other benefit to per-file keys is also extra security. Since each individual file has its own key, the cracking of one file does not aid in the cracking of another.

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.