Hi,

I'm trying to decrypt a file with the following code:

vb.net Code:
  1. Function DecryptAES(ByVal CipherText As String, ByVal password As String, ByVal salt As String) As String
  2.         Dim HashAlgorithm As String = h_alg
  3.         Dim PasswordIterations As Integer = 2
  4.         Dim InitialVector As String = iv
  5.         Dim KeySize As Integer = 256
  6.  
  7.         If (String.IsNullOrEmpty(CipherText)) Then
  8.             Return ""
  9.         End If
  10.  
  11.         Dim InitialVectorBytes As Byte() = Encoding.ASCII.GetBytes(InitialVector)
  12.         Dim SaltValueBytes As Byte() = Encoding.ASCII.GetBytes(sa)
  13.         Dim CipherTextBytes As Byte() = Convert.FromBase64String(CipherText)
  14.         Dim DerivedPassword As PasswordDeriveBytes = New PasswordDeriveBytes(pn, SaltValueBytes, HashAlgorithm, PasswordIterations)
  15.  
  16.         '  here is where the warning occurs
  17.         Dim KeyBytes As Byte() = DerivedPassword.GetBytes(CInt(KeySize / 8))
  18.        
  19.         '  etc....
  20.     End Function

Code:
Warning 1 'Public Overrides Function GetBytes(cb As Integer) As Byte()' is obsolete:
 'Rfc2898DeriveBytes replaces PasswordDeriveBytes for deriving key material from a password
and is preferred in new applications.'.
Anyone knows how to do this properly?