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
pip install sealium
# 1. (optional) Configure: copy the template and edit (zero-config works too)
cp sealium.toml.example sealium.toml
# 2. Generate the server RSA keypair (keep private key on the server only)
python -m sealium.scripts.generate_keys
# 3. Generate activation codes into the database
python -m sealium.scripts.generate_activation_codes --count 10 --features pro
# 4. Run the activation service (behind a reverse proxy in production)
python -m sealium.server.run
Configuration is driven by sealium.toml (structured, commentable) + SEALIUM_* env vars /
.env (secrets & overrides). Validate with python -m sealium.server.config_cli check.
Distribute data/server_public.pem with your client. Full guide: docs/server-guide.md.
๐ง Requirements
- Python 3.13+
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
Sealium is designed to run behind a reverse proxy / firewall, not exposed bare to the public network:
- Bind address โ defaults to
0.0.0.0; restrict via[server] host = "127.0.0.1"insealium.toml(orSEALIUM_SERVER__HOST) when running co-located with 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; the private key can be passphrase-encrypted. - Multi-worker caveat โ the in-memory replay guard and rate limiter are per-process; for cross-worker consistency, inject a shared store (Redis).
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.4.0.tar.gz.
File metadata
- Download URL: sealium-1.4.0.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee2b250c1b3e3b138c1d3b5fb2bad7f60487ac117db480251e4818349c27d781
|
|
| MD5 |
b49e49249f1f37342e269d791099f495
|
|
| BLAKE2b-256 |
a1d3c30cca8c5c9359a6a49808b9fb673d9df41cf234216dee8b9cf80818f7aa
|
File details
Details for the file sealium-1.4.0-py3-none-any.whl.
File metadata
- Download URL: sealium-1.4.0-py3-none-any.whl
- Upload date:
- Size: 62.3 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 |
41e4562316d13aa6fc4956a0963d3f401a78114f901d46c45f904edc3c172abc
|
|
| MD5 |
2a81bea164c6e5c23bf1ff3bf647957c
|
|
| BLAKE2b-256 |
e3c0713ea39d6e8bd376dd936cfac242e70e824334531e10c944a656949fee5d
|