abla/tls/pure/connection

Generated from source.

Import with import "abla/tls/pure/connection".

Source: abla/tls/pure/connection/entry.ab

tlsPureRandom (fun)

fun tlsPureRandom(count: int): string

Secure random bytes for the handshake (the random, the session id, the key shares).

TlsPureConnection (class)

resource class TlsPureConnection(var tcp: TcpConnection, var client: TlsClient, var server: TlsServer,
    var isServer: bool, var lastError: string, var stage: int, var broken: bool = false,
    var brokenStage: int = 9)

A connection: a socket and the state machine that speaks TLS on it, a client's or a server's (the other is an unused placeholder; isServer says which). stage is why it is unusable, as the hosted API numbers them: 0 none, 1 configuration, 2 tcp_connect, 8 socket_attach, 9 handshake, 10 certificate_verification, 12 server handshake, 13 timed out.

TlsPureConnection.drop (method)

fun drop(): void

Closes the socket and attempts to send a TLS close notification when the connection is usable.

TlsPureConnection.discard (extension fun)

fun TlsPureConnection.discard(): void

Drops the TLS state without telling the peer (TlsConnection.detach): the machine clears its secrets, and the close_notify that closing it queues is thrown away, never sent.

TlsPureConnection.connected (extension fun)

fun TlsPureConnection.connected(): bool

Returns whether the client or server state machine completed its handshake.

TlsPureConnection.machineFailed (extension fun)

fun TlsPureConnection.machineFailed(): bool

Returns whether the active TLS state machine is in a failed state.

TlsPureConnection.machineError (extension fun)

fun TlsPureConnection.machineError(): string

Returns the error recorded by the active TLS client or server.

TlsPureConnection.machineClosed (extension fun)

fun TlsPureConnection.machineClosed(): bool

Returns whether the active TLS state machine is closed.

TlsPureConnection.suite (extension fun)

fun TlsPureConnection.suite(): int

The cipher suite negotiated (0 before the handshake ends).

TlsPureConnection.alpn (extension fun)

fun TlsPureConnection.alpn(): string

The negotiated ALPN protocol, "" for none.

TlsPureConnection.resumed (extension fun)

fun TlsPureConnection.resumed(): bool

Whether this connection resumed a session (TLS 1.3 PSK from a ticket: no certificate was sent).

TlsPureConnection.channelBinding (extension fun)

fun TlsPureConnection.channelBinding(kind: string): string

The channel binding of kind (abla/tls/pure/binding), raw bytes, "" when it is not available.

TlsPureConnection.clientCertificateVerified (extension fun)

fun TlsPureConnection.clientCertificateVerified(): bool

True when a client certificate was presented and accepted (a server connection).

TlsPureConnection.peerChain (extension fun)

fun TlsPureConnection.peerChain(): array<string>

The peer's certificate chain (DER, end entity first): the client's on a server connection (empty when it sent none), the server's on a client connection.

TlsPureConnection.peerVerified (extension fun)

fun TlsPureConnection.peerVerified(): bool

Whether the peer's certificate was verified by the configured verifier: on a server connection the client's (false when it sent none), on a client connection the server's (true once connected: a client that does not verify aborts; a resumed connection carries the verification of the connection its ticket came from: tickets are kept only under a verifying scope).

tlsPureUpgrade (fun)

fun tlsPureUpgrade(var tcp: TcpConnection, config: TlsClientConfig, timeoutMilliseconds: int = 5000,
    readWriteTimeoutMilliseconds: int = 30000, deadline: int = 0,
    identity: TlsIdentity? = null): TlsPureConnection

Runs a client handshake over a connected socket, whose ownership passes in (it is closed on failure). Check ok(): on failure lastError and stage say why.

tlsPureConnect (fun)

fun tlsPureConnect(config: TlsClientConfig, port: int = 443, timeoutMilliseconds: int = 5000,
    readWriteTimeoutMilliseconds: int = 30000, deadline: int = 0,
    identity: TlsIdentity? = null): TlsPureConnection

Connects (a host name, an IPv4 or IPv6 address; "localhost" goes to ::1) and runs the handshake.

tlsPureServerUpgrade (fun)

fun tlsPureServerUpgrade(var tcp: TcpConnection, config: TlsServerConfig, timeoutMilliseconds: int = 5000,
    readWriteTimeoutMilliseconds: int = 30000, deadline: int = 0): TlsPureConnection

Runs a server handshake over an accepted socket, whose ownership passes in (it is closed on failure). A client that connects and says nothing costs one handshake timeout.

TlsPureConnection.ok (extension fun)

fun TlsPureConnection.ok(): bool

Returns whether the socket is open and the TLS state machine is connected.

TlsPureConnection.read (extension fun)

fun TlsPureConnection.read(maximum: int = 65536): string

Up to maximum bytes of application data; "" at the end of the stream (lastError is "") or on a timeout or failure (lastError says why; a timed-out read can be repeated).

TlsPureConnection.write (extension fun)

fun TlsPureConnection.write(contents: string): int

Sends all of contents; the bytes taken, or -1 on failure.

TlsPureConnection.close (extension fun)

fun TlsPureConnection.close(): bool

Attempts to send a TLS close notification and returns whether the socket closed successfully.

tlsPureFailedConnection (fun)

fun tlsPureFailedConnection(config: TlsClientConfig, message: string, stage: int): TlsPureConnection

A failed client connection that never had a socket (a configuration or trust-store problem), for the API layer.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.