beautypg.com

Step 4: writing the license validation algorithm, Verifying the lock id, Write the license validation algorithm to – Echelon i.LON SmartServer 2.0 User Manual

Page 170

background image

156

Creating FPM Application Licenses

Step 4: Writing the License Validation Algorithm

You need to write a license validation algorithm that (1) verifies that the Lock ID (MACID, LUID, or
other user-defined lock type) specified in the FPM license matches the one on the customer’s
SmartServer, and (2) verifies that the license key in the FPM license file is valid.

To do this, your license validation algorithm must call the method in the i.LON License Manager that
finds and parses an FPM license and performs a Node Lock Check. Your license validation algorithm
then must evaluate whether the SmartServer passed the Node Lock Check. If the SmartServer passed
the Node Lock Check, your method needs to calculate a license key and check whether the license key
stored in the FPM license file matches the calculated license key. Your method must calculate a
license key by calling the exact same security algorithm used in the License Generator security DLL
and providing it the license data returned by the i.LON License Manager and the secret key defined for
your FPM. The secret key for your FPM is stored in the variables that you declared in step 2.

You probably will only want to run the full license validation process once, so before proceeding you
should check a flag (e.g., FPM_CHECKED), and you should set the flag somewhere in your license
validation algorithm to indicate that the license has been checked.

Your license validation algorithm must declare local variables for the data to be passed to and returned
by the license manager and by the security algorithm. Your license validation algorithm must specify
the CompanyName and FeatureName properties defined in your FPM license file, and it must specify
the file path of your FPM license file.

Verifying the Lock ID

To write your license validation algorithm so that it verifies the Lock ID of a SmartServer, you do the
following:

1. Check to see if you have already run the license check. For example:


if (!FPM_CHECKED)
{

2. Set a flag to indicate that your license validation algorithm has been called. This code does not

need to be at the beginning. For example:

FPM_CHECKED

= TRUE;

3. Declare the local variables for the data to be passed to and returned by the license manager and by

the security algorithm. For example:

//data passed to and returned by license manager
LicMgrTaskCallBlock taskCallBlock;
LicMgrLicenseId licenseId;
LicMgrLicenseData *pLic;

//data passed to and returned by security algorithm
unsigned char secretKey[MD5_DIGEST_LEN];
unsigned char digest[MD5_DIGEST_LEN];

4. Enable the License Manager on the SmartServer to check for a valid FPM license. To do this, you

store the CompanyName and FeatureName properties defined in your FPM license file in the
CompanyName

and FeatureName fields of the LicMgrLicenseId object. For example:

licenseId.szCompanyName = "Your Company Name";
licenseId.szFeatureName = "Your Feature Name";

Using the HVAC Controller FPM for example, the Company Name property would be “Our
Corporation”, and the Feature Name would be “FPM HVAC Controller”. See Creating a License