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.2.2.tar.gz (33.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.2.2-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sealium-1.2.2.tar.gz
  • Upload date:
  • Size: 33.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.2.2.tar.gz
Algorithm Hash digest
SHA256 6d4f81a34fe87a9753b55636f33bff77f7d84f19418c21c610303dd08ba720f4
MD5 463c1a1431b7be654413698ba2ae7643
BLAKE2b-256 85af9e9b92c07dce3da35bd49722bacb567cc0b559559116184bbd6daedfeca2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sealium-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 42.3 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c8a65b3f566abb0832b40973c381f318113f11cbd2d4291044aac1374069a64
MD5 98702f011c3b392800adaf5a26e3af34
BLAKE2b-256 8c355a22b27df1aecd3411d6d8586a10bb33b9da7a03b988e9a7308c800553b9

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