← ENGINEERING BLOG · COMMERCIAL LICENSING · 7 MIN READ · NOVEMBER 26, 2026

Python Hardware Lock & Offline Expiry: Zero License Servers Required.

Every developer selling an on-premises FastAPI service, quantitative trading tool, or desktop Python application hits the same commercial problem: if you hand a client a standalone binary, what stops them from copying it onto twenty unpaid machines or continuing to run it long after their 14-day proof-of-concept expires?

1. Why Python-Level if datetime.now() > EXPIRY Checks Fail

Checking a license JSON or JWT inside regular Python code is trivial to bypass: an attacker unpacks the archive,NOPs or edits the single POP_JUMP_IF_FALSE opcode (or monkey-patches datetime.datetime / time.time via sitecustomize.py), and runs your application forever. Worse, calling an online license API breaks inside air-gapped hospital, bank, and factory networks.

2. Cryptographic Key Separation: The Binary Never Holds Its Own Key

With pykevlar build --outer, your function vaults and C runtime are encrypted under a project master key that is never stored inside the compiled binary. Instead, each customer receives a 198-byte ChaCha20-Poly1305 authenticated pyarmor.rkey envelope:

# Step 1 — Build your universal protected binary once (1.08s):
pip install pykevlar
pykevlar build app_server.py --protect core --enable-bcc --anti-llm --outer --project-key .prod.key -F -O dist

# Step 2 — Customer runs hdinfo on their target Linux or macOS machine:
./dist/app_server --hdinfo
# -> Device Token: spa-dev-a7256ca34bcac081

# Step 3 — Mint their 198-byte hardware-locked, 365-day license in 6.2ms (zero rebuild!):
pykevlar key --project-key .prod.key -O licenses/acme \
    -b spa-dev-a7256ca34bcac081 \
    -e +365d \
    --period 30m \
    --bind-data '{"customer":"Acme Corp","max_workers":16}'

3. How Native C Hardware & Clock-Rollback Verification Works

Bypass Attempt Naive Python License Check PyKevlar Native C --outer Envelope
Copy binary to a 2nd server Runs unless online webhook blocks Fails decryption — host hardware digest is mixed into the AEAD key derivation
Edit expiry timestamp in .rkey Editable if unsigned Poly1305 MAC authentication error — aborts in C before CPython executes user code
Patch license check in Python 1-byte bytecode patch Mathematically impossible — bytecode stays ChaCha20-encrypted without a valid .rkey
Leave process running past expiry Checked only at startup Blocked via --period 30m — C vectorcall trampoline re-verifies lease every 30 minutes

4. Reading Tamper-Proof Entitlements Inside Your App

Because the --bind-data payload is authenticated inside the same Poly1305 tag that unwraps the bytecode decryption key, your application can read tenant seat limits, feature tiers, and customer names offline with cryptographic assurance—see our Customer Hardware Licensing recipes and PyArmor migration guide.

Mint per-customer hardware-locked Python licenses in 6 milliseconds
Compile once with --outer, then issue unlimited offline pyarmor.rkey files per client with PyKevlar Pro ($39/yr).
Start with Pro — $39/yr →
MORE FROM PYKEVLAR ENGINEERING
Shipping Commercial Django & FastAPI On-Premises Without Leaking Source Code Read → PyKevlar vs. PyArmor vs. Nuitka: Production Benchmarks on 802 Python Modules Read → How Autonomous LLM Agents (GhidraMCP, REA & PyLingual) Decompile Python—and How to Stop Them Read →