![]() |
LicenseKey
|
License key interface. More...
Go to the source code of this file.
Functions | |
int | licensekey_verify (const char *app_name, int app_id, int major_version, int minor_version) |
Perform a license key check. More... | |
int | licensekey_verify_ex (const char *app_name, int app_id, int major_version, int minor_version, const char *licensekey_path) |
Perform a license key check for ACAP3 applications. More... | |
char * | licensekey_get_exp_date (const char *app_name, const char *licensekey_path) |
Return the expiration date of the license. More... | |
char * | licensekey_get_state_string (const int state_code) |
Return an explicatory message of a license key state for ACAP3 applications. More... | |
License key interface.
The license key interface checks that an application has a valid license key installed. To receive a license key the user enters the application's license code and the device's serial number on the Axis web service page called Embedded Applications.
The license key is created by Axis in XML-format with a description of the application and a signature that is verified by the License key library using a public RSA-key that resides in the device.
This library is partitioned into a static and a dynamic part. The static part performs checks to make sure that the dynamic part is not circumvented by malicious users. Both parts of the library must be linked to for the check to work. When linking the application, provide the following option to the compiler:
The -Wl
option tells the compiler to forward the following comma-separated options to the linker.
This is an example of the code to verify the license key.
Hackers who are trying to circumvent the copy protection schemes commonly use debuggers. A common tool for Linux is the ptrace(2) system call. When used for debugging it is first called from within an application and then the target application is excuted using one of the exec() calls. To make the application more secure call ptrace from within the application. If the application is being debugged using ptrace, the call will fail, since it has already been called once from within.
int licensekey_verify | ( | const char * | app_name, |
int | app_id, | ||
int | major_version, | ||
int | minor_version | ||
) |
Perform a license key check.
app_name | The name of the application. Must match APPNAME in package.conf. |
app_id | The application id of the application, assigned by Axis. Must match APPID in package.conf. |
major_version | The major version of the application. Must match APPMAJORVERSION in package.conf. |
minor_version | The minor version of the application. Must match APPMINORVERSION in package.conf. |
int licensekey_verify_ex | ( | const char * | app_name, |
int | app_id, | ||
int | major_version, | ||
int | minor_version, | ||
const char * | licensekey_path | ||
) |
Perform a license key check for ACAP3 applications.
app_name | The name of the application. Must match APPNAME in package.conf. |
app_id | The application id of the application, assigned by Axis. Must match APPID in package.conf. |
major_version | The major version of the application. Must match APPMAJORVERSION in package.conf. |
minor_version | The minor version of the application. Must match APPMINORVERSION in package.conf. |
licensekey_path | Optional license key path meant to be used mainly for acap3 but is also available for acap2. Defaults to the acap2 license key folder. |
char* licensekey_get_exp_date | ( | const char * | app_name, |
const char * | licensekey_path | ||
) |
Return the expiration date of the license.
app_name | The name of the application. Must match APPNAME in package.conf. |
licensekey_path | Optional license key path meant to be used mainly for acap3 but is also available for acap2. Defaults to the acap2 license key folder. |
char* licensekey_get_state_string | ( | const int | state_code | ) |
Return an explicatory message of a license key state for ACAP3 applications.
state_code | Integer with license key state. |