This documentation is archived and is not being maintained.

SslStream Constructor (Stream, Boolean, RemoteCertificateValidationCallback, LocalCertificateSelectionCallback, EncryptionPolicy)

Initializes a new instance of the SslStream class using the specified Stream

Namespace:  System.Net.Security
Assembly:  System (in System.dll)

new : 
        innerStream:Stream * 
        leaveInnerStreamOpen:bool * 
        userCertificateValidationCallback:RemoteCertificateValidationCallback * 
        userCertificateSelectionCallback:LocalCertificateSelectionCallback * 
        encryptionPolicy:EncryptionPolicy -> SslStream


Type: System.IO.Stream
A Stream object used by the SslStream for sending and receiving data.
Type: System.Boolean
A Boolean value that indicates the closure behavior of the Stream object used by the SslStream for sending and receiving data. This parameter indicates if the inner stream is left open.
Type: System.Net.Security.RemoteCertificateValidationCallback
A RemoteCertificateValidationCallback delegate responsible for validating the certificate supplied by the remote party.
Type: System.Net.Security.LocalCertificateSelectionCallback
A LocalCertificateSelectionCallback delegate responsible for selecting the certificate used for authentication.
Type: System.Net.Security.EncryptionPolicy
The EncryptionPolicy to use.


innerStream is not readable.


innerStream is not writable.


encryptionPolicy is not valid.


innerStream is a null reference (Nothing in Visual Basic).


innerStream is equal to Null.

The use of the Null cipher is required when the encryptionPolicy parameter is set to EncryptionPolicy.NoEncryption.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.