when i was reading the latest source code of openssl, i found openssl enc has
an 8-byte (64-bit) salt length; because the same (password, salt, iter) will
generate the same (key, iv), birthday paradox tells that you may reuse a
(key, iv) pair within about 2^32 encryptions;
openssl source:
// apps/enc.c;
int enc_main(int argc, char **argv)
{
...
unsigned char *buff = NULL, salt[PKCS5_SALT_LEN];
...
}
// include/openssl/evp.h;
define PKCS5_SALT_LEN 8
personally i do not think 2^32 (around 4 billion) is a very large number; there are almost 8 billion people around the world now; in some use cases there are a lot of personal data records that need to be encrypted; the number is even larger when you include other animals such as cats and dogs;
pkcs #5 (in 2017) recommends at least 64-bit salt length; while nist (in 2010) says you shall use at least 128-bit salt length; there is also a github issue proposed in 2017;
my questions:
is 64-bit salt length deemed secure right now? if so, why does nist said you shall use at least 128-bit salt length 7 years earlier?
isopenssl encmeant for production use or only a demo of the openssl library?if the salt length cannot be easily improved in openssl, what other libraries and shell tools are both secure and easy to use?
What would worry me here is that a 64-bit number can be brute forced. Not easily, but it's possible. The sufficiency here depends on what you're protecting and who you think might try to break the encryption.
I tell my teams to always use 128 bits of salt or more.
– Swashbuckler Dec 06 '19 at 16:04openssl encuses below 1.1.1 (also openssl 'traditional' = nonPKCS8 privatekey files) is mostly PKCS5 v1 which was current in 1995 when EAY started and is now called PBKDF1 -- WITH ONLY ONE ITERATION which is a much worse problem than the salt size -- see https://crypto.stackexchange.com/questions/3298/ and https://crypto.stackexchange.com/questions/36981/ (mine) and https://security.stackexchange.com/questions/29106/openssl-recover-key-and-iv-by-passphrase (ursine). – dave_thompson_085 Dec 07 '19 at 05:16openssl enchas been asked and discussed many times; I'll try to find my notes on this later. – dave_thompson_085 Dec 07 '19 at 05:29opensslcommand line usage, I doubt if you cannot call that "production use". If it is smart to rely on command line utilities for that is another question of course. As for choice of parameters that should be on merit of how the parameters influence security, not on some kind of evaluation on the software component as a whole. It's meant for production use, so it is secure? Really? That's not the security market as I know it. – Maarten Bodewes Dec 07 '19 at 14:04