-
Notifications
You must be signed in to change notification settings - Fork 1
CipherStream
This is a decorating stream (see: patterns) that encrypts data into a bound stream when writing, or decrypts data from a bound stream when reading. To make this clear: encryption is done only when writing, and decryption is done only when reading.
It operates with a large variety of different symmetric ciphers - these are the type that one often hears about, like AES, a block cipher, or less commonly, Salsa20, a stream cipher. Symmetric ciphers use the same key when encrypting and decrypting, hence being symmetric (symmetrical; mirrored).
When constructing a CipherStream, a CipherConfiguration object is supplied as one of the constructor parameters. It provides the majority of the special parameters for the cipher. This object is also designed to be serialised, and is when being used as part of a Package (see: Packages).
Because CipherStream inherits from the standard .NET abstract class Stream, you can use it anywhere where you can use any of the .NET derived-type streams, such as binding it to a FileStream or even a NetworkStream.