LIMAN SDK Documentation
Introduction
This section provides an overview of the LIMAN SDK, instructions for getting started, sample applications, and details concerning contact and support information. It introduces two utility applications that illustrate:
- Generation of product-specific LIMAN library
- License generation for a specific product
Directory Structure
After a successful setup, the following directories will be created within the root directory of LIMAN SDK. Assuming liman-x.y.z is the root directory:
lib/<platform>- Core LIMAN library, utility executables and jar files for Java applicationslib/<platform>/<product>- Product-specific LIMAN library embedded with the product's public keyinclude- Header files defining function prototypes for different programming languageslicense- License file (e.g., usr_liman_lic.c) required to use LIMAN SDKapps/<lang>- Project and source files for sample applicationsdoc- Documentation files
You will need to repeat this setup process for each product you want to protect. The libliman.a library is specific to a certain product and should not be used for multiple products. In a hypothetical 3-product business, you will have:
lib
+ linux64
+ FC16ADA16362
+ FC16ADA16362_private.key
+ FC16ADA16362_private_key.c
+ FC16ADA16362_public.key
+ FC16ADA16362_public_key.c
+ libliman.a
+ 2D548F7F540C
+ 2D548F7F540C_private.key
+ 2D548F7F540C_private_key.c
+ 2D548F7F540C_public.key
+ 2D548F7F540C_public_key.c
+ libliman.a
+ 52ADB5129389
+ 52ADB5129389_private.key
+ 52ADB5129389_private_key.c
+ 52ADB5129389_public.key
+ 52ADB5129389_public_key.c
+ libliman.a
Your products should be linked against the associated libliman.a and the license generator limgen should use the private key associated with that product.
License Generation
License generation involves creating an encrypted license key containing the following information:
- Product ID - String (max LIMPAR_MAX_LEN_PRODUCTID chars) that uniquely identifies a product
- Platform - Integer (0-255) specifying target platform
- Major Version - Integer (0-255)
- Minor Version - Integer (0-255)
- Size - Integer specifying license size (for capability tiers)
- Type - Integer constant specifying license type (educational, trial, commercial)
- Seats - Integer specifying concurrent users allowed
- Expiry Date - Date in YYYYMMDD format (optional)
- Serial Number - String (max LIMPAR_MAX_LEN_SERIAL chars, optional)
- UUID - Unique identifier string (optional)
- Host ID - Host machine identifier for node-locked licenses (optional)
- Features - 4-byte array for feature bitmasks (optional)
Data Types
LIMAN SDK has two data types that must be initialized before any license operation:
pLIMENV- LIMAN SDK environment object, created withlim_create_env()pLIMLIC- License object, created with:lim_create_lic()lim_create_lic_fromfile()lim_create_lic_fromkey()
License Creation Steps
- Create environment instance:
lim_create_env() - Read the private key:
lim_read_private_key() - Create empty license:
lim_create_lic() - Call
lim_load_lic()with license parameters - Export license:
lim_write_lickey() - Cleanup:
lim_free_lic()andlim_free_env() - Send the license key to your customer
limgen Command Line Tool
Build the license generator with make limgen. Available options:
$ limgen --help
Liman Version: 1.2.9 (Linux64x86 Release Build)
Usage: limgen [options]
-A, --platform=PLATFORM_ID Platform identifier (0..255)
-P, --product=PRODUCT_CODE Product code (12 chars max)
-M, --major=MAJOR Major version (0..255)
-J, --minor=MINOR Minor version (0..255)
-S, --size=SIZE_ID License size identifier (0..255)
-t, --type=TYPE_ID License type identifier (0..255)
-o, --seats=NSEATS Number of seats/users allowed
-e, --expiry=YYYYMMDD Expiry date
-r, --serial=SERIAL Serial code (24 chars max)
-H, --hostid=HOSTID Target machine hostid
-u, --userid=USERID Customer userid
-i, --uuid=UUID Unique identifier (32 chars max)
-f, --features=FEATURES Feature bitmask (comma delimited)
-I, --privkeyfile=PRIVKEYF Private key file
-U, --pubkeyfile=PUBKEYF Public key file
-k, --keysize=KEYSIZE Key size in bits
-Z, --hashsize=HASHSIZE Hash size in bits
-s, --seed=SEED Random seed
-m, --hostmask=HOSTMASK Host identifier mask (1,2,4,8,16)
-L, --licinfo Display license information
-g, --genkey Generate keypair
-D, --genuuid Generate UUID
-h, --help Show help
Examples
# Generate license with features and expiry
$ limgen --product=PRODUCT1 --major=2 --minor=1 --serial=123456 \
--expiry=20260401 --features=37,3,3,5
# Generate license with custom keypair
$ limgen --platform=8 --product=PRODUCT1 --major=2 --minor=1 \
--serial=123456 \
--privkeyfile=/path/to/priv/key \
--pubkeyfile=/path/to/pub/key
Using Bitmasks for Optional Features
Your application may have different features that need to be licensed separately. LIMAN SDK allows up to 32 optional features using a 4-byte array. Each byte is an 8-bit bitmask (0-255).
Example: Sorting Algorithms
Suppose your application offers 8 sorting techniques:
7 6 5 4 3 2 1 0
_______ _______ _______ _______ _______ _______ _______ _______
| | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | |
| | | | | | | +---> Quick Sort
| | | | | | +-----------> Merge Sort
| | | | | +-------------------> Heap Sort
| | | | +---------------------------> Insertion Sort
| | | +-----------------------------------> Intro Sort
| | +-------------------------------------------> Block Sort
| +---------------------------------------------------> Shell Sort
+-----------------------------------------------------------> Bubble Sort
For a license with Quick Sort, Heap Sort, and Block Sort enabled:
binary: 00100101 = 2^0 + 2^2 + 2^5 = 1 + 4 + 32 = 37
Feature Constants
#define LIMOPT_FEATURE_0 1 // 2^0, bit 0 #define LIMOPT_FEATURE_1 2 // 2^1, bit 1 #define LIMOPT_FEATURE_2 4 // 2^2, bit 2 #define LIMOPT_FEATURE_3 8 // 2^3, bit 3 #define LIMOPT_FEATURE_4 16 // 2^4, bit 4 #define LIMOPT_FEATURE_5 32 // 2^5, bit 5 #define LIMOPT_FEATURE_6 64 // 2^6, bit 6 #define LIMOPT_FEATURE_7 128 // 2^7, bit 7
Setting Features
void set_features(char feature[4]) {
feature[0] = 0;
feature[0] |= LIMOPT_FEATURE_0; // Quick Sort
feature[0] |= LIMOPT_FEATURE_2; // Heap Sort
feature[0] |= LIMOPT_FEATURE_5; // Block Sort
feature[1] = 0;
feature[2] = 0;
feature[3] = 0;
}
Checking Features
if (lim_has_feature(pLic, 0, LIMOPT_FEATURE_0)) {
printf("Quick Sort is available\n");
}
if (lim_has_feature(pLic, 0, LIMOPT_FEATURE_2)) {
printf("Heap Sort is available\n");
}
if (lim_has_feature(pLic, 0, LIMOPT_FEATURE_5)) {
printf("Block Sort is available\n");
}
License Key Format
License keys are encrypted strings containing all license properties. Creation requires your private key (keep secret); validation uses the public key embedded in libliman.a.
#----- BEGIN LICENSE KEY (Id:0F1BBCE44015) ----- UjP8kPXFXl82y97eTAgCbOMLTyDOK9o8p9USut/zkanO+Mhs10E3dMT5ceqpDefr I5NDb/1bGkaTI/Nue6u6LGZ4azJEOcjT1b1tqVSAU60vgSeyUTEJUj2ujDjxofGl 2ybdpdbkdUsyb6jEFpn2t+zEOwNolmeEXnq1yZHkTW+ta8hymvnv31B3z21rmuu5 QQKAhGkTTdEpXga0bMYR55oNmTwx83KufRHFGbSLd+kSBAiqIuiTpzcQe0fT+2wM 5C20vpWyKeW0k9wknY+r1fw7lD/oQCB7Rv9g+DHYqKmT+1e4GpGxuRMgJf125gCc kfZ0rja6blhocnM+3GYrzg== #----- END LICENSE KEY -----
Contact and Support
For sales inquiries and licensing: info@baroks.com
For technical support: info@baroks.com
Error Codes
The following error codes are defined in include/liman.h:
| Constant | Description |
|---|---|
| LIM_OK | No error, operation successful |
| LIMERR_MEMORY | Error in allocating memory |
| LIMERR_FILE_NOT_FOUND | Specified file was not found |
| LIMERR_INVALID_NULL | Specified reference is invalid or null |
| LIMERR_INVALID_LICENSE | Specified license is invalid |
| LIMERR_ENVAR_NOT_FOUND | Environment variable not found |
| LIMERR_LICENSE_EXPIRED | License has expired |
| LIMERR_LICENSE_NOT_LOADED | License is not loaded |
| LIMERR_INVALID_DOMAIN | Domain parameters are invalid |
| LIMERR_INVALID_PRODUCT_CODE | Product code invalid for license |
| LIMERR_INVALID_USER | Current user invalid for license |
| LIMERR_INVALID_PRODUCT_VERSION | Product version invalid for license |
| LIMERR_INVALID_PLATFORM | Platform code invalid for license |
| LIMERR_INVALID_ENVAR | Environment variable is invalid |
| LIMERR_INVALID_ENV | Environment is invalid |
| LIMERR_INVALID_INPUT | Input is invalid |
| LIMERR_UNABLE_TO_OPEN_FILE | Failed to open file |
| LIMERR_INVALID_LICENSE_FILE_NAME | License filename is invalid |
| LIMERR_OPERATION_FAILED | Internal operation failed |
| LIMERR_PRIVKEY_FILE_NOT_FOUND | Private key not found |
| LIMERR_PUBKEY_FILE_NOT_FOUND | Public key not found |
| LIMERR_NOT_SUPPORTED | Feature not supported |
| LIMERR_INVALID_KEYLEN | Key length is invalid |
| LIMERR_NOT_AVAILABLE | Information not available |
| LIMERR_INVALID_KEY | Key is invalid |
| LIMERR_SHORT_KEY | Key is too short |
| LIMERR_BAD_ERRORCODE | Error code is invalid |
| LIMERR_INTERNAL | Internal error - contact vendor |
| LIMERR_ENV_NOT_READY | Environment not ready |
| LIMERR_ALREADY_LOADED | Object already loaded |
| LIMERR_SYSTEM | Platform-specific system error |
| LIMERR_CLOCK_SETBACK | Clock setback detected |
| LIMERR_INVALID_HOST | Host invalid or hardware changed |
| LIMERR_KEYS_NOT_LOADED | Keys not loaded |
| LIMERR_PRIVKEY_FILE_EXISTS | Private key file already exists |
| LIMERR_PUBKEY_FILE_EXISTS | Public key file already exists |
| LIMERR_KEYSIZE_MISMATCH_ENV | Key size doesn't match environment |
| LIMERR_RANGE_TYPE_CODE | Type code out of range |
| LIMERR_RANGE_PRODUCT_CODE | Product code out of range |
| LIMERR_RANGE_MAJOR_VERSION | Major version out of range |
| LIMERR_RANGE_MINOR_VERSION | Minor version out of range |
| LIMERR_RANGE_SIZE_CODE | Size code out of range |
| LIMERR_RANGE_PLATFORM_CODE | Platform code out of range |