Noise.SymmetricState (Noise Protocol v0.3.0)

View Source

A SymmetricState (spec §5.2): chaining key ck, handshake hash h and an embedded Noise.CipherState.

Internal to the handshake; users interact with it through Noise.HandshakeState. The chaining key is redacted from inspect/1.

Summary

Types

t()

@opaque t()

Functions

decrypt_and_hash(state, cipher_text)

@spec decrypt_and_hash(t(), binary()) ::
  {:ok, binary(), t()} | {:error, Noise.CipherState.error()}

encrypt_and_hash(state, plain_text)

@spec encrypt_and_hash(t(), binary()) ::
  {:ok, binary(), t()} | {:error, Noise.CipherState.error()}

handshake_hash(symmetric_state)

@spec handshake_hash(t()) :: Noise.Crypto.Hash.hash()

has_key?(symmetric_state)

@spec has_key?(t()) :: boolean()

initialize(protocol)

@spec initialize(Noise.Protocol.t()) :: t()

InitializeSymmetric(protocol_name) (spec §5.2): pad or hash the name into h.

mix_hash(state, data)

@spec mix_hash(t(), iodata()) :: t()

mix_key(state, input_key_material)

@spec mix_key(t(), binary()) :: t()

mix_key_and_hash(state, input_key_material)

@spec mix_key_and_hash(t(), binary()) :: t()

split(symmetric_state)

@spec split(t()) :: {Noise.CipherState.t(), Noise.CipherState.t()}

Split() (spec §5.2): {c1, c2} where c1 is initiator→responder.