Public Overrides Function GetBytes()As Byte()已过时

时间:2009-09-29 18:34:20

标签: security cryptography rijndael obsolete rfc2898

诗人试图说什么?

Public Overrides Function GetBytes()As Byte()已废弃:Rfc2898DeriveBytes替换PasswordDeriveBytes以从密码中派生密钥材料,并且在新应用程序中是首选。

我应该更换这个......

Dim keyBytes As Byte()
keyBytes = password.GetBytes(keySize / 8)

......用什么?

3 个答案:

答案 0 :(得分:6)

您缺少代码的关键部分。声明密码的部分是PasswordDeriveBytes。将其改为Rfc2898DeriveBytes,你很好。

答案 1 :(得分:3)

// Constructor needs parameters...fill in with yours
Dim password as new Rfc2898DeriveBytes(yourParamsHere)

Dim keyBytes As Byte()
keyBytes = password.GetBytes(keySize / 8)

答案 2 :(得分:1)