Mono Class Library: System.Security.Cryptography NamespaceSystem.Security.Cryptography.CryptoStream Class |
See Also: CryptoStream Members
System.Object
System.MarshalByRefObject
System.IO.Stream
System.Security.Cryptography.CryptoStream
|
Multiple CryptoStream can be chained to do multiple cryptographic operations using a single Read or Write operation.
[Edit]
C# Example // we will be writing encrypted data to this file FileStream fs = new File.OpenWrite ("data"); Rijndael aes = Rijndael.Create (); CryptoStream cse = new CryptoStream (fs, aes.CreateEncryptor (), CryptoStreamMode.Write); SHA1 hash = SHA1.Create (); CryptoStream csh = new CryptoStream (cse, hash, CryptoStreamMode.Write); byte[] data = Encoding.UTF8.GetBytes ("http://www.go-mono.com/"); // the data will first be hashed (csh), then encrypted (cse) and finally written to a file (fs) csh.Write (data, 0, data.Length); csh.FlushFinalBlock (); // then we can display the hash (e.g. send it out-of-band) byte[] hash = hash.Hash; Console.WriteLine ("SHA1: {0}", BitConverter.ToString (hash));
Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0