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.13+
  • 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.1.tar.gz (52.2 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.1-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sealium-1.4.1.tar.gz
  • Upload date:
  • Size: 52.2 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.1.tar.gz
Algorithm Hash digest
SHA256 4508bd0ff73bc3b15a71d6ec1e8e4cfa0bdb3cf18ed62268ee091ff5e89dadca
MD5 d777781bd33acf621d35f866c0ab897f
BLAKE2b-256 0ec7493f054a7938bb07b7b528cfc8ab80beff629121435259cef4bb025423ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sealium-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 63.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e14f8e963dde35b8b5f39d6dc40f5c1fbf0581967d0c29b444bbcbdf0703ec8
MD5 412f07866c4d075b1e83bd84545de461
BLAKE2b-256 015f127a6599a49f1cc07117f831f98acc3fb4b6ccbcbe2683776793ed4fb08d

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