Getting Started with LIMAN SDK

1. Download the Distribution

Obtain the distribution file specific to your platform from our Downloads page. Available platforms:

OS Platform Format Filename
Windows 32-bit win32x86 Static (.lib) liman_core-x.y.z-win32x86.tar.gz
Windows 64-bit win64x86 Static (.lib) liman_core-x.y.z-win64x86.tar.gz
Linux 64-bit linux64x86 Static (.a) liman_core-x.y.z-linux64x86.tar.gz
macOS 64-bit osx64x86 Static (.a) liman_core-x.y.z-osx64x86.tar.gz

2. Extract and Setup

The following example assumes a 64-bit Linux installation. For other platforms, the steps are identical except for the filename.

Copy the distribution file to your installation directory:

bash
$ cp liman_core-x.y.z-linux64x86.tar.gz /opt

Change to the installation directory and extract:

bash
$ cd /opt
$ tar -xzvf liman_core-x.y.z-linux64x86.tar.gz

Change to the platform library directory:

bash
$ cd liman-x.y.z/lib/linux64x86

3. Generate Your Key Pair

Build the limutil command-line utility to generate a product-license-base. A product-license-base consists of:

Build the utility:

bash
$ make limutil

View available options:

bash
$ limutil --help

Liman Version 1.2.9 (Linux64x86 Release Build)

Usage: limutil [options]

    -H, --host=MASK             Display host id w.r.t specified mask
                                    (MASK & 1)   - mac id
                                    (MASK & 4)   - disk id
                                    (MASK & 2)   - cpu id
                                    (MASK & 8)   - hostname
                                    (MASK & 16)  - user id
    -M, --mac=INDEX             Display the id of the INDEX'th mac adapter
    -u, --user                  Display user id for current user
    -k, --keysize=KEYSIZE       Specify keysize
    -s, --seed=SEED             Specify seed for reproducible keys
    -C, --cpu                   Display cpu id
    -g, --genkey                Generate a random product-id and keypair
    -P, --product=PRODUCT       Designate a product-id for the keypair
    -a, --hashkey=HASHKEY       Hash value of key
    -U, --pubkeyfile=PUBKEYF    Public key file
    -I, --privkeyfile=PRIVKEYF  Private key file
    -S, --sysinfo=SYSINFO       Generate encrypted system info
    -e, --errlist               Error list
    -h, --help                  Usage instructions

Generate a keypair for your product (e.g., TESTAPP):

bash
$ limutil --genkey --keysize=2048 --product=TESTAPP

Product-id is 'TESTAPP'.
Written private key in TESTAPP/TESTAPP_private.key.
Written public key in TESTAPP/TESTAPP_public.key.
Written private key as C/C++ code in TESTAPP/TESTAPP_private_key.c.
Written public key as C/C++ code in TESTAPP/TESTAPP_public_key.c.

Verify the generated files:

bash
$ ls -la ./TESTAPP

-rw-r--r--  1 user users  516 Jul 20 02:02 TESTAPP_private.key
-rw-r--r--  1 user users 3.0K Jul 20 02:02 TESTAPP_private_key.c
-rw-r--r--  1 user users  514 Jul 20 02:02 TESTAPP_public.key
-rw-r--r--  1 user users 2.8K Jul 20 02:02 TESTAPP_public_key.c
Note

Two files have extension .key containing keys in hexadecimal format. The other two contain the same keys embedded in C/C++ functions ready for inclusion in your application.

4. Build the Product-Specific Library

The product-specific LIMAN library requires:

Once you have your LIMAN SDK license, copy it to liman-x.y.z/license directory and build:

bash
$ make library PRODUCT=TESTAPP

This creates the product-specific library libliman.a in lib/<platform>/TESTAPP/ directory.

Important

The libliman.a library is specific to a certain product. Do not use it for multiple products. Use different keypairs for different products or versions.

5. Integrate with Your Application

Include the header and link the library:

c
#include "liman.h"

int main() {
    int err;

    // Create environment with your key size and hash algorithm
    pLIMENV env = lim_create_env(2048, 256, &err);
    if (!env) {
        printf("Failed to create environment: %d\n", err);
        return 1;
    }

    // Load your public key (embedded in libliman.a)
    err = lim_read_public_key(env, "usr_public.key");
    if (err != LIM_OK) {
        printf("Failed to load public key\n");
        return 1;
    }

    // Load and verify a license file
    pLIMLIC lic = lim_create_lic_fromfile(env, "license.key", &err);
    if (!lic) {
        printf("Invalid license: %d\n", err);
        return 1;
    }

    // Check if license is valid
    if (lim_is_verified(lic) && lim_assert_valid(lic) == LIM_OK) {
        printf("License is valid!\n");
        printf("Days to expiry: %d\n", lim_days_to_expiry(lic));
    }

    // Cleanup
    lim_free_lic(&lic);
    lim_free_env(&env);

    return 0;
}

6. Compile and Link

bash
# Linux/macOS
gcc -o myapp myapp.c -I./include -L./lib/linux64x86/TESTAPP -lliman

# Windows (MSVC)
cl myapp.c /I include lib\win64x86\TESTAPP\liman.lib

# Windows (MinGW)
gcc -o myapp.exe myapp.c -I./include -L./lib/mingw64/TESTAPP -lliman

7. Generate Licenses for Customers

Build the license generator:

bash
$ make limgen

Generate a license:

bash
$ limgen --product=TESTAPP --major=1 --minor=0 \
         --serial=123456 --expiry=20261231 \
         --privkeyfile=TESTAPP/TESTAPP_private.key \
         --pubkeyfile=TESTAPP/TESTAPP_public.key

Sample output:

output
License properties and features

License ID........= 59FDE026CD0216EB
Product ID........= TESTAPP
Platform..........= 1
Major Version.....= 1
Minor Version.....= 0
Size..............= 102
Type..............= 113
Number of Users...= 1
Expiration........= 20261231
Serial............= 123456

Generated license is verified!
Done!

Next Steps