Is the same key derived providing the same salt and password using Rfc2898DeriveBytes

夙愿已清 提交于 2019-12-11 16:49:20

问题


I read this tutorial about encryption in .NET

it uses Rfc2898DeriveBytes to create a random key to be used by symmetric algorithm . but it doesn't save the key . and later in decryption method it supplies the same password and salt and decrypts the text .

does it mean supplying the same salt and password to Rfc2898DeriveBytes could derived the same key ? no need to save the key and just save salt and password ?


回答1:


Yes, that is correct. Identical inputs to Rfc2898DeriveBytes provide identical outputs. Otherwise, decryption would not be possible.

The article you reference uses the term "random" loosely. The output of Rfc2898DeriveBytes is not random: but it has high entropy.



来源:https://stackoverflow.com/questions/10884064/is-the-same-key-derived-providing-the-same-salt-and-password-using-rfc2898derive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!