Encrypt/Decrypt in VS.NET 2005
Posted on 2006-11-07
In VB.NET 2003, I have following code:
Dim password As PasswordDeriveBytes
password = New PasswordDeriveBytes(mstrPassPhrase, _
' Use the password to generate pseudo-random bytes for the encryption
' key. Specify the size of the key in bytes (instead of bits).
Dim keyBytes As Byte()
keyBytes = password.GetBytes(CInt(mintKeySize / 8))
' Create uninitialized Rijndael encryption object.
Dim symmetricKey As RijndaelManaged
symmetricKey = New RijndaelManaged
But when I open this project in 2005, it shows that PasswordDeriveBytes is obselete. I tried to use the new method and wrote the code as follows. But where do I specify the algorithm like the did above?
The new code is:
Dim password As Rfc2898DeriveBytes
'Dim password As PasswordDeriveBytes
password = New Rfc2898DeriveBytes(mstrPassPhrase, saltValueBytes, mintPasswordIterations)
If you see the above code, there is no parameter to specifiy 'MD5'.