Public Overrides GetBytes () Function Since Byte () is deprecated

What is the poet trying to say?

Public Override Function GetBytes () Because Byte () is deprecated: Rfc2898DeriveBytes replaces PasswordDeriveBytes to get key material from a password and is preferred in new applications.

Should I replace this ...

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

      

... with what?

+2


source to share


3 answers


You are missing an important piece of code. This is the part that declares the PasswordDeriveBytes password. Change that to Rfc2898DeriveBytes and you're good to go.



+6


source


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

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

      



+3


source


+1


source







All Articles