Creating a security dll file, Building the security dll file – Echelon i.LON SmartServer 2.0 User Manual
Page 163

i.LON SmartServer 2.0 Programming Tools User’s Guide
149
Creating a Security DLL File
The i.LON License Generator requires a security DLL file named LicenseSecurity.dll that implements
a specific security algorithm. The security algorithm enables you to publish unique digital signatures
for your FPM licenses. You can build your own LicenseSecurity.dll file, or you can use the sample
security DLL file provided by Echelon. The following sections describe how to build the security
DLL file and how to use the provided sample security DLL file.
Building the Security DLL File
To build your own security DLL file, you can use the sample license security file provided with the
i.LON SmartServer 2.0 Programming Tools (demo or full version). This C++ source file,
LicenseSecuritySample.cpp, is located in the
LonWorks\iLON\Development\Licensing\iLONLicenseGen folder. It documents the proper interface
to be used to create the security DLL file.
In this sample, the GenerateLicenseKey() routine is called when the Create License button in
the i.LON License Generator is clicked. This routine does the following:
1. Receives the following seven parameters: algorithmIndex, pText, textLen,
pSecretKey
, keyLen, ppLicenseKey, and pLicenseKeyLen.
• algorithmIndex is the value from the Algorithm Index field of the i.LON License
Generator.
• ptext is a pointer to a character array in which the text entered in the Issuing Company
Name, Feature Name, License Type, Lock Type, and Lock ID fields of the i.LON License
Generator is stored.
• textLen is an integer that stores the length of the text referenced by ptext.
• SecretKey is a pointer to a byte array in which the binary value of the text entered in the
Secret Key field of the i.LON License Generator is stored.
• keyLen is an integer that stores the length of the byte array referenced by SecretKey.
• ppLicenseKey is a pointer to a pointer to byte array where the returned license key will be
stored.
• pLicenseKeyLen is a pointer to an integer that will store the length of the returned license
key.
2. Checks the algorithm index passed in from the i.LON License Generator. The algorithm index
determines which security algorithm is run. You can have multiple algorithm indexes to handle
different features or situations. This sample includes one security algorithm that is run when the
algorithm index is 0.
3. Executes the specified security algorithm. This algorithm must use the pText, textLen,
pSecretKey
, and keyLen parameters and generate the license key.
Note: C source files for open source implementations of the MD5 and HMAC-MD5 digest
algorithms are included in the LonWorks\iLON\Development\Licensing folder. You can use
these source files to implement your security algorithm for the security DLL and the FPM. You
can use other available security algorithms such as SHA-1, SHA-256, or DES in your security
DLL and FPM.
Echelon makes no recommendation about the suitability of any of these algorithms. The
algorithms are provided for demonstration purposes only.
If you use the provided source files, you may include them in your security DLL source file using
the #include statement, or you may compile them separately. In either case, you should define