Public Overrides Function GetBytes() As Byte() is obsolete

3.9k views Asked by At

What does the poet try to say?

Public Overrides Function GetBytes() As Byte() is obsolete: Rfc2898DeriveBytes replaces PasswordDeriveBytes for deriving key material from a password and is preferred in new applications.

Should i replace this one...

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

...with what?

3

There are 3 answers

0
Josip Medved On BEST ANSWER

You are missing crucial part of your code. It is that part that declares password to be PasswordDeriveBytes. Change that to Rfc2898DeriveBytes and you are good.

0
John Boker On
0
Justin Niessner On
// Constructor needs parameters...fill in with yours
Dim password as new Rfc2898DeriveBytes(yourParamsHere)

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