IdentityKeys 1.0.0

dotnet add package IdentityKeys --version 1.0.0
NuGet\Install-Package IdentityKeys -Version 1.0.0
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="IdentityKeys" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IdentityKeys --version 1.0.0
#r "nuget: IdentityKeys, 1.0.0"
#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 IdentityKeys as a Cake Addin
#addin nuget:?package=IdentityKeys&version=1.0.0

// Install IdentityKeys as a Cake Tool
#tool nuget:?package=IdentityKeys&version=1.0.0

.NET Identity Keys

A small module of tools to generate and use key pairs for Factom Identities.

WARNING!

Although this has been checked manually for functionality and compatibility with other existing implementations, no official unit tests have been added yet. Do not yet use in production.

Usage

To install this module from nuget, run the following: $

Generating a new random key pair and getting the idpub/idec key strings:

PrivateIdentityKey priv = new PrivateIdentityKey();
PublicIdentityKey pub = priv.GetPublicIdentityKey();
Console.WriteLine("Private Key: " + priv.ToString());
Console.WriteLine("Public Key: " + pub.ToString());

Signing a message and then verifying the signature:

PrivateIdentityKey priv = new PrivateIdentityKey();
PublicIdentityKey pub = priv.GetPublicIdentityKey();
byte[] message = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
byte[] signature = priv.Sign(message);

if (pub.Verify(message, signature))
    Console.WriteLine("Signature Valid!");
else
    Console.WriteLine("Signature Invalid!");

Format of an Identity Key Pair

Note: the following text is taken from the Application Identity Specification

For Factom Application Identities, ed25519 keys are used to sign and verify messages. Rather than simply using raw 32 byte arrays for keys, the following encoding scheme is used:

Pseudo-code for constructing a private key string:

prefix_bytes = [0x03, 0x45, 0xf3, 0xd0, 0xd6]              // gives an "idsec" prefix once in base58 
key_bytes = [32 bytes of raw private key]                  // the actual ed25519 private key seed
checksum = sha256( sha256(prefix_bytes + key_bytes) )[:4]  // 4 byte integrity check on the previous 37 bytes

idsec_key_string = base58( prefix_bytes + key_bytes + checksum )

Pseudo-code for constructing a public key string:

prefix_bytes = [0x03, 0x45, 0xef, 0x9d, 0xe0]              // gives an "idpub" prefix once in base58 
key_bytes = [32 bytes of raw public key]                   // the actual ed25519 public key
checksum = sha256( sha256(prefix_bytes + key_bytes) )[:4]  // 4 byte integrity check on the previous 37 bytes

idpub_key_string = base58( prefix_bytes + key_bytes + checksum )

For the sake of human-readability, all characters must be in Bitcoin's base58 character set, the private key will always begin with "idsec", and the public key will always begin with "idpub". Additionally, the checksum at the end serves to signal that a user has incorrectly typed/copied their key.

Example key pair for the private key of all zeros:

  • idsec19zBQP2RjHg8Cb8xH2XHzhsB1a6ZkB23cbS21NSyH9pDbzhnN6 idpub2Cy86teq57qaxHyqLA8jHwe5JqqCvL1HGH4cKRcwSTbymTTh5n

Example key pair for the private key of all ones:

  • idsec1ARpkDoUCT9vdZuU3y2QafjAJtCsQYbE2d3JDER8Nm56CWk9ix idpub2op91ghJbRLrukBArtxeLJotFgXhc6E21syu3Ef8V7rCcRY5cc
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.

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.0 773 3/13/2019
0.0.1 562 3/12/2019