DeployLX Software Protection System

Serial Numbers and the Registration Process

Serial numbers are the traditional method used by most developers to protect their software. DeployLX supports a the common unlocking scenario as well as extremely powerful license selection and initialization techniques.

With a single compiled assembly you can create a single license file representing multiple editions of the same product. DeployLX Licensing serial numbers target and unlock individual licenses which can in turn include a variety of limits that define how and when that particular edition can be used.

In this Topic

Configuring a License to Use Serial Numbers

The default license file created by DeployLX includes an initial trial version that lets the user evaluate the software for 30 days. The license file contains two additional licenses for two different editions of the product. You can add additional licenses/editions to the license.

To create a license that uses serial numbers

  1. Select New License | Easy License Editor from the Home tab of the Ribbon in the DeployLX Manager
  2. Select With a serial number that I provide from the Basic Options Tab.
  1. Select New License | Advanced License Editor from the Home tab of Ribbon in the DeployLX Manager.
  2. Select Require a serial number to use the 'XXXX' edition to enable serial number unlocking.

Unlocking a License

There are two ways that a serial number can be provided for a license.

Using the Registration Limit

The default style created by the DeployLX Manager when creating a license. One license in the edition in the license file contains a Registration. When the license is validated, DeployLX prompts the user to enter their serial number and unlocks the corresponding license edition. The serial number will be saved with the license so the user does not need to enter the it again.

The edition with the Registration limit must not require a serial number and usually contains a trial limit that lets the user evaluate the software before purchasing.

Using the Registration limit will not work for ASP.NET Applications, Web Service or for NT services since DeployLX cannot display a form to the user. You must use another method to obtain a serial number from the user.

Using LicenseValidationRequestInfo

Pass a serial number to DeployLX during validation using the LicenseValidationRequestInfo class.

This sample demonstrates reading a serial number from an external file named SerialNumber.inf in the root folder of the application.

Private info As New LicenseValidationRequestInfo()
Private infFile As String = Path.Combine( _
        AppDomain.CurrentDomain.BaseDirectory, _
        "SerialNumber.inf")
        
Using reader As New StreamReader(infFile)
    info.SerialNumbers = New String() { reader.ReadLine() }
End Using

_license = SecureLicenseManager.Validate(Me, Nothing, info)
var info = new LicenseValidationRequestInfo();
string infFile = Path.Combine( 
        AppDomain.CurrentDomain.BaseDirectory, 
        "SerialNumber.inf" );
        
using( StreamReader reader = new StreamReader( infFile ) )
    info.SerialNumbers = new string[] { reader.ReadLine() };
    
_license = SecureLicenseManager.Validate( this, null, info );

Initializing Limits and License State with Serial Numbers

Serial numbers may contain additional data embedded in the serial number when it is generated.

Initializing a License with a Serial Number

The normal behavior for a license unlocked with a serial number is to simply enable the license for validation. When the target license also contains Extendable limits the initial state of the license can be set by the serial number used to unlock it.

For example a license that contains a single Time can have the initial expiration set at the time the serial number is generated. After the initial time period you can later extend the user's time with an extension code.

To set a limit's initial state when generating a serial number, select the limit in the Initialize... section and select the desired initial value.

Flags

Serial numbers also allow for 8 unique flags. These flags can be set when the serial number is generated and later checked by the protected software. The flags can be used to selectively enable or disable features when the software is used.

For more features, or to allow features to be selectively enabled after registration use a Feature limit.

This sample demonstrates how to check for a flag after a license has been validated.

Private _license = SecureLicenseManager.Validate(Me, Nothing, Nothing)

If _license.IsUnlocked AndAlso _
    _license.GetFlag(SerialNumberFlags.Flag1) Then
    MakeAdvancedToolsAvailable()
End If
_license = SecureLicenseManager.Validate( this, null, null );

if( _license.IsUnlocked && _license.GetFlag( SerialNumberFlags.Flag1 ) )
    MakeAdvancedToolsAvailable();

Generating Serial Numbers

Use the DeployLX Manager to generate serial numbers for your users by using the Generate Serial Numbers Form.

Using DeployLX to Generate Serials

  1. Open the license in DeployLX.
  2. Select the license/edition you want to generate serials for.
  3. Select Generate Code | Generate Serial Number from the Home tab of the Ribbon. The Generate Serial Numbers Form is displayed.
  4. Select the flags to set in serial number.
  5. If initializing any extendable limits select the limit and initial value.
  6. Select Generate to generate the serial numbers.

Generating from Code

This sample demonstrates how to generate serial numbers in code. See the MakeSerialNumber method for details.

Private key As New LicenseKey("Path to LSK keys file")
key.DeployLxSerialNumbers = New String() { "Your DeployLX Serial #." }

Private serialNumber As String = key.MakeSerialNumber(_
    "PRO-",_
    1,_
    SerialNumberFlags.None,_
    -1,_
    0,_
    -1,_
    0)
LicenseKey key = new LicenseKey( "Path to LSK keys file" );
key.DeployLxSerialNumbers = new string[] { "Your DeployLX Serial #." };

string serialNumber = key.MakeSerialNumber(
    "PRO-",
    1,
    SerialNumberFlags.None,
    -1,
    0,
    -1,
    0 );

If the license uses extendable limits that might be initialized with a serial number, you must reserve space in the serial number so that it matches the registration code masks.

Private key As New LicenseKey("Path to LSK keys file")
key.DeployLxSerialNumbers = New String() { "Your DeployLX Serial #." }

Private serialNumber As String = key.MakeSerialNumber(_
    "PRO-",_
    1,_
    SerialNumberFlags.None,_
    ' Unused but reserved space for extendable limit.
    0,_
    0,_
    0,_
    0)
LicenseKey key = new LicenseKey( "Path to LSK keys file" );
key.DeployLxSerialNumbers = new string[] { "Your DeployLX Serial #." };

string serialNumber = key.MakeSerialNumber(
    "PRO-",
    1,
    SerialNumberFlags.None,
    // Unused but reserved space for extendable limit.
    0,
    0,
    0,
    0 );