Crate snow [] [src]

The snow crate is a straightforward, Hard To Fuck Up™ Noise Protocol implementation.

Read the Noise Protocol Framework Spec for more information.

The typical usage flow is to use NoiseBuilder to construct aNoiseSession<HandshakeState>, which can transition to a NoiseSession<TransportState> once the handshake is completed.

Examples

See examples/simple.rs for a more complete TCP client/server example.

let noise = NoiseBuilder::new("Noise_NN_ChaChaPoly_BLAKE2s".parse().unwrap())
                         .build_initiator()
                         .unwrap();

let mut buf = [0u8; 65535];

// write first handshake message
noise.write_message(&[0u8; 0], &mut buf).unwrap();

// receive response message
let incoming = receive_message_from_the_mysterious_ether();
noise.read_message(&incoming, &mut buf).unwrap();

// complete handshake, and transition the state machine into transport mode
let noise = noise.into_transport_mode();

Modules

params

All structures related to Noise parameter definitions (cryptographic primitive choices, protocol patterns/names)

types

The traits for cryptographic implementations that can be used by Noise.

Structs

HandshakeState

A state machine encompassing the handshake phase of a Noise session.

NoiseBuilder

Generates a NoiseSession and also validate that all the prerequisites for the given parameters are satisfied.

NoiseSession

The high-level state machine for the flow from handshake to transport stages.

TransportState

A state machine encompassing the transport phase of a Noise session, using the two CipherStates (for sending and receiving) that were spawned from the SymmetricState's Split() method, called after a handshake has been finished.

Enums

NoiseError

All error types produced by a Noise operation.

Traits

CipherStateType
NoiseSessionState

Methods that must be implemented across all states in the NoiseSession state machine.