Ed25519Signer.NET 33.0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ed25519Signer.NET --version 33.0.0.1
NuGet\Install-Package Ed25519Signer.NET -Version 33.0.0.1
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="Ed25519Signer.NET" Version="33.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ed25519Signer.NET --version 33.0.0.1
#r "nuget: Ed25519Signer.NET, 33.0.0.1"
#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 Ed25519Signer.NET as a Cake Addin
#addin nuget:?package=Ed25519Signer.NET&version=33.0.0.1

// Install Ed25519Signer.NET as a Cake Tool
#tool nuget:?package=Ed25519Signer.NET&version=33.0.0.1

alternate text is missing from this package README image

Sign (or verify) data using Ed25519 from RFC8032

Load Key from PEM File

Ed25519KeyDataReader privateKeyData = new Ed25519KeyDataReader("C:\\Keys\\private.pem");

Ed25519PrivateKey privatekey = Ed25519KeyFactory.CreatePrivateKey(privateKeyData.Read());

Load Key from Text File

Ed25519KeyDataReader privateKeyData = new Ed25519KeyDataReader("..\\..\\private3.txt", true);

Ed25519PrivateKey privatekey = Ed25519KeyFactory.CreatePrivateKey(privateKeyData.ReadFromTextFast());            

Load Key from .ED25519 File

Ed25519FileReader privateKeyData = new Ed25519FileReader("..\\..\\private.ED25519");

Ed25519PrivateKey privatekey = Ed25519KeyFactory.CreatePrivateKey(privateKeyData.ReadEd25519Fast());

Signing Data

Ed25519Signer signer = new Ed25519Signer();

signer.Init(privatekey);

signer.BlockUpdate(new byte[32] /* data to sign */, 0 /* offset */, 32 /* data length*/);

byte[] output = signer.GenerateSignature();

signer.Reset();

Verifying Data

Ed25519Verifier verify = new Ed25519Verifier();

verify.Init(publicKey);

verify.BlockUpdate(new byte[32] /* same data to verify */, 0 /* offset */, 32 /* data length*/);

bool v = verify.VerifySignature(output);

verify.Reset();

Creating .ED25519 Files

new Ed25519KeyDataWriter("..\\..\\private.pem", "..\\..\\private.ED25519", true);

Generate Keys

This library can not generate private keys, it just signs data and verifies data.

If you have Windows 10/11 you can generate keys from the command prompt with a standard Windows installation.

// Generate Private Key
openssl genpkey -algorithm ed25519 -out private.pem

// Generate Public Key from the Private Key
openssl pkey -in private.pem -pubout -out public.pem

This also ensures that your keys are really valid and that the library can really understand them.

Full Example

static void Main()
{
    // Signing is usually done by a client
    Ed25519Signer signer = new Ed25519Signer();

    Ed25519KeyDataReader privateKeyData = new Ed25519KeyDataReader("C:\\Keys\\private.pem");

    Ed25519PrivateKey privatekey = Ed25519KeyFactory.CreatePrivateKey(privateKeyData.Read());

    signer.Init(privatekey);

    signer.BlockUpdate(new byte[32] /* data to sign */, 0 /* offset */, 32 /* data length*/);

    byte[] output = signer.GenerateSignature();

    signer.Reset();

    // Verifying is usually done by a server
    Ed25519Verifier verify = new Ed25519Verifier();

    Ed25519KeyDataReader publicKeyData = new Ed25519KeyDataReader("C:\\Keys\\public.pem");

    Ed25519PublicKey publicKey = Ed25519KeyFactory.CreatePublicKey(publicKeyData.Read());

    verify.Init(publicKey);

    verify.BlockUpdate(new byte[32] /* same data to verify */, 0 /* offset */, 32 /* data length*/);

    bool v = verify.VerifySignature(output);

    verify.Reset();

    // Data Matches
    if (v)
    {
        Console.WriteLine("Yes");
    }
    else
    {
        Console.WriteLine("No");
    }

    Console.ReadLine();
}
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 (1)

Showing the top 1 NuGet packages that depend on Ed25519Signer.NET:

Package Downloads
BinanceWebsocket

Provides the fastest access possible to the Binance Websocket API and signs requests using Ed25519

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
34.0.0.7 0 4/27/2024
33.0.0.1 3,052 8/2/2023