Been playing around with encryption and decrypting files in VC# Express 2010.
All the tutorials and documentation I've seen requires two FileSteams in order to encrypt the file. One for reading the unencrypted version, and the other for encrypting. When I actually wrote the code it kept throwing an error telling me it could not open the file because it was opened by another process at the output filestream.
I'm assuming thats because the file is open by the input filestream. So that means I have to specify a different filename? So even after the operation is successful I'll know have the original unencrypted file in the directory and a separate encrypted version? Doesnt that defeat the point? Or am I doing something wrong here? My code is similar to this...
public string filename = "test.xml";
using(FileStream input = new FileStream(filename, FileMode.Open, FileAccess.Read))
using(FileStream output = new FileStram(filename, FileMode.Open, FileAccess.Write))
using(....all the crypto stream and transform stuf...)
{
...do the encryption....
}