.NET: Difference between PasswordDeriveBytes and Rfc2898DeriveBytes

前端 未结 4 1184
时光说笑
时光说笑 2021-02-08 09:32

I\'m trying to understand some C#-code, I have been handed, which deals with cryptography, and specifically uses PasswordDeriveBytes from System.Security.Cryp

4条回答
  •  有刺的猬
    2021-02-08 10:16

    I think a great answer to this would be found here:

    C# PasswordDeriveBytes Confusion

    But to sumup:

    Microsoft's implementation of original PKCS#5 (aka PBKDF1) include insecure extensions to provide more bytes than the hash function can provide (see bug reports here and here).

    Even if it was not buggy you should avoid undocumented, proprietary extensions to standards (or you might never be able to decrypt your data in the future - at least not outside Windows.)

    I strongly suggest you to use the newer Rfc2898DeriveBytes which implements PBKDF2 (PKCS#5 v2) which is available since .NET 2.0.

提交回复
热议问题