◈︎

Other implementations:  Python TypeScript Node.js Go Rust

The .NET implementation is a zero-dependendency C# library targeting .NET 8+. All 68 unit tests and all 18 cross-verification vectors pass. Available on NuGet as AIOSchema.

View source → API reference →


Requirements

  • .NET 8.0 or later
  • Zero external dependencies

Install

dotnet add package AIOSchema

Or clone directly:

git clone https://github.com/aioschema/aioschema.git
cd aioschema/implementations/dotnet

Quick Start

using AIOSchema;

// Generate a manifest
var manifest = Generator.GenerateManifest("photo.jpg");

// Verify a manifest
var result = Verifier.Verify("photo.jpg", manifest);
Console.WriteLine($"Verified: {result.Success}, Match: {result.MatchType}");

Core API

Generator.GenerateManifest(path, options?)

Generates an AIOSchema manifest for a file.

var manifest = Generator.GenerateManifest("/path/to/file.png");
// Returns: Manifest

Options:

  • CreatorId - Ed25519 public key fingerprint (ed25519-fp-...)
  • PrivateKey - Ed25519 private key (PKCS#8 DER or raw 32-byte seed)
  • SchemaVersion - defaults to "0.5.6"
  • Extensions - dictionary of extension objects

Verifier.Verify(assetPath, manifest, publicKey?)

Verifies an asset against its manifest.

var result = Verifier.Verify("/path/to/file.png", manifest);
// Returns: VerificationResult

if (result.Success) {
    Console.WriteLine(result.MatchType); // "hard" or "soft"
}

Options:

  • publicKey - Ed25519 public key bytes (32-byte raw or SPKI DER); if omitted, extracted from extensions.public_key

Algorithms.ComputeHash(data, algorithm)

Compute a cryptographic hash.

var sha256 = Algorithms.ComputeHash(data, "sha256");
// Returns: string - "sha256-{hex}"

var sha384 = Algorithms.ComputeHash(data, "sha384");
// Returns: string - "sha384-{hex}"

Algorithms.CanonicalJson(value)

Returns the JCS/RFC 8785 canonical JSON bytes for a value.

var canon = Algorithms.CanonicalJson(new { a = 1, b = 2 });
// Returns: byte[] - deterministic JSON

v0.5.6 Features

The .NET implementation fully supports all v0.5.6 features:

  • extensions.public_key - self-contained Ed25519 public key with fingerprint cross-check
  • extensions.ai_declaration - structured AI disclosure for EU Article 50 compliance
  • 4KB extension size limit - manifests with extensions exceeding 4096 bytes are rejected

Project Structure

implementations/dotnet/
  AIOSchema.csproj      # .NET 8 project file
  Types.cs              # Manifest, Core, VerificationResult, etc.
  Algorithms.cs          # ComputeHash, CanonicalJson, CreatorIdFromPublicKey
  Manifest.cs            # Generator, serialization, Ed25519 signing
  Verify.cs             # Verifier, core/manifest signature verification
  Ed25519.cs            # Pure-Ed25519 implementation (no external crypto libs)
  Uuid7.cs              # UUID v7 generation
  TestSuite.cs          # 68 unit tests (TV-01 through TV-24)
  CrossVerify.cs        # Cross-verification runner (18 CV vectors)
  Program.cs             # CLI harness
  nuget.config           # NuGet package configuration

Test Suite

dotnet test

68 unit tests covering TV-01 through TV-24, plus 18 cross-verification vectors. All tests pass on .NET 8.0 and later.

Conformance

The .NET implementation is one of six reference implementations in the aioschema/aioschema monorepo. All implementations produce byte-identical outputs for the same inputs, verified by the 18-vector cross-verification suite.