Skip to content

SshKexStateMachine

[Source]

class ref SshKexStateMachine

Constructors

create

[Source]

new ref create(
  role: SshRole)
: SshKexStateMachine ref^

Parameters

Returns


Public Functions

generate_kexinit

[Source]

Generate our SSH_MSG_KEXINIT payload with a random 16-byte cookie. Errors if the CSPRNG fails. When include_strict_marker is set (only the first KEXINIT of a connection), the strict-KEX marker for our role is advertised.

fun ref generate_kexinit(
  prefs: SshAlgorithmPreferences val,
  include_strict_marker: Bool val = false)
: Array[U8 val] val ?

Parameters

Returns


receive_kexinit

[Source]

Parse their KEXINIT, negotiate algorithms.

fun ref receive_kexinit(
  their_payload: Array[U8 val] val,
  our_prefs: SshAlgorithmPreferences val)
: (SshNegotiatedAlgorithms val | SshTransportError)

Parameters

Returns


derive_keys

[Source]

Derive encryption keys per RFC 4253 section 7.2. Errors if the underlying SHA-256 computation fails (rather than producing zero-filled keys).

Each key is: HASH(K || H || X || session_id) where K = shared secret (mpint), H = exchange hash, X = single letter.

fun ref derive_keys(
  shared_secret: Array[U8 val] val,
  exchange_hash: Array[U8 val] val,
  session_id: Array[U8 val] val,
  negotiated: SshNegotiatedAlgorithms val)
: SshDerivedKeys val ?

Parameters

Returns