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

GPLv3 © Sealium Contributors


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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sealium-1.2.0.tar.gz
  • Upload date:
  • Size: 45.7 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.0.tar.gz
Algorithm Hash digest
SHA256 468da1038b4357020d54412d884347cdb6cef68edc87ecc57e7c31afecd8b240
MD5 25f549d993f1362e9f402989096abaed
BLAKE2b-256 2416a24b5f71ec3e74219337d4c354ec4246b1477c458146f80de21dfe040807

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sealium-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d316e3fd94fc5da01124cfca8181b8d3a88be79b11051cea26682ef3aada804
MD5 a0c221cb1226ada64f2fcbf0b13e721f
BLAKE2b-256 bfe0975abd8d3bbcf5fdca15b4e86fd47cc22c21ec8eebe374bf364c18ba32cc

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