L
Lee Gillie
I am using Cryptography. You can encrypt or decrypt by providing an
output stream as a parameter to the CryptoStream constructor. But I
need byte arrays, as I am encrypting on the fly to a socket, and need
to manage all socket traffic.
My thought was a stateful call to my own Encrypt and Decrypt routines.
That I would pass a MemoryStream to the CryptoStream constructor. But
it appears that for each write CryptoStream does to my memory stream,
there is no way for me to get the bytes out of the MemoryStream and
and reset the MemoryStream content, so that its byte content does not
continue to grow. The files being encrypted, for example, might be as
large as 100MB. I could encrypt entirely to YATDF (yet another
temporary disk file), and the pass that to the socket. But if there
is a way, I would like to avoid a disk file.
Maybe MemoryStream is NOT the right object, because I don't see how to
do the above. Is there some other stream object, or perhaps, a way to
do what I want with MemoryStream?
TIA - best regards, Lee Gillie
output stream as a parameter to the CryptoStream constructor. But I
need byte arrays, as I am encrypting on the fly to a socket, and need
to manage all socket traffic.
My thought was a stateful call to my own Encrypt and Decrypt routines.
That I would pass a MemoryStream to the CryptoStream constructor. But
it appears that for each write CryptoStream does to my memory stream,
there is no way for me to get the bytes out of the MemoryStream and
and reset the MemoryStream content, so that its byte content does not
continue to grow. The files being encrypted, for example, might be as
large as 100MB. I could encrypt entirely to YATDF (yet another
temporary disk file), and the pass that to the socket. But if there
is a way, I would like to avoid a disk file.
Maybe MemoryStream is NOT the right object, because I don't see how to
do the above. Is there some other stream object, or perhaps, a way to
do what I want with MemoryStream?
TIA - best regards, Lee Gillie