System.Security.Cryptography.CryptoStream Class

Defines a stream that links data streams to cryptographic transformations.

See Also: CryptoStream Members

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public class CryptoStream : System.IO.Stream

Remarks

The common language runtime uses a stream-oriented design for cryptography. The core of this design is System.Security.Cryptography.CryptoStream. Any cryptographic objects that implement System.Security.Cryptography.CryptoStream can be chained together with any objects that implement System.IO.Stream, so the streamed output from one object can be fed into the input of another object. The intermediate result (the output from the first object) does not need to be stored separately.

You should always explicitly close your System.Security.Cryptography.CryptoStream object after you are done using it by calling the System.IO.Stream.Close method. Doing so flushes the stream and causes all remain blocks of data to be processed by the System.Security.Cryptography.CryptoStream object. However, if an exception occurs before you call the System.IO.Stream.Close method, the System.Security.Cryptography.CryptoStream object might not be closed. To ensure that the System.IO.Stream.Close method always gets called, place your call to the System.IO.Stream.Close method within the finally block of a try/catch statement.

Requirements

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0