Wrox Programmer Forums
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 8th, 2008, 08:22 PM
Registered User
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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, _
' transform the bytes as requested
cryptStream.Write(input, 0, input.Length)
' 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

Thanks in advance

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need decryption Alog greatnishant Classic ASP Basics 0 June 27th, 2008 04:38 AM
Sql server decryption problem monika.vasvani SQL Server 2000 3 December 14th, 2006 03:12 PM
Encryption/Decryption Problem param99 SQL Server 2000 4 December 14th, 2006 05:20 AM
Encryption and Decryption kvanchi General .NET 1 February 2nd, 2005 02:04 PM
Encryption and Decryption kvanchi General .NET 2 January 24th, 2005 02:52 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.