Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Net.​Security.​SslStream

Assembly: System.Net.Security

Inheritance: object → MarshalByRefObjectIO.​StreamAuthenticatedStream → SslStream

Implemented Interfaces

Provides a stream used for client-server communication that uses the Secure Socket Layer (SSL) security protocol to authenticate the server and optionally the client.

Properties

public bool
CanRead
Gets a <see cref="T:System.Boolean" /> value that indicates whether the underlying stream is readable.
public bool
CanSeek
Gets a <see cref="T:System.Boolean" /> value that indicates whether the underlying stream is seekable.
public bool
CanTimeout
Gets a <see cref="T:System.Boolean" /> value that indicates whether the underlying stream supports time-outs.
public bool
CanWrite
Gets a <see cref="T:System.Boolean" /> value that indicates whether the underlying stream is writable.
public bool
CheckCertRevocationStatus
Gets a <see cref="T:System.Boolean" /> value that indicates whether the certificate revocation list is checked during the certificate validation process.
Gets a value that identifies the bulk encryption algorithm used by this <see cref="T:System.Net.Security.SslStream" /> .
public int
CipherStrength
Gets a value that identifies the strength of the cipher algorithm used by this <see cref="T:System.Net.Security.SslStream" /> .
Gets the algorithm used for generating message authentication codes (MACs).
public int
HashStrength
Gets a value that identifies the strength of the hash algorithm used by this instance.
public bool
IsAuthenticated
Gets a <see cref="T:System.Boolean" /> value that indicates whether authentication was successful.
public bool
IsEncrypted
Gets a <see cref="T:System.Boolean" /> value that indicates whether this <see cref="T:System.Net.Security.SslStream" /> uses data encryption.
public bool
IsMutuallyAuthenticated
Gets a <see cref="T:System.Boolean" /> value that indicates whether both server and client have been authenticated.
public bool
IsServer
Gets a <see cref="T:System.Boolean" /> value that indicates whether the local side of the connection used by this <see cref="T:System.Net.Security.SslStream" /> was authenticated as the server.
public bool
IsSigned
Gets a <see cref="T:System.Boolean" /> value that indicates whether the data sent using this stream is signed.
Gets the key exchange algorithm used by this <see cref="T:System.Net.Security.SslStream" /> .
public int
KeyExchangeStrength
Gets a value that identifies the strength of the key exchange algorithm used by this instance.
public long
Length
Gets the length of the underlying stream.
Gets the certificate used to authenticate the local endpoint.
NegotiatedApplicationProtocol
The negotiated application protocol in TLS handshake.
NegotiatedCipherSuite
Gets the cipher suite that was negotiated for this connection.
public long
Position
Gets or sets the current position in the underlying stream.
public int
ReadTimeout
Gets or sets the amount of time, expressed in milliseconds, a read operation blocks waiting for data.
Gets the certificate used to authenticate the remote endpoint.
Gets a value that indicates the security protocol used to authenticate this connection.
public string
TargetHostName
Gets the name of the server the client is trying to connect to. That name is used for server certificate validation. It can be a DNS name or an IP address.
TransportContext
Gets the <see cref="T:System.Net.TransportContext" /> used for authentication using extended protection.
public int
WriteTimeout
Gets or sets the amount of time a write operation blocks waiting for data.
protected IO.​Stream
InnerStream
Gets the stream used by this <see cref="T:System.Net.Security.AuthenticatedStream" /> for sending and receiving data.
public bool
LeaveInnerStreamOpen
Gets whether the stream used by this <see cref="T:System.Net.Security.AuthenticatedStream" /> for sending and receiving data has been left open.

Methods

