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.


✨ Features

Feature Description
🔐 Hybrid Encryption RSA-4096-OAEP key wrapping + AES-256-GCM payload
🎫 License Keys Cryptographically secure random keys (128-bit)
💻 Hardware Binding Bind licenses to specific machines (SHA-256 fingerprint)
Expiration Control Set expiry dates and feature flags
🛡️ Anti-Replay Timestamp window + nonce deduplication
🌐 Client-Server Ready-to-use FastAPI backend
🔁 Idempotent Same machine may reactivate safely

📦 Installation

pip install sealium

🚀 Quick Example

from sealium.client.activator import Activator

# Client only needs the server's PUBLIC key.
activator = Activator(
    server_url="http://localhost:8000/v1/activation",
    server_public_key_pem=open("data/server_public.pem").read(),
)

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}")

🧱 Architecture

src/sealium/
├── common/        # Shared primitives (crypto, models, machine_code, time_source)
├── client/        # Activator + hybrid-encryption key manager
├── server/        # FastAPI app factory, routes, services, database, config
│   ├── routes/    # Thin HTTP layer
│   ├── services/  # activation_service, replay_guard (pure, injectable)
│   └── ...
└── 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 src/docs/mechanism.md for the full protocol specification.


🔧 Requirements

  • Python 3.13+
  • cryptography, requests, fastapi, uvicorn (wmi on Windows only)

🧪 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, and the timestamp source is injected — no live server or network 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 — the app-layer hybrid encryption protects every payload end-to-end, but you should still 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); tune via RATE_LIMIT_MAX_REQUESTS / RATE_LIMIT_WINDOW_SECONDS. In multi-worker deployments the limiter is per-process — inject a shared backend for global limits.
  • Docs/docs, /redoc, /openapi.json are auto-disabled when DEBUG=false.
  • Key materialdata/server_private.pem and the SQLite DB are created with 0600 permissions; never commit them (already gitignored).
  • Multi-worker caveat — the in-memory replay guard and rate limiter are per-process; for cross-worker consistency, inject a shared store (Redis).

📄 License

MIT © 2026 Kevin Orson Hsu


Built with ❤️ for Python developers

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.0.tar.gz (44.8 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.0-py3-none-any.whl (56.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sealium-1.3.0.tar.gz
  • Upload date:
  • Size: 44.8 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.0.tar.gz
Algorithm Hash digest
SHA256 1f59cdb6a5d2fd42a21ed5ed3dc3869cbc6e929a6eaa36702433d177a8bb0df1
MD5 be2b1a135682cd56127cdab525935c15
BLAKE2b-256 c3cf8e95ce1932073c35cc4560f885dddc7cb580c0da4f875f1aa612178a15c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sealium-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 56.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fd1edb0fc84dc12385b26451bea4205ac4866f6010b9c3091047daabf64cbbb
MD5 b993d4592828bc30adfdaf2c17a3a8ab
BLAKE2b-256 d0761a821219ed91919f803c5885b319c55209ff06abbb16f15c1ed9b36f02d6

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