Secure license key generation, software activation, and hardware binding.
Project description
๐ Sealium
Secure license key generation, software activation, and hardware binding.
Sealium is a production-oriented licensing toolkit: a FastAPI activation server plus a zero-long-term-key client. Every payload is end-to-end protected by RSA-4096 + AES-256-GCM hybrid encryption. Licenses bind to a machine through a multi-surface hardware fingerprint (SMBIOS firmware table + disk IOCTL + WMI, cross-validated) with weighted similarity matching โ tolerant to minor hardware changes, hard to spoof.
โจ Features
| Feature | Description |
|---|---|
| ๐ Hybrid Encryption | RSA-4096-OAEP key wrapping + AES-256-GCM payload, end-to-end |
| ๐ซ License Keys | Cryptographically secure random keys (128-bit) |
| ๐ป Hardware Binding | Multi-surface fingerprint (SMBIOS + disk IOCTL + WMI cross-validation) with weighted similarity matching โ survives minor hardware swaps, resists spoofing |
| โฐ Expiration Control | Set expiry dates and feature flags per code |
| ๐ก๏ธ Anti-Replay | Timestamp window (authoritative remote clock) + nonce deduplication |
| ๐ Client-Server | Ready-to-use FastAPI backend; client needs only the server's public key |
| ๐ Idempotent | Same machine may reactivate safely |
๐ Documentation
The docs/ directory contains the full, production-grade documentation (in Chinese).
Quick pointers:
- ็ณป็ปๆถๆ โ layered design, module responsibilities, activation data flow
- ๅ ๅฏไธไผ ่พๅ่ฎฎ โ hybrid encryption, binary packet format, anti-replay
- ็กฌไปถ็ปๅฎๅ็ โ fingerprint generation, cross-validation, matching algorithm (1.3.0 redesign)
- ๆๅก็ซฏ้จ็ฝฒๆๅ โ install, keys, code generation, reverse proxy/TLS, multi-worker
- ๅฎขๆท็ซฏ้ๆๆๅ โ embedding activation in your application
- ้ ็ฝฎๅ่ โ TOML schema & environment variable overrides
- ๅฎๅ จๆจกๅ โ threat model, mitigations, known limitations
- ๆ ้ๆๆฅ โ error codes and diagnostics
๐ฆ Installation
pip install sealium
๐ Quick Example
from sealium.client.activator import Activator, ActivationError
# The client only needs the server's PUBLIC key.
activator = Activator(
server_url="https://activation.example.com/v1/activation",
server_public_key_pem=open("data/server_public.pem").read(),
)
try:
response = activator.activate("your-license-key")
if response.result == "success":
print(f"โ
Activated until {response.authorized_until}")
print(f" Features: {response.features}")
else:
print(f"โ {response.error_msg}")
except ActivationError as e:
print(f"โ ๏ธ Activation error: {e}")
๐งฑ Architecture
src/sealium/
โโโ common/ # Shared primitives
โ โโโ crypto.py # RSA-4096 / AES-256-GCM
โ โโโ models.py # ActivationRequest/Response/Code
โ โโโ fingerprint.py # MachineFingerprint + matches() (new in 1.3.0)
โ โโโ machine_code.py # collection โ component fingerprint
โ โโโ hardware/ # native SMBIOS/IOCTL + WMI surfaces (new in 1.3.0)
โ โโโ time_source.py # authoritative timestamp
โโโ client/ # Activator + hybrid-encryption key manager
โโโ server/ # FastAPI app factory, routes, services, database, config
โโโ scripts/ # generate_keys, generate_activation_codes
Key principle: no import side effects. Importing the package performs no I/O, no network calls, no hardware reads. Server resources (private key, DB) are initialized in the FastAPI lifespan and are injectable for testing.
See docs/architecture.md for the full design.
๐ Server in 60 seconds
Zero config โ install and run:
pip install sealium
# 1. Generate the server RSA keypair (keep private key on the server only)
python -m sealium.scripts.generate_keys
# 2. Generate activation codes into the database
python -m sealium.scripts.generate_activation_codes --count 10 --features pro
# 3. Run the activation service (behind a reverse proxy in production)
python -m sealium.server.run
Sensible defaults work out of the box (binds 127.0.0.1:8000, data in ./data/).
Production runs on Linux behind a reverse proxy (nginx, etc.) โ the default loopback
bind is proxy-friendly; set [server] host = "0.0.0.0" only when the proxy runs on another
machine or in a container. To customize, generate a config template and edit:
python -m sealium.server.config_cli init # writes sealium.toml in the current dir
python -m sealium.server.config_cli check # validate
Secrets (e.g. private-key passphrase) come from env vars, never the config file:
SEALIUM_SECURITY__PRIVATE_KEY_PASSPHRASE=.... Distribute data/server_public.pem with
your client. Full guide: docs/server-guide.md.
๐ง Requirements
- Python 3.9+
cryptography,requests,fastapi,uvicorn(wmion Windows only โ needed for client-side hardware collection)
๐งช Testing
pip install -e ".[dev]"
pytest
The test suite runs fully offline: the FastAPI server is driven in-process via
TestClient, the database is a throwaway SQLite file, hardware collection and the
timestamp source are injected โ no live server, network, or real hardware required.
๐ก๏ธ Deployment Hardening
The default and recommended deployment is Linux + a reverse proxy (nginx, etc.). The server is designed to run behind a reverse proxy / firewall, never exposed bare to the public network. (The server only compares fingerprints โ it does not collect hardware โ so it runs fine on Linux; only the client must be on Windows for native collection.)
- Bind address โ defaults to
127.0.0.1(loopback only, safe default). When the reverse proxy runs on the same machine it forwards to loopback directly; when the proxy runs on another machine or in a container, set[server] host = "0.0.0.0"(or an internal IP) insealium.toml/SEALIUM_SERVER__HOST, and keep it behind the proxy. - TLS โ terminate TLS at the reverse proxy (with HSTS) to hide metadata.
- Rate limiting โ enabled by default (
[rate_limit], 60 req / 60 s per IP). - Docs โ
/docs,/redoc,/openapi.jsonare auto-disabled when[server] debug = false. - Config โ
sealium.toml+SEALIUM_*env /.env; private-key passphrase stored asSecretStr(never echoed). Validate withpython -m sealium.server.config_cli check. - Key material โ
data/server_private.pemand the SQLite DB are created with0600permissions (enforced on Linux); the private key can be passphrase-encrypted. On Windows0600does not apply (NTFS ACLs differ) โ since the server deploys on Linux by default this is a non-issue; if you must run the server on Windows, encrypt the private key with a passphrase (see docs/server-guide.md). - Multi-worker โ the in-memory replay guard and rate limiter are per-process; running more than one worker requires a shared store (Redis) for correct replay protection and rate limiting. Single-process (the default) needs no extra setup.
See docs/security.md for the full threat model and hardening checklist.
๐ License
MIT ยฉ 2026 Kevin Orson Hsu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sealium-1.5.0.tar.gz.
File metadata
- Download URL: sealium-1.5.0.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e4670e2491c1f7c53f713b03d7e58749c7a5c9eb4c08c4a2a768fa1db426fca
|
|
| MD5 |
a338832782e8ebabdd78005bb088422e
|
|
| BLAKE2b-256 |
1c56f0c672471a0ba9c06225c26aa18e4c2d60b28476f5224109dca89737ae57
|
File details
Details for the file sealium-1.5.0-py3-none-any.whl.
File metadata
- Download URL: sealium-1.5.0-py3-none-any.whl
- Upload date:
- Size: 68.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73d292bfa76181a4a2fb9d2971bd2921b3e4c43a36f5ea1737e112a532d1c716
|
|
| MD5 |
387f7d9f601c5316ff50d129499b739c
|
|
| BLAKE2b-256 |
59d37055d3f3e198765aa5c71f5ae8733d0d190cebca10455937a26ab3a629d6
|