DeployLX Software Protection System

LicenseKey Class

Implements a class for generating keys, signing licenses and performing other actions for a SecureLicense.

Syntax

Public Class LicenseKey _
	Implements IDisposable
public class LicenseKey : IDisposable

Remarks

License keys are an integral part of the license protection system. Their on disk representation (.LSK Files) should be treated with the same care you would give to your safe keys. Keys are used to ensure that only those that have a copy of the key can create valid licenses, serial numbers, activation codes and extensions. Licenses protected with a specific set of keys cannot be modified by anyone else, neither can serial numbers for one set of keys be used with software protected by another pair of keys.

The following table lists the most common tasks performed by the LicenseKey class.

TaskDescription
Sign A License Signing a license ensures that the license was created by the owner of the keys for the protected software and that the license cannot be modified by anyone that does not have a copy of the keys. Any modifications to the license by a third part will automatically invalidate the license.

Generate Serial Numbers Serial numbers are used to unlock and register a license on the end user's machine. DeployLX Licensing includes 5 algorithms for generating serial numbers as well as the ability to register your own custom algorithm.

  • See the Serial Numbers and the Registration Process topic for more information about serial numbers.
  • The DeployLX Manager allows you to generate serial numbers or you can use the [!:Overload:DeployLX.Licensing.Management.v5.LicenseKey.MakeSerialNumber] method to generate one manually.

Generate Activation Codes A license can be tied to a user's MachineProfile preventing it from being installed on additional machines. Activation codes are used to activate a license manually when a license server cannot be used. DeployLX Licensing includes 5 algorithms for generating serial numbers as well as the ability to register your own custom algorithm.

Generate Extensions Licenses that include extendable limits like the TimeLimit and UseLimit can extend the use of the license past its expiration. One common use of an extension is to allow a user continue their evaluation of a trial edition past the initial trial period. Another effective use of extensions is in providing a subscription model. Extension codes are used to extend a license manually when a license server cannot be used. DeployLX Licensing includes 5 algorithms for generating serial numbers as well as the ability to register your own custom algorithm.

  • See the License Extensions and Subscriptions topic for more information.
  • The DeployLX Manager allows you to generate extension codes or you can use the [!:Overload:DeployLX.Licensing.Management.v5.LicenseKey.MakeLicenseExtension] method to generate one manually.

Examples

This sample demonstrates how to create and sign a license. The sample assumes keys for "Product Name" have already been created and are located in the KeyFolder.

Visual Basic
Imports DeployLX.Licensing.v5
Imports DeployLX.Licensing.Management.v5

...

Public Function CreateLicenseForUser(ByVal userName As String) As LicenseFile
    ' Create a new <see cref="T:DeployLX.Licensing.v5.SecureLicense" /> for the user.
    Dim license As New SecureLicense()
    license.Username = userName

    ' Add the license to a <see cref="T:DeployLX.Licensing.v5.LicenseFile" />.
    Dim licenseFile As New LicenseFile()
    licenseFile.Licenses.Add(license)

    ' Load the keys for "Product Name" from the key folder.
    Dim key As New LicenseKey("Product Name")
    key.SignLicense(license)

    Return licenseFile
End Function
C#
using DeployLX.Licensing.v5;
using DeployLX.Licensing.Management.v5;

...

public LicenseFile CreateLicenseForUser( string userName )
{
    // Create a new <see cref="T:DeployLX.Licensing.v5.SecureLicense" /> for the user.
    SecureLicense license = new SecureLicense();
    license.Username = userName;

    // Add the license to a <see cref="T:DeployLX.Licensing.v5.LicenseFile" />.
    LicenseFile licenseFile = new LicenseFile();
    licenseFile.Licenses.Add( license );

    // Load the keys for "Product Name" from the key folder.
    LicenseKey key = new LicenseKey( "Product Name" );
    key.SignLicense( license );

    return licenseFile;
}

Inheritance Hierarchy

System..::..Object
  DeployLX.Licensing.Management.v5..::..LicenseKey

Assembly:  DeployLX.Licensing.Management.v5 (in DeployLX.Licensing.Management.v5.dll)

See Also