4 ms·
> Inability to encrypt more than 64Gb with the same (key,nonce) pair. I think a better way is to derive the content per file part and then use a ratcheting non
by vlovich123 3y ago
> Inability to encrypt more than 64Gb with the same (key,nonce) pair.
I think a better way is to derive the content per file part and then use a ratcheting nonce to encrypt the subparts. That also gives you random access into the entire file in ~O(1) (i.e. no need to decrypt the entire file) and the ability to interrupt and resume decryption. Unfortunately, there's no standard that describes how the output should be serialized, so tool interop becomes a problem. Although, to be fair, there's no serialization standard for AES either (i.e. what do you do with the nonce?) so it's probably not a big deal.
- goalieca 3y agoThe issue with 64GB is one thing. Not many people encrypt single 64GB files. But people do use aes-gcm for tunnels and encrypting billions of messages and you can only use the key so many times before you have to rotate. Many people screw this part up.
- fargle 3y agoI think it's easier than that. When using the IV using a 96 bit fixed field and 32 bit counter, FIPS SP800-38d says you are limited to 2**32 "invocations of the authenticated encryption function with any given fixed field and key". What they call the fixed field is the common 96 bit IV or nonce. So you can do 512Gb or 64GB under one nonce. Then simply increment the fixed field and run the next 64GB under the same key and new nonce (nonce+1) and so on. In essence, it's the same thing is just making the fixed field smaller and the counter bigger, but meets the letter and intent of the law. The "fixed field" can be anything the user wants, including being "constructed from two or more smaller fields". And it is not constrained to remain the same under multiple invocations. Still compatible with FIPS and common implementations. It doesn't have to be some fancy ratcheting scheme. The initial "fixed field" or nonce could even always just be all zeros [1]. It doesn't matter, it's not secret. If for some reason you want to encrypt that much under one key, which I think you really don't. 1: well, in most cases especially AES-256: https://crypto.stackexchange.com/questions/68774/can-a-zero-nonce-be-safely-used-with-aes-gcm-if-the-key-is-random-and-never-used https://crypto.stackexchange.com/questions/68774/can-a-zero-...
- tptacek 3y agoThe problem with this is that if the nonce ever collides under the same key, GCM's security falls to pieces, and so if you're using the nonce as an extended counter --- a thing people do, in part because they're worried 96 bits is too short to safely choose randomly --- you have to design a system that can't use the nonce "0" (or "1" or "2") twice. If all your keys are ephemeral this isn't a big worry, but if they aren't, you can end up talking about reliably keeping state between invocations of your whole program. (Apologies if this is obvious!)
- cyberax 3y ago> GCM's security falls to pieces That's an exaggeration. Reusing the nonce in GCM allows decryption of messages with the same nonce. It does NOT compromise the key.