public override Stream GetPayloadStream() { Stream stream = base.GetPayloadStream(); cryptor.Encrypt(Payload, 0, Payload.Length); byte[] encryptedIV = Utils.ReadFull(cryptor, Payload.Length); stream.Write(encryptedIV, 0, encryptedIV.Length); return(stream); }
public override Stream GetPayloadStream() { Stream buffer = base.GetPayloadStream(); byte[] datas = Encoding.UTF8.GetBytes(Payload.ToString()); cryptor.Encrypt(datas, 0, datas.Length); cryptor.Read(datas, 0, datas.Length); buffer.Write(datas, 0, datas.Length); return(buffer); }
public void ReadTest() { CryptoMemoryStream memoryStream = new CryptoMemoryStream(1024, plainKey); byte[] buffer = new byte[data.Length]; memoryStream.Encrypt(data, 0, data.Length); Console.WriteLine(memoryStream.Decrypt(buffer, 0, buffer.Length)); Console.WriteLine(string.Join(" ", buffer)); Assert.IsTrue(data.SequenceEqual(buffer)); }
public void WriteTest() { CryptoMemoryStream memoryStream = new CryptoMemoryStream(1024, plainKey); memoryStream.Encrypt(data, 0, data.Length); }