Struct noise_protocol::HandshakeState [] [src]

pub struct HandshakeState<D: DH, C: Cipher, H: Hash> { /* fields omitted */ }

Noise handshake state.

Notes

HandshakeState does not generate new ephemeral keys when seeing a E token. Users of HandshakeState are responsible for generating fresh ephemeral keys.

Panics

HandshakeState must be used correctly, or its methods will likely panic:

Keys required by the handshake pattern must be set;

write_message and read_message must be called in right turns;

write_message and read_message must not be called after completed.

Methods

impl<D, C, H> HandshakeState<D, C, H> where
    D: DH,
    C: Cipher,
    H: Hash
[src]

Get protocol name, e.g. Noise_IK_25519_ChaChaPoly_BLAKE2s.

Initialize a handshake state.

Takes a payload and return a packet that you should send to the peer.

Update handshake state and get payload, given a packet.

If the packet fails to decrypt, the whole HandshakeState may be in invalid state, and should not be used any more. Expect to get_re before falling back to XXfallback.

Whether handshake has completed.

Get handshake hash. Useful for e.g., channel binding.

Should be called after handshake is completed().

Get ciphers that can be used to encrypt/decrypt furthur messages. The first CiperState is for initiator to responder, and the second for responder to initiator.

Should be called after handshake is completed().

Get remote static pubkey, if available.

Get remote semi-ephemeral pubkey.

Returns None if we do not know.

Useful for noise-pipes.