Insert #include, Directives fo – Echelon i.LON SmartServer 2.0 User Manual
Page 166

152
Creating FPM Application Licenses
Tips for Securing your Licensing Scheme:
You can implement a number of security measures in your licensing scheme to help protect your FPM
application from unauthorized use or piracy. The examples provided in this section demonstrate some
of these measures, which are designed to force anyone attempting to break the licensing scheme to
disassemble your object code and reverse-engineer the algorithms. To test the strength of your
licensing scheme, you should attempt to break it once you have completed it. This will help you
identify any weaknesses in your licensing scheme.
Note that there are instances in the examples where a number of techniques can be used in
implementing a security measure, but no specific recommendation is made as to which technique is the
best. This is because it is not clear which technique provides the best security. Furthermore, if every
customer follows the same technique, the overall security of the FPM applications being manufactured
is weakened.
Once you enable license validation in your FPM application and build your FPM, it is recommended
that you remove the internal-only symbols from your FPM application. This obscures the location of
the routines and data in your FPM application. The examples in this section assume that you will do
this; therefore, the provided security functions and data are declared as “static”. Note that if you intend
to remove the internal-only symbols, some of the techniques described in this section are optional (e.g.,
translating names via macros); however, it is recommended that you still implement them. This is
because the techniques provide a level of security in the event the removal of the internal-only symbols
is not performed. For instructions on how to remove the internal-only symbols from your FPM
application, see Building the Release Version of a Licensed FPM Application later in this chapter.
Note that no software protection scheme is completely secure. Individuals with the resources to break
your licensing scheme may be able to eventually do so.
Step 1: Inserting Include Directives and Macro Definitions
The first step in enabling license validation in your FPM application is to insert #include directives
for the files that contain the methods to be called by your FPM application. The only file that you
must include is LicenseMgr.h. Optionally, you will need to include LicMgrMd5.c if you are using
the supplied MD5 security algorithm in your FPM license validation routine, and both LicMgrMd5.c
and LicMgrHMacMd5.c (in that order) if you are using the supplied HMAC-MD5 security algorithm.
Note that if you include the LicMgrMd5.c and LicMgrHMacMd5.c files, you must provide new
definitions for the name translation macros defined at the beginning of those files. These macros begin
with “LICMGR_” and by default are defined as “CHANGE_ME!” (an intentionally illegal value).
You can redefine the macros directly in the files, or simply copy the #define statement for each one
and put the new definitions in the source file (.cpp extension) or header file (.h extension) of your
FPM application. The new definitions must be inserted before the included source files.
The LicMgrMd5.c file contains six macros for which you need to supply definitions, and the
LicMgrHMacMd5.c file contains one macro. These macros redefine the names of the actual security
algorithm routines to obscure them from malicious attempts to bypass your licensing. To maximize
the protection provided by this mechanism, the name definitions should look related to your FPM
application, but they should obscure their actual functions.
It is also recommended that you obscure your own symbol names. All the symbols in the provided
examples that use all upper-case are intended to be defined as macros, with the true name being
intentionally misleading.
To insert the #include directives in your FPM application, do the following.
1. Start the i.LON SmartServer 2.0 Programming Tool. To do this, click Start, point to Programs,
point to Echelon i.LON SmartServer 2.0 Programming Tools, and then click i.LON
SmartServer 2.0 Programming Tools. The i.LON SmartServer 2.0 Programming Tool opens.
2. In the C/C++ Projects view, expand the FPM project folder if the header file (.h extension) for
your FPM application is hidden.