Skip to content
/ noise Public
forked from Metalnem/noise

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

License

Notifications You must be signed in to change notification settings

ForkBug/noise

 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%