public void
AuthenticateAsClient​(SslClientAuthenticationOptions sslClientAuthenticationOptions)
Authenticates the server and optionally the client in a client-server connection.
sslClientAuthenticationOptions The property bag for the SSL connection.
public void
AuthenticateAsClient​(string targetHost)
Called by clients to authenticate the server and optionally the client in a client-server connection.
targetHost The name of the server that shares this <see cref="T:System.Net.Security.SslStream" /> .
public void
AuthenticateAsClient​(string targetHost, Security.​Cryptography.​X509Certificates.​X509CertificateCollection? clientCertificates, bool checkCertificateRevocation)
Called by clients to authenticate the server and optionally the client in a client-server connection. The authentication process uses the specified certificate collection, and the system default SSL protocol.
targetHost The name of the server that will share this <see cref="T:System.Net.Security.SslStream" /> .
clientCertificates The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> that contains client certificates.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
public void
AuthenticateAsClient​(string targetHost, Security.​Cryptography.​X509Certificates.​X509CertificateCollection? clientCertificates, Security.​Authentication.​SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
Called by clients to authenticate the server and optionally the client in a client-server connection. The authentication process uses the specified certificate collection and SSL protocol.
targetHost The name of the server that will share this <see cref="T:System.Net.Security.SslStream" /> .
clientCertificates The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> that contains client certificates.
enabledSslProtocols The <see cref="T:System.Security.Authentication.SslProtocols" /> value that represents protocols used for authentication.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
AuthenticateAsClientAsync​(SslClientAuthenticationOptions sslClientAuthenticationOptions, Threading.​CancellationToken cancellationToken = null)
Called by clients to authenticate the server and optionally the client in a client-server connection as an asynchronous operation. The authentication process uses information specified in the <paramref name="sslClientAuthenticationOptions" /> property bag.
Returns The task object representing the asynchronous operation.
sslClientAuthenticationOptions The property bag for the SSL connection.
cancellationToken The token to monitor for cancellation requests.
AuthenticateAsClientAsync​(string targetHost)
Called by clients to authenticate the server and optionally the client in a client-server connection as an asynchronous operation.
Returns The task object representing the asynchronous operation.
targetHost The name of the server that shares this <see cref="T:System.Net.Security.SslStream" /> .
AuthenticateAsClientAsync​(string targetHost, Security.​Cryptography.​X509Certificates.​X509CertificateCollection? clientCertificates, bool checkCertificateRevocation)
Called by clients to authenticate the server and optionally the client in a client-server connection as an asynchronous operation. The authentication process uses the specified certificate collection and the system default SSL protocol.
Returns The task object representing the asynchronous operation.
targetHost The name of the server that will share this <see cref="T:System.Net.Security.SslStream" /> .
clientCertificates The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> that contains client certificates.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
AuthenticateAsClientAsync​(string targetHost, Security.​Cryptography.​X509Certificates.​X509CertificateCollection? clientCertificates, Security.​Authentication.​SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
Called by clients to authenticate the server and optionally the client in a client-server connection as an asynchronous operation. The authentication process uses the specified certificate collection and SSL protocol.
Returns The task object representing the asynchronous operation.
targetHost The name of the server that will share this <see cref="T:System.Net.Security.SslStream" /> .
clientCertificates The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> that contains client certificates.
enabledSslProtocols The <see cref="T:System.Security.Authentication.SslProtocols" /> value that represents protocols used for authentication.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
public void
AuthenticateAsServer​(SslServerAuthenticationOptions sslServerAuthenticationOptions)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificate.
sslServerAuthenticationOptions The property bag for the SSL connection.
public void
AuthenticateAsServer​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificate.
serverCertificate The certificate used to authenticate the server.
public void
AuthenticateAsServer​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates and requirements, and using the system default security protocol.
serverCertificate The X509Certificate used to authenticate the server.
clientCertificateRequired A <see cref="T:System.Boolean" /> value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
public void
AuthenticateAsServer​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, bool clientCertificateRequired, Security.​Authentication.​SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates, requirements and security protocol.
serverCertificate The X509Certificate used to authenticate the server.
clientCertificateRequired A <see cref="T:System.Boolean" /> value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.
enabledSslProtocols The <see cref="T:System.Security.Authentication.SslProtocols" /> value that represents protocols used for authentication.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
AuthenticateAsServerAsync​(ServerOptionsSelectionCallback optionsCallback, object state, Threading.​CancellationToken cancellationToken = null)
Called by servers to authenticate the server and optionally the client in a client-server connection as an asynchronous operation. The authentication process uses information returned by <paramref name="optionsCallback" /> .
Returns The task object representing the asynchronous operation.
optionsCallback The callback delegate.
state The state object to pass to <paramref name="optionsCallback" /> when the callback is invoked.
cancellationToken The token to monitor for cancellation requests.
AuthenticateAsServerAsync​(SslServerAuthenticationOptions sslServerAuthenticationOptions, Threading.​CancellationToken cancellationToken = null)
Authenticates the server and optionally the client in a client-server connection as an asynchronous operation. The authentication process uses information specified in the <paramref name="sslServerAuthenticationOptions" /> property bag.
Returns The task object representing the asynchronous operation.
sslServerAuthenticationOptions The property bag for the SSL connection.
cancellationToken The token to monitor for cancellation requests.
AuthenticateAsServerAsync​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificate as an asynchronous operation.
Returns The task object representing the asynchronous operation.
serverCertificate The certificate used to authenticate the server.
AuthenticateAsServerAsync​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates, requirements and security protocol as an asynchronous operation.
Returns The task object representing the asynchronous operation.
serverCertificate The X509Certificate used to authenticate the server.
clientCertificateRequired A <see cref="T:System.Boolean" /> value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
AuthenticateAsServerAsync​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, bool clientCertificateRequired, Security.​Authentication.​SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
Called by servers to authenticate the server and optionally the client in a client-server connection using the specified certificates, requirements and security protocol as an asynchronous operation.
Returns The task object representing the asynchronous operation.
serverCertificate The X509Certificate used to authenticate the server.
clientCertificateRequired A <see cref="T:System.Boolean" /> value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.
enabledSslProtocols The <see cref="T:System.Security.Authentication.SslProtocols" /> value that represents protocols used for authentication.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
public IAsyncResult
BeginAuthenticateAsClient​(string targetHost, AsyncCallback? asyncCallback, object asyncState)
Called by clients to begin an asynchronous operation to authenticate the server and optionally the client.
Returns An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.
targetHost The name of the server that shares this <see cref="T:System.Net.Security.SslStream" /> .
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the authentication is complete.
asyncState A user-defined object that contains information about the operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginAuthenticateAsClient​(string targetHost, Security.​Cryptography.​X509Certificates.​X509CertificateCollection clientCertificates, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
Called by clients to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates and the system default security protocol.
Returns An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.
targetHost The name of the server that shares this <see cref="T:System.Net.Security.SslStream" /> .
clientCertificates The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> containing client certificates.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the authentication is complete.
asyncState A user-defined object that contains information about the operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginAuthenticateAsClient​(string targetHost, Security.​Cryptography.​X509Certificates.​X509CertificateCollection clientCertificates, Security.​Authentication.​SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
Called by clients to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates and security protocol.
Returns An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.
targetHost The name of the server that shares this <see cref="T:System.Net.Security.SslStream" /> .
clientCertificates The <see cref="T:System.Security.Cryptography.X509Certificates.X509CertificateCollection" /> containing client certificates.
enabledSslProtocols The <see cref="T:System.Security.Authentication.SslProtocols" /> value that represents protocols used for authentication.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the authentication is complete.
asyncState A user-defined object that contains information about the operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginAuthenticateAsServer​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, AsyncCallback? asyncCallback, object asyncState)
Called by servers to begin an asynchronous operation to authenticate the client and optionally the server in a client-server connection.
Returns An <see cref="T:System.IAsyncResult" /> object indicating the status of the asynchronous operation.
serverCertificate The X509Certificate used to authenticate the server.
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the authentication is complete.
asyncState A user-defined object that contains information about the operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginAuthenticateAsServer​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, AsyncCallback? asyncCallback, object asyncState)
Called by servers to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates and requirements, and the system default security protocol.
Returns An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.
serverCertificate The X509Certificate used to authenticate the server.
clientCertificateRequired A <see cref="T:System.Boolean" /> value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the authentication is complete.
asyncState A user-defined object that contains information about the operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginAuthenticateAsServer​(Security.​Cryptography.​X509Certificates.​X509Certificate serverCertificate, bool clientCertificateRequired, Security.​Authentication.​SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback? asyncCallback, object asyncState)
Called by servers to begin an asynchronous operation to authenticate the server and optionally the client using the specified certificates, requirements and security protocol.
Returns An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.
serverCertificate The X509Certificate used to authenticate the server.
clientCertificateRequired A <see cref="T:System.Boolean" /> value that specifies whether the client is asked for a certificate for authentication. Note that this is only a request -- if no certificate is provided, the server still accepts the connection request.
enabledSslProtocols The <see cref="T:System.Security.Authentication.SslProtocols" /> value that represents protocols used for authentication.
checkCertificateRevocation A <see cref="T:System.Boolean" /> value that specifies whether the certificate revocation list is checked during authentication.
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the authentication is complete.
asyncState A user-defined object that contains information about the operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginRead​(byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object asyncState)
Begins an asynchronous read operation that reads data from the stream and stores it in the specified array.
Returns An <see cref="T:System.IAsyncResult" /> object that indicates the status of the asynchronous operation.
buffer A <see cref="T:System.Byte" /> array that receives the bytes read from the stream.
offset The zero-based location in <paramref name="buffer" /> at which to begin storing the data read from this stream.
count The maximum number of bytes to read from the stream.
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the read operation is complete.
asyncState A user-defined object that contains information about the read operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
public IAsyncResult
BeginWrite​(byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object asyncState)
Begins an asynchronous write operation that writes <see cref="T:System.Byte" /> s from the specified buffer to the stream.
Returns An <see cref="T:System.IAsyncResult" /> object indicating the status of the asynchronous operation.
buffer A <see cref="T:System.Byte" /> array that supplies the bytes to be written to the stream.
offset The zero-based location in <paramref name="buffer" /> at which to begin reading bytes to be written to the stream.
count An <see cref="T:System.Int32" /> value that specifies the number of bytes to read from <paramref name="buffer" /> .
asyncCallback An <see cref="T:System.AsyncCallback" /> delegate that references the method to invoke when the write operation is complete.
asyncState A user-defined object that contains information about the write operation. This object is passed to the <paramref name="asyncCallback" /> delegate when the operation completes.
protected void
Dispose​(bool disposing)
Releases the unmanaged resources used by the <see cref="T:System.Net.Security.SslStream" /> and optionally releases the managed resources.
disposing <see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.
DisposeAsync​()
Asynchronously releases the unmanaged and managed resources used by the <see cref="T:System.Net.Security.SslStream" /> .
Returns A task that represents the asynchronous dispose operation.
public void
EndAuthenticateAsClient​(IAsyncResult asyncResult)
Ends a pending asynchronous server authentication operation started with a previous call to <see cref="Overload:System.Net.Security.SslStream.BeginAuthenticateAsClient" /> .
asyncResult An <see cref="T:System.IAsyncResult" /> instance returned by a call to <see cref="Overload:System.Net.Security.SslStream.BeginAuthenticateAsClient" /> .
public void
EndAuthenticateAsServer​(IAsyncResult asyncResult)
Ends a pending asynchronous client authentication operation started with a previous call to <see cref="Overload:System.Net.Security.SslStream.BeginAuthenticateAsClient" /> .
asyncResult An <see cref="T:System.IAsyncResult" /> instance returned by a call to <see cref="Overload:System.Net.Security.SslStream.BeginAuthenticateAsClient" /> .
public int
EndRead​(IAsyncResult asyncResult)
Ends an asynchronous read operation started with a previous call to <see cref="M:System.Net.Security.SslStream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> .
Returns A <see cref="T:System.Int32" /> value that specifies the number of bytes read from the underlying stream.
asyncResult An <see cref="T:System.IAsyncResult" /> instance returned by a call to <see cref="M:System.Net.Security.SslStream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> .
public void
EndWrite​(IAsyncResult asyncResult)
Ends an asynchronous write operation started with a previous call to <see cref="M:System.Net.Security.SslStream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> .
asyncResult An <see cref="T:System.IAsyncResult" /> instance returned by a call to <see cref="M:System.Net.Security.SslStream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> .
protected void
Finalize​()
Releases all resources used by the <see cref="T:System.Net.Security.SslStream" /> .
public void
Flush​()
Causes any buffered data to be written to the underlying device.
FlushAsync​(Threading.​CancellationToken cancellationToken)
Asynchronously writes any buffered data to the underlying device.
Returns A task that represents the asynchronous flush operation.
cancellationToken The token to monitor for cancellation requests.
NegotiateClientCertificateAsync​(Threading.​CancellationToken cancellationToken = null)
Negotiates the client certificate on the authenticated connection.
Returns The task object representing the asynchronous operation.
cancellationToken The token to monitor for cancellation requests.
public int
Read​(byte[] buffer, int offset, int count)
Reads data from this stream and stores it in the specified array.
Returns A <see cref="T:System.Int32" /> value that specifies the number of bytes read. When there is no more data to be read, returns 0.
buffer A <see cref="T:System.Byte" /> array that receives the bytes read from this stream.
offset A <see cref="T:System.Int32" /> that contains the zero-based location in <paramref name="buffer" /> at which to begin storing the data read from this stream.
count A <see cref="T:System.Int32" /> that contains the maximum number of bytes to read from this stream.
public int
Read​(Span<​byte> buffer)
ReadAsync​(byte[] buffer, int offset, int count, Threading.​CancellationToken cancellationToken)
Asynchronously reads data from this stream and stores it in the specified range of a byte array.
Returns A task that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.Task`1.Result" /> property contains the total number of bytes read into <paramref name="buffer" /> . When there is no more data to be read, returns 0.
buffer The buffer that receives the bytes read from this stream.
offset The zero-based location in <paramref name="buffer" /> at which to begin storing the data read from this stream.
count The maximum number of bytes to read from this stream.
cancellationToken The token to monitor for cancellation requests.
ReadAsync​(Memory<​byte> buffer, Threading.​CancellationToken cancellationToken = null)
Asynchronously reads data from this stream and stores it in the specified memory range.
Returns A task that represents the asynchronous read operation. The value of its <see cref="P:System.Threading.Tasks.ValueTask`1.Result" /> property contains the total number of bytes read into <paramref name="buffer" /> . When there is no more data to be read, returns 0.
buffer The buffer that receives the bytes read from this stream.
cancellationToken The token to monitor for cancellation requests.
public int
ReadByte​()
Reads a byte from the <see cref="T:System.Net.Security.SslStream" /> and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
Returns The unsigned byte cast to an <see cref="T:System.Int32" /> , or -1 if at the end of the stream.
public long
Seek​(long offset, IO.​SeekOrigin origin)
Throws a <see cref="T:System.NotSupportedException" /> .
Returns Always throws a <see cref="T:System.NotSupportedException" /> .
offset This value is ignored.
origin This value is ignored.
public void
SetLength​(long value)
Sets the length of the underlying stream.
value An <see cref="T:System.Int64" /> value that specifies the length of the stream.
ShutdownAsync​()
Shuts down this SslStream.
Returns The task object representing the asynchronous operation.
public void
Write​(byte[] buffer)
Writes the specified data to this stream.
buffer A <see cref="T:System.Byte" /> array that supplies the bytes written to the stream.
public void
Write​(byte[] buffer, int offset, int count)
Write the specified number of <see cref="T:System.Byte" /> s to the underlying stream using the specified buffer and offset.
buffer A <see cref="T:System.Byte" /> array that supplies the bytes written to the stream.
offset A <see cref="T:System.Int32" /> that contains the zero-based location in <paramref name="buffer" /> at which to begin reading bytes to be written to the stream.
count A <see cref="T:System.Int32" /> that contains the number of bytes to read from <paramref name="buffer" /> .
public void
Write​(ReadOnlySpan<​byte> buffer)
WriteAsync​(byte[] buffer, int offset, int count, Threading.​CancellationToken cancellationToken)
Asynchronously writes data to the underlying stream from the specified range of a byte array.
Returns A task that represents the asynchronous write operation.
buffer The data to write to the underlying stream.
offset The location in <paramref name="buffer" /> from which to start writing data.
count The number of bytes to write to the underlying stream.
cancellationToken The token to monitor for cancellation requests.
WriteAsync​(ReadOnlyMemory<​byte> buffer, Threading.​CancellationToken cancellationToken = null)
Asynchronously writes data to the underlying stream from a read-only byte memory range.
Returns A task that represents the asynchronous write operation.
buffer The data to write to the underlying stream.
cancellationToken The token to monitor for cancellation requests.
public void
WriteByte​(byte value)
public void
Close​()
Inherited from IO.​Stream
public void
CopyTo​(IO.​Stream destination)
Inherited from IO.​Stream
public void
CopyTo​(IO.​Stream destination, int bufferSize)
Inherited from IO.​Stream
CopyToAsync​(IO.​Stream destination)
Inherited from IO.​Stream
CopyToAsync​(IO.​Stream destination, int bufferSize)
Inherited from IO.​Stream
CopyToAsync​(IO.​Stream destination, int bufferSize, Threading.​CancellationToken cancellationToken)
Inherited from IO.​Stream
CopyToAsync​(IO.​Stream destination, Threading.​CancellationToken cancellationToken)
Inherited from IO.​Stream
CreateWaitHandle​()
Inherited from IO.​Stream
public void
Dispose​()
Inherited from IO.​Stream
FlushAsync​()
Inherited from IO.​Stream
protected void
ObjectInvariant​()
Inherited from IO.​Stream
ReadAsync​(byte[] buffer, int offset, int count)
Inherited from IO.​Stream
public int
ReadAtLeast​(Span<​byte> buffer, int minimumBytes, bool throwOnEndOfStream = true)
Inherited from IO.​Stream
ReadAtLeastAsync​(Memory<​byte> buffer, int minimumBytes, bool throwOnEndOfStream = true, Threading.​CancellationToken cancellationToken = null)
Inherited from IO.​Stream
public void
ReadExactly​(byte[] buffer, int offset, int count)
Inherited from IO.​Stream
public void
ReadExactly​(Span<​byte> buffer)
Inherited from IO.​Stream
ReadExactlyAsync​(byte[] buffer, int offset, int count, Threading.​CancellationToken cancellationToken = null)
Inherited from IO.​Stream
ReadExactlyAsync​(Memory<​byte> buffer, Threading.​CancellationToken cancellationToken = null)
Inherited from IO.​Stream
WriteAsync​(byte[] buffer, int offset, int count)
Inherited from IO.​Stream
public object
GetLifetimeService​()
Inherited from MarshalByRefObject
public object
InitializeLifetimeService​()
Inherited from MarshalByRefObject
protected MarshalByRefObject
MemberwiseClone​(bool cloneIdentity)
Inherited from MarshalByRefObject
public bool
Equals​(object obj)
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object