Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileStream gaining bytes.

Status
Not open for further replies.

woogoo

Programmer
Feb 14, 2004
247
GB
Hi,

This is what I'm doing:

Opening a file and reading it into a byte array.
GZipping the byte array to a RW FileStream.
Reading the GZipped Stream into a new byte array and 3DES encoding it.
Writing this new byte array back to the RW Stream.

Having written the file, if you then Debug.Print(m_OutputStream.Length.ToString()), the length reported is the same as the 3DES byte array which is of course correct. However, when the stream is closed it gains 10 bytes!

As a result of this it's breaking the encryption and so can't be unencrypted!

Any one got any ideas?






woogoo
 
Hi, I have fixed this by using a memory stream for writing the 3DES byte array to, then back to the original byte array.

However, something is still broken as my GZip magic number is corrupt! Oh well back to the drawing board, now where did I put my marker pens!
--

woogoo
 
Did you make sure you were flushing your buffers?

Chip H.


____________________________________________________________________
www.chipholland.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top