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 when the session has been disposed or is in SSLAuthFail.

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, this returns None until at least expect bytes are available, then returns everything it holds, which is at least expect. Returns None when the session has been disposed or is in SSLAuthFail.

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 or if SSL_write does not encrypt the data.

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

Parameters

Returns


receive

[Source]

When data is received, add it to the SSL session. Does nothing when the session has been disposed or is in SSLAuthFail or SSLError.

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