#noise-protocol #public-key #p2p #handshake #mwc #protocols #remote

mwc-libp2p-noise

Cryptographic handshake protocol using the noise framework

2 releases

0.29.2 Nov 6, 2024
0.29.1 Nov 3, 2024

#2470 in Cryptography

Download history 163/week @ 2024-10-31 121/week @ 2024-11-07 25/week @ 2024-11-14 34/week @ 2024-11-21 28/week @ 2024-11-28 56/week @ 2024-12-05 37/week @ 2024-12-12 18/week @ 2024-12-19 2/week @ 2024-12-26

113 downloads per month
Used in 14 crates (via mwc-libp2p)

MIT license

540KB
10K SLoC

Noise protocol framework support for libp2p.

Note: This crate is still experimental and subject to major breaking changes both on the API and the wire protocol.

This crate provides mwc_libp2p_core::InboundUpgrade and mwc_libp2p_core::OutboundUpgrade implementations for various noise handshake patterns (currently IK, IX, and XX) over a particular choice of Diffie–Hellman key agreement (currently only X25519).

Note: Only the XX handshake pattern is currently guaranteed to provide interoperability with other libp2p implementations.

All upgrades produce as output a pair, consisting of the remote's static public key and a NoiseOutput which represents the established cryptographic session with the remote, implementing futures::io::AsyncRead and futures::io::AsyncWrite.

Usage

Example:

use mwc_libp2p_core::{identity, Transport, upgrade};
use mwc_libp2p_tcp::TcpConfig;
use mwc_libp2p_noise::{Keypair, X25519Spec, NoiseConfig};

let id_keys = identity::Keypair::generate_ed25519();
let dh_keys = Keypair::<X25519Spec>::new().into_authentic(&id_keys).unwrap();
let noise = NoiseConfig::xx(dh_keys).into_authenticated();
let builder = TcpConfig::new().upgrade(upgrade::Version::V1).authenticate(noise);
// let transport = builder.multiplex(...);

Dependencies

~11–23MB
~326K SLoC