A Rust implementation of the Noise Protocol (https://noiseprotocol.org)
Find a file
Jake McGinty c6657a7cad TransportState: limit read_message size to 65535
While not really a big issue since applications should be checking
message sizes over the wire as well, this could theoretically allow for
DoS's by asking snow to decrypt messages larger than the Noise Protocol
specification allows.
2024-01-25 19:22:55 -08:00
.github re-enable github actions for new main branch name 2023-11-11 11:52:52 -05:00
benches cargo clippy pedantic fixes 2024-01-25 18:15:14 -08:00
docs outsource documentation to docs.rs 2018-07-19 17:43:38 +09:00
examples cargo clippy pedantic fixes 2024-01-25 18:15:14 -08:00
hfuzz expand fuzzers a little bit more 2019-06-23 16:44:02 +09:00
src TransportState: limit read_message size to 65535 2024-01-25 19:22:55 -08:00
tests TransportState: limit read_message size to 65535 2024-01-25 19:22:55 -08:00
.gitignore ignore .vscode 2019-01-16 17:13:36 +09:00
build.rs cargo clippy pedantic fixes 2024-01-25 18:15:14 -08:00
Cargo.toml Remove clap from simple example 2024-01-13 11:13:47 +00:00
ci-tests.sh don't run hfs CI tests on windows 2022-02-02 01:32:40 -06:00
LICENSE-APACHE Use https everywhere 2023-03-08 19:43:13 -06:00
LICENSE-MIT LICENSE: Move from Unlicense to Apache/MIT 2021-02-14 20:43:27 +09:00
README.md Deprecate sodiumoxide resolver 2024-01-25 18:06:49 -08:00
rustfmt.toml cargo fmt (and fix deprecated config option) 2022-02-02 02:09:26 -06:00

Snow

Crates.io Docs.rs Build Status dependency status

totally official snow logo

An implementation of Trevor Perrin's Noise Protocol that is designed to be Hard To Fuck Up™.

🔥 Warning 🔥 This library has not received any formal audit.

What's it look like?

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

let mut noise = snow::Builder::new("Noise_NN_25519_ChaChaPoly_BLAKE2s".parse()?)
                    .build_initiator()?;

let mut buf = [0u8; 65535];

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

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

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

See the full documentation at https://docs.rs/snow.

Implemented

Snow is currently tracking against Noise spec revision 34.

However, a not all features have been implemented yet (pull requests welcome):

Crypto

Cryptographic providers are swappable through Builder::with_resolver(), but by default it chooses select, artisanal pure-Rust implementations (see Cargo.toml for a quick overview).

Other Providers

ring

ring is a crypto library based off of BoringSSL and is significantly faster than most of the pure-Rust implementations.

If you enable the ring-resolver feature, Snow will include a resolvers::ring module as well as a RingAcceleratedResolver available to be used with Builder::with_resolver().

If you enable the ring-accelerated feature, Snow will default to choosing ring's crypto implementations when available.

Resolver primitives supported

default ring
CSPRNG
25519
448
AESGCM
ChaChaPoly
SHA256
SHA512
BLAKE2s
BLAKE2b

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.