Secure license management for desktop applications with C and Python bindings
Generate, validate, and manage software licenses with expiration control and activation status.
Admin-controlled user system with role-based permissions and secure authentication.
Enterprise-grade security features to protect your licensing system.
Requirements: libcurl, cJSON
# Clone the repository git clone https://github.com/cryptolion/sdk.git cd sdk/c # Build the library make # Install system-wide (optional) sudo make install # Link in your project gcc your_app.c -lcurl -lcjson -lcryptolion -o your_app
Requirements: Python 3.6+, ctypes
# Install via pip pip install cryptolion-sdk # Or from source git clone https://github.com/cryptolion/sdk.git cd sdk/python python setup.py install
Create a new license (Admin only). Returns a dictionary with license details.
from cryptolion import create_license license = create_license("admin", "securepass", 365) print(f"Created license: {license['license_key']}") print(f"Expires at: {license['expires_at']}")
Check license validity. Returns a dictionary with license details.
from cryptolion import check_license license = check_license("LIC-12345-ABCDE") if license['is_active']: print("License is valid!") else: print("License expired or invalid")
Create a new user (Admin only). Returns True on success.
from cryptolion import create_user success = create_user("admin", "securepass", "newuser", "userpass", False) if success: print("User created successfully")
Create a new license (Admin only). Returns a License struct.
// Create a license valid for 1 year License lic = create_license("admin", "securepass", 365, 0); printf("Created license: %s\n", lic.license_key); printf("Expires at: %s\n", lic.expires_at); // Free memory when done free_license(&lic);
Check license validity. Returns a License struct.
License lic = check_license("LIC-12345-ABCDE"); if(lic.is_active) { printf("Valid license until %s\n", lic.expires_at); } else { printf("License is inactive\n"); } free_license(&lic);
Create a new user (Admin only). Returns 1 on success.
int result = create_user("admin", "securepass", "newuser", "userpass", 0); if(result) { printf("User created successfully\n"); } else { printf("User creation failed\n"); }
import ctypes import os import sys # Define the License structure class License(ctypes.Structure): _fields_ = [ ("license_key", ctypes.c_char_p), ("created_at", ctypes.c_char_p), ("expires_at", ctypes.c_char_p), ("is_active", ctypes.c_int) ] # Load the shared library def load_library(): # Platform-specific library loading if sys.platform.startswith('win'): lib_name = "LibLion64.dll" elif sys.platform == 'darwin': lib_name = "LibLion.dylib" else: lib_name = "LibLion.so" try: return ctypes.CDLL(lib_name) except OSError: lib_path = os.path.join(os.path.dirname(__file__), lib_name) return ctypes.CDLL(lib_path) lib = load_library() # Set function prototypes lib.create_license.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_int] lib.create_license.restype = License # Python wrapper for create_license def create_license(username, password, duration_days, user_id=0): lic = lib.create_license( username.encode('utf-8'), password.encode('utf-8'), duration_days, user_id ) result = { 'license_key': lic.license_key.decode() if lic.license_key else None, 'created_at': lic.created_at.decode() if lic.created_at else None, 'expires_at': lic.expires_at.decode() if lic.expires_at else None, 'is_active': bool(lic.is_active) } # Free C memory lib.free_license(ctypes.byref(lic)) return result