ARSoft.WinFormsLicensing 1.5.4

dotnet add package ARSoft.WinFormsLicensing --version 1.5.4
                    
NuGet\Install-Package ARSoft.WinFormsLicensing -Version 1.5.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ARSoft.WinFormsLicensing" Version="1.5.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ARSoft.WinFormsLicensing" Version="1.5.4" />
                    
Directory.Packages.props
<PackageReference Include="ARSoft.WinFormsLicensing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ARSoft.WinFormsLicensing --version 1.5.4
                    
#r "nuget: ARSoft.WinFormsLicensing, 1.5.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ARSoft.WinFormsLicensing@1.5.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ARSoft.WinFormsLicensing&version=1.5.4
                    
Install as a Cake Addin
#tool nuget:?package=ARSoft.WinFormsLicensing&version=1.5.4
                    
Install as a Cake Tool

ARSoft WinForms Licensing

ARSoft WinForms Licensing is a Windows-focused licensing library for .NET applications. It creates, imports, renews, stores, and validates time-based licenses using encrypted local storage plus Windows Registry redundancy.

Features

  • Time-based licenses with configurable validity
  • AES encryption with PBKDF2 key derivation
  • SHA256 checksum validation for tamper detection
  • Dual storage in %AppData% and HKEY_CURRENT_USER
  • Automatic repair when either file or registry copy is missing or invalid
  • Encrypted .lic file generation and import
  • Silent validation mode for client applications
  • Optional logging for vendor tools and diagnostics

Installation

Install-Package ARSoft.WinFormsLicensing
dotnet add package ARSoft.WinFormsLicensing

Requirements

  • .NET 8
  • Windows
  • Microsoft.Extensions.Logging
  • Newtonsoft.Json

Setup

Use the same password and salt everywhere: vendor tools, license file generation, and customer applications. If they differ, existing licenses cannot be decrypted.

using System.Text;

var password = "YourSecurePassword123!";
var salt = Encoding.UTF8.GetBytes("YourUniqueSalt12345");
var appName = "MyApplication";
var settingsFile = "license.json";
var registryKeyPath = "SOFTWARE\\MyCompany\\MyApplication\\License";

Create And Store A License

Use ForCreation in vendor tools or admin flows. The logger is optional.

using ARSoft.WinFormsLicensing;

var manager = LicenseManager.ForCreation(
    logger: null,
    keyPassword: password,
    keySalt: salt,
    appName: appName,
    settingsFile: settingsFile,
    registryKeyPath: registryKeyPath);

var created = manager.CreateLicense(
    clientName: "Customer ABC",
    licensedDate: DateTime.Today,
    validityDays: 366,
    version: "1.0");

Validate A License

Use ForValidation in customer applications. The logger is optional (pass null for silent mode).

using ARSoft.WinFormsLicensing;

var manager = LicenseManager.ForValidation(
    password: password,
    salt: salt,
    appName: appName,
    settingsFile: settingsFile,
    registryKeyPath: registryKeyPath,
    logger: logger); // optional, defaults to null

var result = manager.ValidateLicense();

if (!result.IsValid)
{
    MessageBox.Show(result.Message, "License Validation");
    Application.Exit();
}

ValidateLicense() checks both storage locations. If one valid copy exists, the missing or corrupted copy is rebuilt automatically.

Generate A License File

Use LicenseGenerator.GenerateLicenseFile() to create encrypted .lic files for distribution. The logger is optional.

using ARSoft.WinFormsLicensing.Service.Helpers;

var generated = LicenseGenerator.GenerateLicenseFile(
    clientName: "Customer ABC",
    password: password,
    salt: salt,
    outputFile: @"C:\licenses\customer-abc.lic",
    validityDays: 366,
    startDate: DateTime.Today,
    version: "1.0",
    logger: null);

Import A License File

var imported = manager.ImportLicenseFile(@"C:\licenses\customer-abc.lic");

Renew From License Data

using ARSoft.WinFormsLicensing.Models;

var license = new LicenseData
{
    Client = providedClientHash,
    Licensed = providedLicensedDate,
    Expires = providedExpirationDate,
    Version = "1.0",
    Checksum = providedChecksum
};

var renewed = manager.RenewLicense(license);

Storage

Location Path
File %AppData%\[AppName]\[SettingsFile]
Registry HKEY_CURRENT_USER\[RegistryKeyPath]

settingsFile can also be an absolute path. Relative file names are stored under %AppData%\[AppName].

Main API

Member Description
LicenseManager.ForCreation() Creates a manager for license creation, renewal, import, and validation. Accepts a nullable logger.
LicenseManager.ForValidation() Creates a manager for customer application validation. Accepts a nullable logger.
CreateLicense() Creates and stores a license in both storage locations.
ValidateLicense() Validates checksum, expiration, and storage consistency.
IsLicensePresent() Returns true when a license can be loaded from file or registry.
LoadValidLicense() Loads the first available license copy.
ImportLicenseFile() Imports an encrypted .lic file and stores it locally.
RenewLicense() Stores a new license after checksum validation.
RenewLicenseFromString() Renews from encrypted license text.
RenewLicenseFromFile() Renews from an encrypted license file.
LicenseGenerator.GenerateLicenseFile() Creates an encrypted .lic file. Accepts an optional logger.
LoggerEnabled Enables or disables the configured logger at runtime.

Validation Messages

Scenario Message
Missing or corrupted license Licença não encontrada ou corrompida.
Expired license Licença expirada.
Last valid day Hoje é o último dia da licença.
One day remaining Resta 1 dia até o término da licença.
Up to 31 days remaining Restam [days] dias até o término da licença.

Security Notes

  • Use a strong password.
  • Use a unique salt per application.
  • Keep password and salt consistent across all tools for the same product.
  • Distribute .lic files through a trusted channel.
  • Validate licenses at startup and before sensitive workflows.
  • Registry paths must start with SOFTWARE\.

Version History

v1.5.3

  • Added optional ILogger parameter to LicenseManager.ForValidation() for diagnostics in client applications
  • Added optional ILogger parameter to LicenseGenerator.GenerateLicenseFile() for logging during file generation
  • Logger is now available across all library entry points (ForCreation, ForValidation, LicenseGenerator)

v1.5.2

  • Fixed ForValidation() file lookup so it uses the same %AppData%\[AppName]\[SettingsFile] path as ForCreation()
  • Fixed nullable logger support in ForCreation()
  • Added argument validation for app name, settings file, registry path, password, salt, and version
  • Added fixed-time checksum comparison
  • Added invariant client hashing
  • Added output directory creation for license file generation
  • Added xUnit coverage for creation, validation, import, and checksum rejection
  • Updated package metadata and documentation

v1.5.1

  • Removed parameterless ForValidation() method
  • Required password and salt for validation
  • Unified encryption parameters between creation and validation modes

v1.5.0

  • Added optional logger behavior
  • Added LoggerEnabled

v1.4.0

  • Added ImportLicenseFile()
  • Added LicenseGenerator

v1.3.0

  • Made LicenseUtils public
  • Improved validation and error handling

v1.2.0

  • Added factory methods
  • Added IsLicensePresent()
  • Added LoadValidLicense()

v1.0.0

  • Initial release
Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.17763 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.4 99 5/15/2026
1.5.3 94 5/15/2026
1.5.2 236 10/6/2025
1.5.1 221 10/4/2025
1.4.2 371 9/5/2025 1.4.2 is deprecated because it is no longer maintained and has critical bugs.