Skip to content

Latest commit

 

History

History
81 lines (61 loc) · 2.43 KB

index.md

File metadata and controls

81 lines (61 loc) · 2.43 KB
title
Noise.NET

Latest Version Build Status Build status Docs license

.NET Standard 1.3 implementation of the Noise Protocol Framework (revision 33 of the spec). It features:

  • AESGCM and ChaChaPoly ciphers
  • Curve25519 Diffie-Hellman function
  • SHA256, SHA512, BLAKE2s, and BLAKE2b hash functions
  • Support for multiple pre-shared symmetric keys
  • All known one-way and interactive patterns from the specification
  • XXfallback handshake pattern

Usage

  1. Include the Noise namespace.
using Noise;
  1. Choose the handshake pattern and cryptographic functions.
var protocol = new Protocol(
  HandshakePattern.IK,
  CipherFunction.ChaChaPoly,
  HashFunction.Blake2s,
  PatternModifiers.Psk2
);
  1. Start the handshake by instantiating the protocol with the necessary parameters.
// s is communicated out-of-band
// psk is a 32-byte pre-shared symmetric key

var initiator = protocol.Create(
  initiator: true,
  rs: rs,
  psks: new byte[][] { psk }
);

var responder = protocol.Create(
  initiator: false,
  s: s,
  psks: new byte[][] { psk }
);
  1. Send and receive messages.
(written, hash, transport) = state.WriteMessage(message, outputBuffer);
(read, hash, transport) = state.ReadMessage(received, inputBuffer);

written = transport.WriteMessage(message, outputBuffer);
read = transport.ReadMessage(received, inputBuffer);

See Noise.Examples for the complete example.

Installation

> dotnet add package Noise.NET --version 1.0.0