我需要使用 AES 192 加密文件并通过套接字将其发送到客户端。我正在使用此代码来加密文件:
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();
我想知道我现在如何通过套接字发送这个加密的临时文件,以便接收者可以重建文件并解密它。有人可以给我一些教程或指南吗?谢谢大家