The Advanced Licensing Support can be easily integrated with your license server. The following explanations apply to the sample code linked at the end of this article.
Set the Licensing Library to use an Activation Server
Into the Advanced Installer Licensing Registration Tab you should perform the following actions:
- Enter the http or https URL address to your license server into the “Server Url” field.
- Select the “User specific customized license” format and select the license elements that your server will support.
- Export the Public - Private key pair used to generate licenses using the “Export PEM” action. You must take safety measures to protect and encode this key based on your server needs before you upload it.
Changes to the License elements must be reflected in server side changes because the server is responsible for generating values for those elements.
When the end-user will attempt to register your application, the licensing library will submit an HTTP request to the server with the following POST keys/values:
- ID - the license ID that the end-user entered into the registration form.
- COMP_ID - the registration computer ID (if supported) used to generate licenses that are invalid on other computers that the one used for registration.
- TrialName - the licensing library name that may be used by the server if it needs to distinquish between applications.
The registration server must respond with the licensing elements (ID, Computer ID, Maintainance Plan, Expiration Date ....) as well as their digital signature.
Step 1 - Find the license with the specified ID in your database.
The provided license ID must be searched into the database to get its details like: Maintainance Plan, Expiration Date, No of previous activations, previous Computer IDs or any other element you want to use to allow/deny registrations.
Step 2 - Decide if the license request is legit.
If based on your database entries the server decides that the license request should be denied then it should respond with an HTTP response code larger than 500 and an error message.
Step 3 - Computing the license digital signature.
The Signature element of the license is the Base64 encoded RSA signature of the other license elements (hashed using SHA1 function).
All the other license elemens and their values should be merged in alphabetical order into a UTF-16LE encoded string like:
The license element name and its value should be separated by =.
Step 4 - Respond with the license elements.
Once the server computed the signature element (SIGN) it's ready to respond with a message composed from the license elemens names and their values. An element name must be separated by its value using =. Element-value pairs must be separated using ;.
Computer ID element may be omitted from this response.
Sample server response message:
- Sample PHP code that responds to a license request
This code will generate licenses from your licensing server
- Sample ASP.NET code written in C# that responds to a license
This ASP.NET code written in C# can generate licenses from your licensing server