By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,492 Members | 1,591 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,492 IT Pros & Developers. It's quick & easy.

FlushFinalBlock() method was called twice on a CryptoStream

P: n/a
when i run the following code, the above error is occured. can anybody
help me? sorry cosz it is a code.

Public Function Decrypt(ByVal strToDecrypt As String) As String

Dim sb As New StringBuilder
Dim byteToDecrypt() As Byte = Convert.FromBase64String(strToDecrypt)
Dim byteDecoded(byteToDecrypt.Length) As Byte
Dim ms As New MemoryStream(byteToDecrypt)
Dim cs As CryptoStream

byteKey = GetKey(strKey)
byteIV = GetKey(strIV)
Dim desProvider As New DESCryptoServiceProvider
cs = New CryptoStream(ms, desProvider.CreateDecryptor(byteKey,
byteIV), CryptoStreamMode.Read)
cs.Read(byteDecoded, 0, byteDecoded.Length)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try

Dim intLength As Integer = byteDecoded.Length - 1
For i As Integer = 0 To intLength
Return sb.ToString
End Function

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.