CryptoStream 构造函数

定义

重载

CryptoStream(Stream, ICryptoTransform, CryptoStreamMode)

用目标数据流、要使用的转换和流的模式初始化 CryptoStream 类的新实例。Initializes a new instance of the CryptoStream class with a target data stream, the transformation to use, and the mode of the stream.

CryptoStream(Stream, ICryptoTransform, CryptoStreamMode, Boolean)

初始化 CryptoStream 类的新实例。Initializes a new instance of the CryptoStream class.

CryptoStream(Stream, ICryptoTransform, CryptoStreamMode)

用目标数据流、要使用的转换和流的模式初始化 CryptoStream 类的新实例。Initializes a new instance of the CryptoStream class with a target data stream, the transformation to use, and the mode of the stream.

public:
 CryptoStream(System::IO::Stream ^ stream, System::Security::Cryptography::ICryptoTransform ^ transform, System::Security::Cryptography::CryptoStreamMode mode);
public CryptoStream (System.IO.Stream stream, System.Security.Cryptography.ICryptoTransform transform, System.Security.Cryptography.CryptoStreamMode mode);
new System.Security.Cryptography.CryptoStream : System.IO.Stream * System.Security.Cryptography.ICryptoTransform * System.Security.Cryptography.CryptoStreamMode -> System.Security.Cryptography.CryptoStream

参数

stream
Stream

对其执行加密转换的流。The stream on which to perform the cryptographic transformation.

transform
ICryptoTransform

要对流执行的加密转换。The cryptographic transformation that is to be performed on the stream.

mode
CryptoStreamMode

CryptoStreamMode 值之一。One of the CryptoStreamMode values.

异常

stream 无效。stream is invalid.

注解

派生自 Stream 的任何对象都可以传递到 stream 参数。Any object that derives from Stream can be passed into the stream parameter. 实现 ICryptoTransform 的任何对象(如 HashAlgorithm)都可以传递到 transform 参数。Any object that implements ICryptoTransform (such as HashAlgorithm) can be passed into the transform parameter.

另请参阅

CryptoStream(Stream, ICryptoTransform, CryptoStreamMode, Boolean)

初始化 CryptoStream 类的新实例。Initializes a new instance of the CryptoStream class.

public:
 CryptoStream(System::IO::Stream ^ stream, System::Security::Cryptography::ICryptoTransform ^ transform, System::Security::Cryptography::CryptoStreamMode mode, bool leaveOpen);
public CryptoStream (System.IO.Stream stream, System.Security.Cryptography.ICryptoTransform transform, System.Security.Cryptography.CryptoStreamMode mode, bool leaveOpen);
new System.Security.Cryptography.CryptoStream : System.IO.Stream * System.Security.Cryptography.ICryptoTransform * System.Security.Cryptography.CryptoStreamMode * bool -> System.Security.Cryptography.CryptoStream

参数

stream
Stream

对其执行加密转换的流。The stream on which to perform the cryptographic transformation.

transform
ICryptoTransform

要对流执行的加密转换。The cryptographic transformation that is to be performed on the stream.

mode
CryptoStreamMode

流的模式。The mode of the stream.

leaveOpen
Boolean

若要在释放 true 对象时不关闭基础流,则为 CryptoStream;否则为 falsetrue to not close the underlying stream when the CryptoStream object is disposed; otherwise, false.

异常

mode 无效。mode is invalid.

适用于