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.3.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.3-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sealium-1.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 8ef4ae8af51de6f4565fdd0b9e8f5c91b4817dcacb66e45152d5634450df7ce0
MD5 3c57df8f7b9b90255f083139260a6a1e
BLAKE2b-256 bc834380bbce59f0944ddbf62a2e4f1ae8379b5e4be41cab118df00d64e4ecc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sealium-1.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc8091f28bf4886a39d2dface1fbdb312850c7312cc799eb3c9670fd2bf0880f
MD5 e4972fc1cd014c0132ada06e5293c7e8
BLAKE2b-256 df6e3cccc407ad7950656e4518cd364246cb0e93ab207f62c3f9cb1121ce061c

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