Skip to content

Latest commit

 

History

History

dotnet

JSON Canonicalizer for .NET

The jsoncanonicalizer folder contains the source code for a JCS (RFC 8785) compliant canonicalizer written in C# for .NET Core 3 and forward.

Using the JSON canonicalizer

using Org.Webpki.JsonCanonicalizer;

    JsonCanonicalizer jsonCanonicalizer = new JsonCanonicalizer(jsonString);
    string result = jsonCanonicalizer.GetEncodedString();

The JsonCanonicalizer() may also be invoked with a byte[] array holding JSON data in UTF-8 format.

In addition to GetEncodedString() there is a method GetEncodedUTF8() returning canonicalized data as a byte[] array.

Constraints

The JSON canonicalizer only accepts a JSON Object or Array as the top level data type.