Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > encrypt

Reply
Thread Tools

encrypt

 
 
JW
Guest
Posts: n/a
 
      11-14-2003


I can encrypt the contents of a memory stream with no problems, however when
decrypting( I'm using the same key an IV ) I get an exception stating bad
data.

I'm at a lost. I'm actually creating a new memory stream, filling it with
the encrypted bytes then trying to read from the crypto stream object. I
have used the same approach encrypting to a file handle and then decrypting
from the same file and it works.



sample: (this same code works with a file stream but not memory stream) what
am I missing?

MemoryStream memStrEnc2 = new MemoryStream(newByte, 0, newByte.Length);

CryptoStream decStream = new CryptoStream(memStrEnc2,
tdes.CreateDecryptor(random, random), CryptoStreamMode.Read);

byte[] memString2 = new Byte[memStrEnc2.Length];

decStream.Read(memString2, 0, 16);

decStream.Close();



Thank you for your time

Josiah


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Encrypt/Decrypt a structured file kevininstructor@state.or.us ASP .Net 1 09-25-2004 05:25 AM
828 - "ppp encrypt" command doesn't work John Rennie Cisco 0 04-27-2004 04:44 PM
Encrypt line pwd Warrick FitzGerald Cisco 1 12-22-2003 01:34 PM
Encrypt in Perl, De-encrypt in Javascript http://ejobseek.com Perl Misc 3 09-01-2003 07:34 PM
Encrypt string for POSTing Markus Stehle ASP .Net 2 07-06-2003 03:23 PM



Advertisments