-
Notifications
You must be signed in to change notification settings - Fork 292
Description
Hey, its me again ;)
Since you checked Cryptomator's encryption scheme I think it is fair to return the favour. In your latest release you increased the nonce size. I think this is a questionable decision. It is highly recommended to use 96 bit nonces, as there is a strange if/else construction in GCM mode, which adds a lot of complexity for non-96-bit-nonces (leading to less easily provable security).
The second is that, when the nonce N is not 96 bits, the pseudorandom function Prf is not simply the blockcipher E. Instead, it is a rather complex construction that involves applying a polynomial-based hash to a padded and length-annotated N, keyed by the same key that is used for the hash Hash, and then applying the blockcipher E.
See http://web.cs.ucdavis.edu/~rogaway/papers/modes.pdf Chapter 12 for an in-detail analysis.
Of course the downside of using shorter nonces is the higher risk of collisions. If you choose a per-file-key instead of using the masterkey, you only have to worry about collisions within a file. I think it is fair to say those collisions will practically never happen for reasonable sized 😉 files.
I suggest to reverting the latest change and use 96 bit nonces again (not to be confused with the authentication tag size!) and introducing per-file-keys.