The core of cryptographic operations perform either a computation or a transformation on a large amount of data. This being the case it makes sense that at its core the majority of cryptographic operations should be stream-based operations. This model works well for hashes, symmetric encryption and message based operations. ICryptoStream interface defines how such streamed data handling is done.
Since the objects are stream based it makes sense that they should all support a single standard interface for dealing with the data transfer portion of the object, the control portion of the object is different for each object and is therefore dealt with separately.
Since all of the objects are built on a standard interface, it becomes possible to chain together multiple objects (for example a hash object followed by an encryption object) and perform multiple operations on the data without needing any intermediate storage for it. The streaming model also allows for objects to be built from smaller objects.
ICryptoStream
[Visual Basic] Public Interface ICryptoStream [C#] public interface ICryptoStream [C++] public __gc __interface ICryptoStream
[JScript] In JScript, you can use the interfaces in the NGWS frameworks, but you cannot define your own.
Class | Description |
---|---|
CryptoFileStream | Cryptographic stream object for file streams. |
CryptoMemoryStream | Cryptographic stream object for memory streams. |
CryptoStreamDeformatter | [To be supplied.] |
CryptoStreamFormatter | [To be supplied.] |
DecodeBase64 | [To be supplied.] |
EncodeAsBase64 | [To be supplied.] |
HashAlgorithm | [To be supplied.] |
SymmetricStreamDecryptor | [To be supplied.] |
SymmetricStreamEncryptor | [To be supplied.] |
In addition to the interface published by each object for supporting the streaming, some objects need to be able to query specific values about the object on their immediate left. One example is that a PKCS#1 padding object needs to know the block size of the encryption object on its left in order to get the padding correct.
Programmer is responsible for not connecting cryptographic stream objects into a circular configuration where data will flow endlessly: there is no error detection provided against this problem.
Namespace: System.Security.Cryptography
Assembly: mscorlib.dll
ICryptoStream Members | System.Security.Cryptography Namespace