PanoramicData.LicenceMagic
10.0.1
dotnet add package PanoramicData.LicenceMagic --version 10.0.1
NuGet\Install-Package PanoramicData.LicenceMagic -Version 10.0.1
<PackageReference Include="PanoramicData.LicenceMagic" Version="10.0.1" />
<PackageVersion Include="PanoramicData.LicenceMagic" Version="10.0.1" />
<PackageReference Include="PanoramicData.LicenceMagic" />
paket add PanoramicData.LicenceMagic --version 10.0.1
#r "nuget: PanoramicData.LicenceMagic, 10.0.1"
#:package PanoramicData.LicenceMagic@10.0.1
#addin nuget:?package=PanoramicData.LicenceMagic&version=10.0.1
#tool nuget:?package=PanoramicData.LicenceMagic&version=10.0.1
PanoramicData.LicenceMagic
Introduction
PanoramicData.LicenceMagic is a .NET 10 library for creating, signing, writing, reading, and validating application licence files.
Licence signatures are bound to a filename and validated against the licensed company, product, validity dates, and assembly version range.
Installation
dotnet add package PanoramicData.LicenceMagic
Usage
Define licence details with a fixed 16-byte initialization vector:
using PanoramicData.LicenceMagic;
public sealed class ProductLicence : LicenceDetails
{
private static readonly byte[] InitVector =
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
public ProductLicence() : base(InitVector)
{
}
}
Create and write a signed licence:
var salt = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
var file = new FileInfo("product.lic");
var details = new ProductLicence
{
LicensedCompany = "Example Ltd",
LicensedProduct = "Example Product",
StartDateUtc = DateTime.UtcNow.Date,
EndDateUtc = DateTime.UtcNow.Date.AddYears(1),
StartVersion = "1.0",
EndVersion = "2.0"
};
details.Sign(file.Name, salt);
new License<ProductLicence>(details).WriteToFile(file, salt);
Read and validate it:
var licence = new License<ProductLicence>(file);
var validation = licence.Validate(salt);
if (!validation.IsValid)
{
throw new InvalidOperationException(validation.ErrorMessage);
}
Keep the salt and initialization vector stable and protect them as application secrets. Existing licence files depend on the values used when they were signed.
Contributing
See CONTRIBUTING.md.
License
This project is licensed under the MIT License. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PanoramicData.LicenceMagic:
| Package | Downloads |
|---|---|
|
PanoramicData.ConsoleMagic
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.