Ok, i made a code to Encrypt a file (any file), but i have a problem to do the Decrypter
and the code to the Decrypter (doesn't work)
if (RestoreFile.ShowDialog() == DialogResult.OK)
{
FileStream fsFileIn = File.OpenRead(o.FileName);
FileStream fsKeyFile = File.OpenRead(o.FileName);
FileStream fsFileOut = File.Create(RestoreFile.FileName);
TripleDESCryptoServiceProvider cryptAlgorithm = new TripleDESCryptoServiceProvider();
BinaryReader brFile = new BinaryReader(fsKeyFile);
cryptAlgorithm.Key = brFile.ReadBytes(24);
cryptAlgorithm.IV = brFile.ReadBytes(8);
CryptoStream csEncrypt = new CryptoStream(fsFileIn, cryptAlgorithm.CreateDecryptor(), CryptoStreamMode.Read);
StreamReader srCleanStream = new StreamReader(csEncrypt);
StreamWriter swCleanStream = new StreamWriter(fsFileOut);
swCleanStream.Write(srCleanStream.ReadToEnd());
swCleanStream.Close();
fsFileOut.Close();
srCleanStream.Close();
}