ofcoursedude.Curve25519 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package ofcoursedude.Curve25519 --version 1.0.3
NuGet\Install-Package ofcoursedude.Curve25519 -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ofcoursedude.Curve25519" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ofcoursedude.Curve25519 --version 1.0.3
#r "nuget: ofcoursedude.Curve25519, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ofcoursedude.Curve25519 as a Cake Addin
#addin nuget:?package=ofcoursedude.Curve25519&version=1.0.3

// Install ofcoursedude.Curve25519 as a Cake Tool
#tool nuget:?package=ofcoursedude.Curve25519&version=1.0.3

Curve25519 is an elliptic curve, developed by Dan Bernstein, for fast Diffie-Hellman key agreement.

Ported parts from Java to C# and refactored by Hans Wolff, 17/09/2013.
Original: https://github.com/hanswolff/curve25519/

Ported from C to Java by Dmitry Skiba [sahn0], 23/02/08.
Original: http://code.google.com/p/curve25519-java/

C implementation based on generic 64-bit integer implementation of Curve25519 ECDH
Written by Matthijs van Duin, 200608242056
Original: http://cds.xs4all.nl:8081/ecdh/ (broken link)

Updated by ofcoursedude to work as a netstandard2.0 library

Warning! This implementation is susceptible to timing attacks!

Usage Example
// what Alice does
byte[] aliceRandomBytes = new byte[32];
RNGCryptoServiceProvider.Create().GetBytes(aliceRandomBytes);

byte[] alicePrivate = Curve25519.ClampPrivateKey(aliceRandomBytes);
byte[] alicePublic = Curve25519.GetPublicKey(alicePrivate);

// what Bob does
byte[] bobRandomBytes = new byte[32];
RNGCryptoServiceProvider.Create().GetBytes(bobRandomBytes);

byte[] bobPrivate = Curve25519.ClampPrivateKey(bobRandomBytes);
byte[] bobPublic = Curve25519.GetPublicKey(bobPrivate);

// what Alice does with Bob's public key
byte[] aliceShared = Curve25519.GetSharedSecret(alicePrivate, bobPublic);

// what Bob does with Alice' public key
byte[] bobShared = Curve25519.GetSharedSecret(bobPrivate, alicePublic);

// aliceShared == bobShared

Example project

There is a sample project in Curve25519.Example folder that implements a basic Blazor web app that
mimics the functionality of the above example. It is intended to showcase the use of the netstandard2.0 
library in a WebAssembly project.
NuGet Package

...can be downloaded from here:
https://www.nuget.org/packages/Curve25519/

ECDSA

You cannot sign and verify messages with the implementation above. If you need an ECDSA you can use Ed25519.

A good port of Ed25519 can be found here:
https://github.com/CodesInChaos/Chaos.NaCl

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.72 537 3/20/2023
1.0.64 288 3/17/2023
1.0.58 184 3/17/2023
1.0.39 535 11/20/2022
1.0.3 727 5/9/2021
1.0.0.38 308 11/20/2022