Hi,
I'm trying to decrypt a file with the following code:
vb.net Code:
Function DecryptAES(ByVal CipherText As String, ByVal password As String, ByVal salt As String) As String Dim HashAlgorithm As String = h_alg Dim PasswordIterations As Integer = 2 Dim InitialVector As String = iv Dim KeySize As Integer = 256 If (String.IsNullOrEmpty(CipherText)) Then Return "" End If Dim InitialVectorBytes As Byte() = Encoding.ASCII.GetBytes(InitialVector) Dim SaltValueBytes As Byte() = Encoding.ASCII.GetBytes(sa) Dim CipherTextBytes As Byte() = Convert.FromBase64String(CipherText) Dim DerivedPassword As PasswordDeriveBytes = New PasswordDeriveBytes(pn, SaltValueBytes, HashAlgorithm, PasswordIterations) ' here is where the warning occurs Dim KeyBytes As Byte() = DerivedPassword.GetBytes(CInt(KeySize / 8)) ' etc.... End Function
Anyone knows how to do this properly?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.'.





Reply With Quote