We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

dvandal
Posts: 4
Joined: Tue Dec 02, 2014 8:47 pm

Issue with Trial (Licensing)

Hi,

We implemented Licensing -> Trial & Registration on our installer with a remote licensing server (PHP script).
We also added the DLL code in VB .NET application.
When trial period is expired it request to Register or Buy license.

All is fine ... licensing popup show as needed, remote licensing server receive the request and send proper response to installer.

The issue is here:
Once we enter the activation code (validated from remote server), it accept the value and close registration window, but nothing is saved in system registry and this means that registration window is shown everytimes we start our application (which is can't be used without being registered first).

It seem that something is wrong with Runtime Key Location since the activation code is not saved in Windows registry. The values for Runtime Key Location are:
- Location: Per Machine
- Key: Software\[|Manufacturer]\[|ProductName]
- Name: RegistrationKey

Help is needed :) Thanks!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with Trial (Licensing)

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

This may happen if your application doesn't have permissions to write under the "RegistrationKey" registry key. Can you please start your application elevated (e.g. using the "Run as administrator" context menu option) and see if the behavior still persists?

Also, as another option you can use the Advanced Installer ("Licensing" page -> "Registration" tab -> "Generate Registration Keys" hyperlink) to generate the license using the the same license element values as your PHP License Server and, then compare the content of the license generated within AI with the content of the license generated by your PHP License Server and make sure they are identically.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dvandal
Posts: 4
Joined: Tue Dec 02, 2014 8:47 pm

Re: Issue with Trial (Licensing)

Thanks,

The value generated from license server (PHP script) is not identical to value generated using "Generate Registration Keys".

Here is the part that has an issue, what I don't understand is that we do exactly the same actions than in your sample PHP script.

Code: Select all

// Set signature data and convert to UTF-16LE
$sign_infos = "COMP_ID={$computerID}ID={$activationCode}";
$sign_data  = iconv('UTF-8//IGNORE', 'UTF-16LE', $sign_infos);

// Generate SSL signature
$pkeyid = openssl_pkey_get_private(file_get_contents("./winapp.pem"), "XXXX");
if (empty($pkeyid) ) {
    header("HTTP/1.0 520 Keys generator setup failed.", true, 520); die("Keys generator setup failed.");
}

if (!openssl_sign($sign_data, $signature, $pkeyid, OPENSSL_ALGO_SHA1)) {
    header("HTTP/1.0 521 Failed to generate license.", true, 521); die("Failed to generate license.");
}
openssl_free_key($pkeyid);
If I force the $signature variable with same value that you generate in "Generate Registration Keys" then it works.

Code: Select all

$signature = 'ayrihr2wEcjzraLCAJgVRxfPfCbTMZNRfdh33+l2vk/sPRX0x1KEr7zkvGXL08P1';
Any idea of what is wrong in PHP script ?

Thanks!
Daniel.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with Trial (Licensing)

Hello,

I'm not sure what is wrong with the above part of your script. At a first glance it seems correctly. The only difference that I observed is that you are using the "iconv" function instead of the "mb_convert_encoding" function used in our example, but they should produce the same results. However, maybe you can give a try by using the "mb_convert_encoding" function in your script too and see if this helped.

Also, can you please make sure that your PHP script use the correct private key to generate the license signature? You can proceed like this:
1. open the .aip (project file) in Advanced Installer and go to "Licensing" page -> "Registration" tab
2. use the [Actions] -> "Expor PEM..." option to export the private key used by your licensing library
3. please make sure your PHP script uses the above exported file to access the private key
4. test again the scenario

and see if this helped? Maybe your PHP script uses a private key exported within another project or within a different trial configuration of your product.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dvandal
Posts: 4
Joined: Tue Dec 02, 2014 8:47 pm

Re: Issue with Trial (Licensing)

Hi,

I switched to "mb_convert_encoding" instead of "iconv" ... this doesn't work, same issue.
I also exported PEM file and used it in PHP script... this doesn't work, same issue.

Something is wrong when generating signature data, I just don't see what it is.
The only difference is that when signature is generated from PHP script there is some strange characters and using "Generate Keys" it is a nice alphanumeric string.

PHP generated = ?Q�qH�_-��{�φT<�`z٩%��xG{���8h�@,e
Advanced Installer generated = ayrihr2wEcjzraLCAJgVRxfPfCbTMZNRfdh33+l2vk/sPRX0x1KEr7zkvGXL08P1
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with Trial (Licensing)

Hello,

At a first glance it seems there is an encoding issue of the signature element generated by your script. Can you also try to debug your script and make sure your "sign_data" variable is encoded using "UTF-16LE"?

It would be very useful if you could isolate the behavior in a sample script code and send it us so we can test and investigate on our side.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dvandal
Posts: 4
Joined: Tue Dec 02, 2014 8:47 pm

Re: Issue with Trial (Licensing)

Thanks for your help, this was an human error. The base64_encode() was missing on the returned SIGN= value.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Issue with Trial (Licensing)

You're always welcome.

I'm glad you got everything rolling.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”