Skip to main content

Secure license key generation, software activation, and hardware binding.

Project description

Sealium Logo

PyPI License Python


๐Ÿ”’ 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:


๐Ÿ“ฆ 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 0.0.0.0:8000, data in ./data/). 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 (wmi on 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" in sealium.toml (or SEALIUM_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.json are auto-disabled when [server] debug = false.
  • Config โ€” sealium.toml + SEALIUM_* env / .env; private-key passphrase stored as SecretStr (never echoed). Validate with python -m sealium.server.config_cli check.
  • Key material โ€” data/server_private.pem and the SQLite DB are created with 0600 permissions; 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sealium-1.4.2.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sealium-1.4.2-py3-none-any.whl (63.9 kB view details)

Uploaded Python 3

File details

Details for the file sealium-1.4.2.tar.gz.

File metadata

  • Download URL: sealium-1.4.2.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sealium-1.4.2.tar.gz
Algorithm Hash digest
SHA256 7a073446be2ff1cd506fd054a94057e160cc29ab329d0fc489c74896e9340451
MD5 735adcacbb34cd9c19e4917c59d13703
BLAKE2b-256 a638d8a51717daf9ca0d0602b0d49de362bb7acfc5be7f6a79afbe45896a7e7e

See more details on using hashes here.

File details

Details for the file sealium-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: sealium-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 63.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sealium-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a647409669fefb3d7b13df7cd9c4a48f974ffd32b333bf6fda212cabfcf244de
MD5 523d64f2dad4d1c0412fd4adc85dfd4b
BLAKE2b-256 2093bc2f4bbd18a2b18835547af0faa427c32248583d6845933eb4c22f89357a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page