I need to encrypt a file with AES 192 and send it to a client via socket. I'm using this code to encrypt the file:
string outputFile = "crypted";
//Confidentiality
RijndaelManaged AES192Confidentiality = new RijndaelManaged();
AES192Confidentiality.KeySize = 192;
AES192Confidentiality.BlockSize = 192;
AES192Confidentiality.IV = ConfIV;
AES192Confidentiality.Key = ConfKey;
AES192Confidentiality.Mode = CipherMode.CBC;
FileStream inputFileStream = new FileStream(par.GetFilePath(), FileMode.Open, FileAccess.Read);
FileStream outputFileStream = new FileStream(outputFile, FileMode.Create, FileAccess.Write);
byte[] inputFileData = new byte[(int)inputFileStream.Length];
inputFileStream.Read(inputFileData, 0, (int)inputFileStream.Length);
CryptoStream encryptStream = new CryptoStream(outputFileStream, AES192Confidentiality.CreateEncryptor(), CryptoStreamMode.Write);
encryptStream.Write(inputFileData, 0, (int)inputFileStream.Length);
encryptStream.FlushFinalBlock();
encryptStream.Close();
I'm wondering how I can now send this encrypted temporary file through the socket, so that the receiver can reconstruct the file and decrypt it. Can someone give me some tutorial or guide ? Thank you all in advance