TlsStream Class
Namespace: Rebex.Net
Assembly: Rebex.Tls.dll (version 7.0.9048)
Represents a TLS-enabled TCP stream.
Syntax
public class TlsStream : Stream, IAsyncDisposable, IDisposable
Inherited Members
Remarks
This class is suitable for securing your socket communication using TLS 1.3, TLS 1.2, TLS 1.1 and TLS 1.0 protocols.
Constructors
Name | Description |
---|---|
TlsStream(Stream) | Initializes the TlsStream instance. The TlsStream becomes the owner of the supplied stream. |
TlsStream(Socket) | Initializes the TlsStream instance. The TlsStream becomes the owner of the supplied socket. |
Properties
Name | Description |
---|---|
ApplicationProtocol | Gets the negotiated application protocol (via ALPN extension). |
CanRead | Gets a value indicating whether the stream is readable. |
CanSeek | Returns |
CanTimeout | Gets a value indicating whether the stream can time out. |
CanWrite | Gets a value indicating whether the stream is writable. |
Cipher | Gets the negotiated TLS cipher. |
IsAuthenticated | Gets a value indicating whether TLS security on this TlsStream was successfully negotiated. |
IsServer | Gets a value indicating whether the local side of the TLS connection is the server side. |
Length | Not supported. Throws NotSupportedException. |
LocalCertificate | Gets the certificate chain used to authenticate the remote endpoint. |
LogWriter | Gets or sets the log writer used by this object. |
Parameters | Gets or sets the security parameters of the current TlsStream. |
Position | Not supported. Throws NotSupportedException. |
ReadTimeout | Gets or sets the length of time, in milliseconds, until the read operation times out, or the value -1 or 0 to indicate that the operation does not time out. |
RemoteCertificate | Gets the certificate chain used to authenticate the remote endpoint. |
WriteTimeout | Gets or sets the length of time, in milliseconds, until the write operation times out, or the value -1 or 0 to indicate that the operation does not time out. |
Methods
Name | Description |
---|---|
AuthenticateAsClient(TlsClientSettings) | Performs TLS negotiation. This TlsStream will behave as a TLS client.
To configure security parameters not available in |
AuthenticateAsClient(String) | Performs TLS negotiation. This TlsStream will behave as a TLS client. To configure security parameters use the Parameters property. |
AuthenticateAsClientAsync(TlsClientSettings) | Performs TLS negotiation. This TlsStream will behave as a TLS client. To configure security parameters use the Parameters property. |
AuthenticateAsClientAsync(TlsClientSettings, CancellationToken) | Performs TLS negotiation. This TlsStream will behave as a TLS client. To configure security parameters use the Parameters property. |
AuthenticateAsClientAsync(String) | Performs TLS negotiation. This TlsStream will behave as a TLS client. To configure security parameters use the Parameters property. |
AuthenticateAsServer(TlsServerSettings) | Performs TLS negotiation. This TlsStream will behave as a TLS server. To configure security parameters use the Parameters property. |
AuthenticateAsServer(CertificateChain) | Performs TLS negotiation. This TlsStream will behave as a TLS server. To configure security parameters use the Parameters property. |
AuthenticateAsServerAsync(TlsServerSettings) | Performs TLS negotiation. This TlsStream will behave as a TLS server. To configure security parameters use the Parameters property. |
AuthenticateAsServerAsync(TlsServerSettings, CancellationToken) | Performs TLS negotiation. This TlsStream will behave as a TLS server. To configure security parameters use the Parameters property. |
AuthenticateAsServerAsync(CertificateChain) | Performs TLS negotiation. This TlsStream will behave as a TLS server. To configure security parameters use the Parameters property. |
BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) | Asynchronously reads data from this TlsStream. |
BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) | Asynchronously writes data into this TlsStream. |
CloseAsync() | Asynchronously releases resources used by the TlsStream. |
Dispose(Boolean) | Releases resources used by this stream. |
DisposeAsync() | Asynchronously releases resources used by this stream. |
EndRead(IAsyncResult) | Ends a pending asynchronous read request. |
EndWrite(IAsyncResult) | Ends a pending asynchronous write request. |
Flush() | Causes any buffered data to be written. Has no effect on TlsStream. |
FlushAsync(CancellationToken) | Causes any buffered data to be written. Has no effect on TlsStream. |
GetChannelBinding(ChannelBindingType) | Gets an instance of the ChannelBinding that matches the |
GetHashCode() | Gets a hash code of this object. |
HasChannelBinding(ChannelBindingType) | Gets an indication whether a provider has a ChannelBinding that matches the |
Read(Byte[], Int32, Int32) | Reads data from this TlsStream. |
ReadAsync(Byte[], Int32, Int32, CancellationToken) | Asynchronously reads data from this TlsStream. |
Seek(Int64, SeekOrigin) | Not supported. Throws NotSupportedException. |
SetLength(Int64) | Not supported. Throws NotSupportedException. |
Shutdown() | Disables sends on this TlsStream. |
ShutdownAsync() | Disables sends on this TlsStream. |
ToString() | Returns a string representation of this object. |
Write(Byte[], Int32, Int32) | Writes data into this TlsStream. |
WriteAsync(Byte[], Int32, Int32, CancellationToken) | Asynchronously writes data into this TlsStream. |
Events
Name | Description |
---|---|
ClientHelloReceived | Occurs when a TLS ClientHello has been received (useful for TLS servers only). |
ValidatingCertificate | Occurs when a certificate provided by the remote end needs to be validated. |