Re: I'm having problems with cryptography and sockets, help
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 03/18/05
- Next message: Bruce Wood: "Re: Can we define a static class"
- Previous message: Kevin Yu [MSFT]: "Re: custom paste context menu fvor text boxes"
- In reply to: Alejandro Castaņaza: "Re: I'm having problems with cryptography and sockets, help"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Mar 2005 06:01:22 -0000
Alejandro Castaņaza <da_castanaza_borrar@itelgua.com> wrote:
> I made many changes to the original code after I posted, because I was still
> trying to make it work. Then I added the call to FlushFinalBlock, but the
> Read call still blocked. Then I used the streamReader, ReadToEnd and
> blocked. Then, after looking some example code for encryption, I tried the
> solution I wrote earlier, using the cryptostream object to write to a temp
> memorystream, and reading the plain text from it. Its working that way.
>
> I didn't mean to say for sure it is a bug. Since the first message I asked
> for help, because I thought maybe I was missing something (like the call to
> flushfinalblock) or was doing something wrong.
>
> I havent tried, but after I finally made it work, I thought that the problem
> was because encryption always expand a little the original block of data,
> and that was why I was having trouble with it. That is the reason to call
> FlushFinalBlock or close the cryptostream, right? so it can finish the
> encryption process and send the last block of encrypted data.
Not only that - but so it can then tell the stream that it's finished,
so that things like ReadToEnd will complete. If you leave the stream
open, things like ReadToEnd won't know whether there might be some more
data to come or not.
> So maybe I have to try reading the networkstream using the
> cryptostream with this concept in mind. But I'll do it later. Its
> working now, and I have so much to do still about that program.
Fair enough. If you do find out what was wrong, please report back to
the group :)
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Bruce Wood: "Re: Can we define a static class"
- Previous message: Kevin Yu [MSFT]: "Re: custom paste context menu fvor text boxes"
- In reply to: Alejandro Castaņaza: "Re: I'm having problems with cryptography and sockets, help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|