Skip to content

Software License Dongle for Python

The Python binding is pure ctypes over the core library, so there is no compiler involved at install time and no wheel to build per interpreter version.

PyPI version badge

pip install keynub-licdongleCode language: Bash (bash)

Reading a license

import keynub_licdongle as kn

with kn.LicenseDongleContext() as ctx:
    with ctx.open() as dongle:               # first dongle found
        dongle.verify_genuine()              # raises unless genuine

        with dongle.open_session() as session:
            license = session.read_record("license")Code language: Python (python)

Python needs this more than most languages

Python ships as source, or as a bundle a determined person can unpack. PyInstaller, Nuitka and cx_Freeze raise the effort a little, but .pyc files decompile well and a licence check written as an if is a one-line patch. This is not a reason to avoid Python; it is a reason to put the dongle somewhere that patching cannot reach:

# Weak -- delete one line and it is gone.
if is_licensed:
    enable_feature()

# Strong -- the model, table or key only decrypts with the dongle present.
weights = session.app_decrypt(encrypted_blob_shipped_with_your_installer)Code language: Python (python)

For scientific and engineering software this is usually easy, because there is almost always a calibration table, a coefficient set, a trained model or a protocol key that the program cannot invent for itself.

Code

Runnable sample: python/verify_and_read.py. Binding source: bindings/python. Both are Apache-2.0, in the public SDK repository; the prebuilt native libraries are in the repository’s natives/ folder, one per platform.

All supported languages · All industries · Buy a KeyNub · Ask us something