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

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

Returns


state

[Source]

Returns the SSL session state.

fun box state()
: (SSLHandshake val | SSLAuthFail val | SSLReady val | 
    SSLError val)

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.

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. Raises an error if the handshake is not complete.

fun ref write(
  data: (String val | Array[U8 val] val))
: None val ?

Parameters

Returns


receive

[Source]

When data is received, add it to the SSL session.

fun ref receive(
  data: (String val | Array[U8 val] val))
: None val

Parameters

Returns


can_send

[Source]

Returns true if there are encrypted bytes to be passed to the destination.

fun ref can_send()
: Bool val

Returns


send

[Source]

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

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

Returns


dispose

[Source]

Dispose of the session.

fun ref dispose()
: None val

Returns