Installing the .NET SDK
The easiest way to add software licensing into your .NET application is by installing our .NET SDK, available open source on GitHub. We suggest installing it using NuGet if possible. There are two versions available: Cryptolens.Licensing and Cryptolens.Licensing.CrossPlatform. You can also import the binaries by downloading them from GitHub, under Releases.
We recommend to review the Recommended articles section if you plan to build .NET applications running on Unity/Mono, AutoCAD or Rhinoceros/Grasshopper.
Example key verification
The code below verifies a license key with our API. This example is covered in more detail on this page. If your application needs to work offline, please check out the following article.
var licenseKey = "GEBNC-WZZJD-VJIHG-GCMVD";
var RSAPubKey = "Enter the RSA Public key here. Click here to view it.";
var auth = "Access token with permission to access the activate method. Click here to view it.";
var result = Key.Activate(token: auth, parameters: new ActivateModel()
{
Key = licenseKey,
ProductId = 3349,
Sign = true,
MachineCode = Helpers.GetMachineCodePI(v: 2)
});
if (result == null || result.Result == ResultType.Error ||
!result.LicenseKey.HasValidSignature(RSAPubKey).IsValid())
{
// an error occurred or the key is invalid or it cannot be activated
// (eg. the limit of activated devices was achieved)
Console.WriteLine("The license does not work.");
}
else
{
// everything went fine if we are here!
Console.WriteLine("The license is valid!");
}
Console.ReadLine();