Ed25519Signer.NET
34.0.0.7
dotnet add package Ed25519Signer.NET --version 34.0.0.7
NuGet\Install-Package Ed25519Signer.NET -Version 34.0.0.7
<PackageReference Include="Ed25519Signer.NET" Version="34.0.0.7" />
paket add Ed25519Signer.NET --version 34.0.0.7
#r "nuget: Ed25519Signer.NET, 34.0.0.7"
// Install Ed25519Signer.NET as a Cake Addin
#addin nuget:?package=Ed25519Signer.NET&version=34.0.0.7
// Install Ed25519Signer.NET as a Cake Tool
#tool nuget:?package=Ed25519Signer.NET&version=34.0.0.7
Sign
and Verify
data using Ed25519
from RFC8032
Simple Usage
The easiest way to use Ed25519Signer.NET
is by creating a Ed25519SignerService
and/or Ed25519VerifierService
Sign
You can reuse this service to sign multiple pieces of data
Ed25519SignerService signer = new("private.pem", 2048);
byte[] signature = signer.Sign(new byte[64]);
Verify
You can reuse this service to verify multiple pieces of data
Ed25519VerifierService verifier = new("public3.txt", 2048);
bool success = verifier.Verify(signature, new byte[64]);
Generate Keys
This library can not generate new Private Keys
An easy way to generate keys is using Git Bash
which can be downloaded Here
// Generate Private Key
openssl genpkey -algorithm ed25519 -out "C:\private.pem"
// Generate Public Key from the Private Key
openssl pkey -in "C:\private.pem" -pubout -out "C:\public.pem"
Advanced Usage
If you don't want to use either of the Services
you can do everything manually.
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
Create a single use Signer
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
Create a single use Verifier
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
Creates a .ED25519
file which has the key
on the first line
new Ed25519KeyDataWriter("private.pem", "private.ED25519", true);
Product | Versions 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. |
-
.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.
Add Ed25519SignerService
Add Ed25519VerifierService
Change default namespace to Ed25519DataSignerVerifier
Tweak namepsaces so Ed25519SignerService and Ed25519VerifierService appear first
Move most existing classes for more advanced usage to Ed25519DataSignerVerifier.Advanced
Ed25519SignerService maintains an internal list of Single use Ed25519Signers so they can be reused without creating new ones
Ed25519VerifierService maintains an internal list of Single use Ed25519Verifiers so they can be reused without creating new ones