Permitski 0.0.8
dotnet add package Permitski --version 0.0.8
NuGet\Install-Package Permitski -Version 0.0.8
<PackageReference Include="Permitski" Version="0.0.8" />
paket add Permitski --version 0.0.8
#r "nuget: Permitski, 0.0.8"
// Install Permitski as a Cake Addin #addin nuget:?package=Permitski&version=0.0.8 // Install Permitski as a Cake Tool #tool nuget:?package=Permitski&version=0.0.8
Permitski
A simple .NET library for generating crypgraphically signed documents.
First you generate a key
var key = DocumentSigner.GenerateKey();
which you might want to hold on to, because it's your secret.
If you lose the key, you lose the ability to sign documents and validate signatures of signed documents, so you can probably imagine that it's pretty important.
With the key in hand, you can create a signer like this:
using(var signer = new DocumentSigner(key))
{
// sign & validate stuff in here
}
Since it's relying on unmanaged resources some place deep within the bowels of the .NET framework, you want to make sure that you dispose the signer properly.
Now, let's pretend we have some important data we want to pass around with a signature, so we can validate its authenticity later on. Here's the class that represents our important data:
class ImportantData
{
public string Data { get; }
public ImportantData(string data)
{
Data = data;
}
}
Let's sign it, so we can give it to someone:
var importantData = new ImportantData("hemmelig");
var signed = signer.Sign(importantData);
Console.WriteLine(signed);
which in this case yielded the following output:
{
"Document": {
"Data": "hemmelig"
},
"Signature": "YHZxo95/CfP4P/ndfh+49m5kmjb2Zj8xkGrkvKVFbcw="
}
Let's see if it's valid - if we store the JSON shown above in a string called json
, we can check its validity like this:
Console.WriteLine($"The document is valid: {signer.IsValid(json)}");
which on my machine yielded:
The document is valid: True
Neat!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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
- newtonsoft.json (>= 13.0.3)
-
net6.0
- newtonsoft.json (>= 13.0.3)
-
net7.0
- newtonsoft.json (>= 13.0.3)
-
net8.0
- newtonsoft.json (>= 13.0.3)
-
net9.0
- newtonsoft.json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.