How to use cryptolicensing


Cryptolicensing is a software licensing product that is mainly based on encrypted licences.

Cryptolicensing is flexible but has a bit of a counter-inuitive way of working if you are not familiar with it. It also requires quite a lot of configuration and even coding in some cases.

First things you need to know:

The “Cryptolicensing Generator UI” is used for a few things:

– Create a .licproj file => this is actually the file that is saved whenever a setting changes in the UI
– Create the licenseservice
– Create licenses IF you are not using the licenseservice

the .licproj ( or .netlicproj as it is sometimes called in the documentation) is also saved in the app_data folder of the licenseservice. This file is used to generate licenses should you be using an e-commerce provider.

The .licproj/.netlicproj is not used in validation of a license on the client side. There is a ValidationKey for this. This validationkey can be generated in the UI by pressing Ctrl+K .

Since we live in the 21st centry we like to use automatic license generation. So here are the steps to take:

  1. Open Cryptolicensing Generator UI. Create a new profile with the prefered settings.
  2. Optional: create a second profile for evaluation purposes. make sure the first profile is the active profile (you can do this by pressing the “save” button next to the dropdown of profiles).
  3. Generate the licenseservice.
  4. Open up the licenseservice project in visual studio and modify as stated in the .chm documentation (search for “Configuring the License Service”).
  5. Modify LicenseService.cs as stated in the documentation (.chm file)  (look for subscription based licensing) and make sure the “UpdateLicenseTableOnNewOrder” is modified so that the license has an expire date (you can look in UpdateLicenseTableOnRenewalOrder for this) … this is necessary so that in each renewal a new license can be generated with a new expirationdate.
  6. Refer to LicenseService.cs from the “e-commerce” .aspx.cs file to save the generated license.
  7. Copy the “e-commerce” .aspx.cs file and modify it or renewal licensing. refer to “UpdateLicenseTableOnRenewalOrder” (You need this so that each renewal can generate a new license…) .
  8. Go to your e-commerce website and make sure you set the notification url there to your licenseservice …/”e-commerce” .aspx .
  9. If your e-commerce company does not provide e-mail notification to the end-user, you need to code this yourself after generating the license, you will require an smtp server for this.
  10. Modify the code of your software (that needs licensing) to use the sample code ( Applicensing – see method: “btnSubscriptionLicenses_Click”).

And remember…Whenever you change something in the UI, you need to re-upload the .licproj to the app_data folder of the licenseservice.