Skip to content

SSL

[Source]

An SSL session manages handshakes, encryption and decryption. It is not tied to any transport layer.

class ref SSL

Public Functions

alpn_selected

[Source]

Get the protocol identifier negotiated via ALPN. Returns None if the session has been disposed.

fun box alpn_selected()
: (ALPNProtocolName | None val)

Returns


state

[Source]

Returns the SSL session state.

fun box state()
: SSLState

Returns


read

[Source]

Returns unencrypted bytes to be passed to the application. If expect is non-zero, the number of bytes returned will be exactly expect. If no data (or less than expect bytes) is available, this returns None. A disposed session returns None.

fun ref read(
  expect: USize val = 0)
: (Array[U8 val] iso^ | None val)

Parameters

Returns


write

[Source]

When application data is sent, add it to the SSL session. Does nothing if the session has been disposed. Raises an error if the handshake is not complete.

fun ref write(
  data: ByteSeq)
: None val ?

Parameters

Returns


receive

[Source]

When data is received, add it to the SSL session. Does nothing if the session has been disposed.

fun ref receive(
  data: ByteSeq)
: None val

Parameters

Returns


can_send

[Source]

Returns true if there are encrypted bytes to be passed to the destination. Returns false if the session has been disposed.

fun box can_send()
: Bool val

Returns


send

[Source]

Returns encrypted bytes to be passed to the destination. Raises an error if no data is available. A disposed session has no data.

fun ref send()
: Array[U8 val] iso^ ?

Returns


dispose

[Source]

Dispose of the session. state returns SSLDisposed afterwards, whatever state the session was in before.

fun ref dispose()
: None val

Returns