思考这些下面两种情况,哪一个是最好的,最安全的一个2加密/散列的情况下,哪一个是最好
第一种情况
//key1 generated from static salt and user password, because in case attacker don't know about source code (bad assumption, but still my assumption), attacker have only hashed or encrypted data + random generated salt
staticSalt = "StaticSalt"
key1 = pbkdf2(userPassword, staticSalt, iteration)
//key2 generated from key1 and randomSalt, this will be actual key to be used for encryption
randomSalt = GenerateRandomSalt()
key2 = pbkdf2(key1, randomSalt, iteration)
aes.Key = Key2
aes.IV = aes.GenerateIV()
或
第二种情况
//directly generate key from randomSalt and password
randomSalt = GenerateRandomSalt()
key1 = pbkdf2(userPassword, randomSalt, iteration)
aes.Key = Key1
aes.IV = aes.GenerateIV()
我的问题是,使用第一种情况是否有任何缺点,它会增加或减少熵,或使得不太安全?
或者第二种情况是远远更好的和安全的方式做
寻找一些加密专家的回答。
如果您将其发布在http://crypto.stackexchange.com/上,您很可能会收到适当的回复。 –
案例1应该提供的额外步骤有什么好处?如果这只是你在PBKDF2算法的基础上抛出的一个含糊不清的想法,比如“更多扰乱更好”,这可能不会有帮助。 – user2357112