thank you :)
can i use CryptoStream?

Edited by no123

Product p=new Product();
//stream-this is the stream to the file.
using (MemoryStream ms = new MemoryStream())
                BinaryFormatter msSeri = new BinaryFormatter();
                msSeri.Serialize(ms, p);
                DESCryptoServiceProvider cryptic = new DESCryptoServiceProvider();
                cryptic.Key = ASCIIEncoding.ASCII.GetBytes("ABCDEFGH");
                cryptic.IV = ASCIIEncoding.ASCII.GetBytes("ABCDEFGH");
                CryptoStream crStream = new CryptoStream(ms,cryptic.CreateEncryptor(),CryptoStreamMode.Write);
                byte[] data = ASCIIEncoding.ASCII.GetBytes(ms.ToString());
                BinaryFormatter seri = new BinaryFormatter();
                if (stream != null)
                    seri.Serialize(stream, msSeri.Deserialize(ms));

is this how i'm supposed to do it?


Does CryptoStream implement IDisposable?

If so then wrap that in a using statement too.

So after that, does the code actually work?


seri.Serialize(stream, msSeri.Deserialize(ms));
argument exception in this line-what does it mean?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.