decryption problem
I have a table with Varbinary(100). I want some data to get into this field encrypted. But when I read that data back. It gives me "'Length of the data to decrypt is invalid" error.
thats the code that I guess making me a trouble.
on Write method it just blows up and give that error.
Dim memStream As MemoryStream = New MemoryStream
Dim cryptStream As CryptoStream = New _
CryptoStream(memStream, CryptoTransform, _
CryptoStreamMode.Write)
' transform the bytes as requested
cryptStream.Write(input, 0, input.Length)
cryptStream.FlushFinalBlock()
' Read the memory stream and convert it back into byte array
memStream.Position = 0
Dim result(CType(memStream.Length - 1, System.Int32)) As Byte
memStream.Read(result, 0, CType(result.Length, System.Int32))
' close and release the streams
memStream.Close()
cryptStream.Close()
Thanks in advance
|