Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

SslStream

class SslStream

Module: System.Networking.Security
Assembly: System.Networking.dll
Source file: SslStream.rvn

Inheritance: Object → SslStream
Implements: Disposable, InputStream, OutputStream

TLS over asynchronous byte streams, with explicit authentication and graceful shutdown. Sequential operations only; overlapping operations return WrongAccess. Close is abortive. Cancellation or transport failure after an operation starts poisons the TLS session.

Constructors

2 items
SslStream(input: InputStream, output: OutputStream, leaveOpen: bool) Creates a wrapper, optionally preserving both underlying stream capabilities on Close.
SslStream(input: InputStream, output: OutputStream) Creates a wrapper owning both stream capabilities; repeated underlying Close must be safe.

Properties

1 item
IsAuthenticated: bool True after successful authentication, while this session remains usable.

Methods

12 items
AuthenticateAsClient(options: SslClientAuthenticationOptions, targetHost: string, cancellationToken?: CancellationToken) -> Task<Result<void, SslError>> Authenticates the server using explicit trust and the expected DNS name (also used for SNI). Cancellation before entry preserves state; cancellation after starting aborts the sessi…
AuthenticateAsServer(options: SslServerAuthenticationOptions, cancellationToken?: CancellationToken) -> Task<Result<void, SslError>> Authenticates as a server using an owned certificate chain and private key. Cancellation after starting aborts the session; no client certificate is requested.
Close() -> () Abortive, idempotent release; use Shutdown first when graceful closure is required. Implements InputStream.Close, OutputStream.Close
Dispose() -> () Equivalent to Close. Implements Disposable.Dispose
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
Flush(cancellationToken?: CancellationToken) -> Task<Result<void, StreamError>> Flushes the underlying output; no TLS application data remains buffered after Write. Implements OutputStream.Flush
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Read(buffer: byte[], offset: int, count: int, cancellationToken?: CancellationToken) -> Task<Result<int, StreamError>> Reads authenticated plaintext. Zero count is a no-op; positive-count zero means close-notify. Implements InputStream.Read
Shutdown(cancellationToken?: CancellationToken) -> Task<Result<void, StreamError>> Gracefully closes local writes. Idempotent; cancellation after entry aborts the session.
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString
Write(buffer: byte[], offset: int, count: int, cancellationToken?: CancellationToken) -> Task<Result<void, StreamError>> Encrypts and writes the complete range. Success does not imply peer receipt. Implements OutputStream.Write