Bad crypto practice in Git -encrypt?

Comments to https://gist.github.com/shadowhand/873637 state

"Encryption in ECB mode is a relatively simple encryption method that provides a high level of obfuscation (or low level of encryption). This method is not very secure and should not be used for sensitive personal data, but it will work well, for example, for transferring source code between individuals in public channel. For better protection, you can switch the mode to CBC by changing every file completely for every modification. As with any encryption, it is highly recommended to use a strong key. "

and

"This is sort of (part of) defining functionally correct encryption - ECB (see here for an explanation) is a flawed legacy implementation, recommended by absolutely no one for current use today, and only supported in OpenSSL, since OpenSSL supports some very old and creaky implementations of the cryptographic legacy ! This is only useful today as a learning tool and should never be used on modern systems.

CBC OFB modes should be default. Please consider changing your sense of using CBC and explaining the potential benefits of the ECB along with the downsides for those who would like to accept the security cost for a little convenience in git. Nothing should be unstable by default! "

http://git.661346.n2.nabble.com/Transparently-encrypt-repository-contents-with-GPG-td2470145.html however states that using a fixed salt for CBC is bad crypto practice. If we switched the mode to CBC (for https://gist.github.com/shadowhand/873637 or https://github.com/shadowhand/git-encrypt ) will it use the fixed cost salt and therefore be bad crypto practice?

(I also posted this question as a comment on https://gist.github.com/shadowhand/873637 )

+3


source to share


1 answer


ECB is protected when it is used to encrypt unique blocks. For example, if you have a collection of private keys and want all of them with a master key, ECB is a safe choice.

The ECB is not protected when the same block can be encrypted multiple times. For example, long chunks of natural language likely contain substrings that are repeated. Or, multiple messages of a specific protocol may have the same prefix or suffix. Using ECB with such plain text will show the templates in plain text.



The term "fixed value salt for CBC" has no meaning. Salt is used in key derivation by generating a secret key from a password. CBC requires an "initialization vector" that must be unpredictable for every encrypted message. (Some broken cryptographic protocols in the past have generated IVs and keys from the password; this is only safe if the password is used to encrypt only one message.) Ideally, the IV is generated by a cryptographic random bit generator; using a fixed IV in CBC mode can detect patterns in message prefixes just like ECB.

Finding out if the ECB is safe here will require more context (questions should be self-contained and not include unnecessary information). However, the general expression that the ECB is always insecure is incorrect; it can be secure in the right application, and its shorter ciphers can sometimes be valuable.

+4


source







All Articles