我正在使用 C# RijndaelManaged 类进行 AES 加密。密钥和 IV 是使用 Rfc2898DeriveBytes 类从输入密码和盐生成的。我的问题是,如果有人获得了输入密码而不是盐,那么破解加密有多难?
1 回答
It would be close to impossible to retrieve the key and IV. Actually, sometimes a static, secret salt stored in source code is used in addition to the public random salt. In that way an attacker is required to get the source or runtime code in addition to the database with the salts and password hashes.
This kind of scheme does require a large enough (secret) salt, say 128 bytes. It would be best to use concatenation to create the combined public and secret salt.
Of course, it is always possible to mess up the encryption otherwise, e.g. by being vulnerable to padding oracle attacks, forgetting an authentication tag (HMAC) in addition to encryption, etc. etc. etc.