S
Showjumper
I solved my previous problem. The new one is that the password is not being
decrypted but rather is still in the enrypted format. I am using Rijndael
emcryption. Below is the decryption code.
And here is th eline to return the decrypted password. Any help is
appreciated Thanks Ashok
Return s.DecryptToString(encryptedData,
CType(HttpContext.Current.Application("Key"), Rijndael))
Public Shared Function DecryptToString(ByVal dataToDecrypt As Byte(), ByVal
crypt As SymmetricAlgorithm) As String
' Create a cryptographic stream for decryption.
Dim ms As MemoryStream = New MemoryStream
Dim cs As CryptoStream = New CryptoStream(ms, crypt.CreateDecryptor(),
CryptoStreamMode.Write)
' Write the binary data to the memory stream.
cs.Write(dataToDecrypt, 0, dataToDecrypt.Length)
cs.FlushFinalBlock()
' Read the unencrypted data from the stream into a string,
' with the help of the BinaryReader.
Dim r As BinaryReader = New BinaryReader(ms)
ms.Position = 0
Dim decryptedData As String = r.ReadString()
r.Close()
Return decryptedData
End Function
decrypted but rather is still in the enrypted format. I am using Rijndael
emcryption. Below is the decryption code.
And here is th eline to return the decrypted password. Any help is
appreciated Thanks Ashok
Return s.DecryptToString(encryptedData,
CType(HttpContext.Current.Application("Key"), Rijndael))
Public Shared Function DecryptToString(ByVal dataToDecrypt As Byte(), ByVal
crypt As SymmetricAlgorithm) As String
' Create a cryptographic stream for decryption.
Dim ms As MemoryStream = New MemoryStream
Dim cs As CryptoStream = New CryptoStream(ms, crypt.CreateDecryptor(),
CryptoStreamMode.Write)
' Write the binary data to the memory stream.
cs.Write(dataToDecrypt, 0, dataToDecrypt.Length)
cs.FlushFinalBlock()
' Read the unencrypted data from the stream into a string,
' with the help of the BinaryReader.
Dim r As BinaryReader = New BinaryReader(ms)
ms.Position = 0
Dim decryptedData As String = r.ReadString()
r.Close()
Return decryptedData
End Function