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

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

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 HOST=127.0.0.1 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_ENABLED, 60 req / 60 s per IP).
  • Docs โ€” /docs, /redoc, /openapi.json are auto-disabled when DEBUG=false.
  • 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.3.1.tar.gz (46.5 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.3.1-py3-none-any.whl (57.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sealium-1.3.1.tar.gz
Algorithm Hash digest
SHA256 aa8bbb2a1b430283cee06276b75f491155ceeb8f56695315e5f11c3561885446
MD5 b9c20a64a84e4664889d6b6b6b6ba59e
BLAKE2b-256 678f30feeddd1eab5d1cc9c3fe3561c28fab616c028450f07eed9737b500803f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sealium-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 57.7 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e391f749e51581fc5d7be7da0c48871ef6dac705bf65361c7a7685c2566209a6
MD5 9c3f884f0103484a63f15f8c2171d89d
BLAKE2b-256 a4d5dd36b797b7b99f3432a6d0ec5a9bbf3b24ebc7db147039f4ffbff39c6e82

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