SSL

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

class ref SSL

Constructors

_create

new ref _create(
  ctx: Pointer[_SSLContext val] tag,
  server: Bool val,
  verify: Bool val,
  hostname: String val = seq)
: SSL ref^ ?

Parameters

Returns


Public Functions

state

Returns the SSL session state.

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

Returns


read

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 = seq)
: (Array[U8 val] iso^ | None val)

Parameters

  • expect: USize val = seq

Returns


write

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

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

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

fun ref can_send()
: Bool val

Returns


send

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

Dispose of the session.

fun ref dispose()
: None val

Returns


Private Functions

_final

Dispose of the session.

fun box _final()
: None val

Returns


_verify_hostname

Verify that the certificate is valid for the given hostname.

fun ref _verify_hostname()
: None val

Returns