Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.65 KB

README.md

File metadata and controls

46 lines (30 loc) · 1.65 KB

Whyvra.Crypto.X25519

LICENSE PRs Welcome NuGet

An elliptic curve offering 128 bits of security and designed for use with the elliptic curve Diffie–Hellman (ECDH) key agreement scheme.

The goal of this library is to provide a NuGet package targeting .NET Standard 2.0 that is compatible with Blazor WebAssembly.

Installation

dotnet add package Whyvra.Crypto.X25519

Usage

var curve25519 = new Curve25519();
var alicePrivate = curve25519.CreateRandomPrivateKey();
var alicePublic = curve25519.GetPublicKey(alicePrivate);

var bobPrivate = curve25519.CreateRandomPrivateKey();
var bobPublic = curve25519.GetPublicKey(bobPrivate);

var aliceShared = curve25519.GetSharedSecret(alicePrivate, bobPublic);
var bobShared = curve25519.GetSharedSecret(bobPrivate, alicePublic);
var equal = aliceShared.SequenceEqual(bobShared);

Attribution

This library is based on work by Timothy Meadows and Michael Heyman and their respective libraries linked below.

https://github.com/TimothyMeadows/Curve25519.NetCore https://github.com/mheyman/Isopoh.Cryptography.Argon2

Curve25519 was designed by Daniel J. Bernstein.

All credit for work go to the original authors.

License

Released under the MIT License.