After installing Secure License Manager, you can get started with generating, validating and activating/unlocking license keys. To get started with Secure License Manager, you have to first create a license configuration. To create a license configuration, select the "File -> New License Configuration" menu option on the main window (shown in Figure 2. below). This menu option will open the "New License Configuration" dialog (shown in Figure 1. below). In this dialog, you can specify the name and the key size for your license configuration or you can or you can enter an existing public/private key. Note that larger key sizes will result in larger license keys.
Figure 1. New license configuration dialog.
After creating a license configuration or selecting an existing license configuration, you can select your license settings and generate license keys. The main window is where you will select your license settings for the license keys that you will be generating for the selected license configuration. The different options of the main window are described below.
Figure 2. Secure License Manager Main Window.
Figure 3. License Validation Dialog.
To validate a license key in your application, you create an instance of the
SecureLicense class by specifying the validation key for your license
configuration. Then you will use the Activate method if you would like to
register the license key or the Load method if you would like to load the
license for a previously activate license key. After activating or loading your
license, you can use the "IsValid" property and other properties of the
SecureLicense class to further validate the license.
Note, after activating an activation
license key for the first time, you must save the license using the "Save"
method in order to be able to load the license in the future. In the case of unlock license keys,
saving the activated license is optional. The listing below shows the basic steps for implementing licensing using Secure License Manager.
private bool CheckLicense() { string validationKey = "BgIAAACkAABSU....."; SecureLicense license = new SecureLicense(validationKey); //Specify license store location (can be a file or registry) license.LicenseFilePath = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.CommonApplicationData), "my test license.lic"); //Attempt to load an existing license if you have previously saved an activated/unlocked license key if (!license.Load()) { //When your application runs the very first time, //license.Load() will fail because there is no existing //license. You can specify an evaluation/trial //license key to register an evaluation/trial license. //Alternatively, you can also specify and register your //evaluation/trial license key using a setup program. license.Activate("B7KEP-NLPAP-6RJ9T-..."); //Save the license for future use if it is valid. Saving the license is optional for "Unlock keys". if(license.IsValid) { license.Save(); } } //If license is not valid, request for a valid license //or terminate the application. if (!license.IsValid) { //Request for a valid license. //If no valid license is provided, //then terminate the application. //or show some other failure message. } return license.IsValid; }
Private Function CheckLicense() As Boolean Dim validationKey As String = "BgIAAACkAABSU....." Dim license As SecureLicense = New SecureLicense(validationKey) 'Specify license store location (can be a file or registry) license.LicenseFilePath = Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.CommonApplicationData), "my test license.lic") 'Attempt to load an existing license if you have previously saved an activated/unlocked license key. If Not license.Load Then 'When your application runs the very first time, 'license.Load() will fail because there is no existing 'license. You can specify an evaluation/trial 'license key to register an evaluation/trial license. 'Alternatively, you can also specify and register your 'evaluation/trial license key using a setup program. license.Activate("B7KEP-NLPAP-6RJ9T-...") 'Save the license for future use if it is valid. Saving the license is optional for "Unlock keys". If license.IsValid Then license.Save() End If End If 'If license is not valid, request for a valid license 'or terminate the application. If Not license.IsValid Then 'Request for a valid license. 'If no valid license is provided, 'then terminate the application. 'or show some other failure message. End If Return license.IsValid End Function