Skip to content

Software License Dongle for Julia

Julia binds through ccall, which is part of the language — so the binding has no dependencies outside Base. For a licensing component that is the right shape: nothing sits in the path of the check that a customer could substitute for something more agreeable.

Reading a license

using KeyNubLicDongle

ctx = Context()
try
    dongle = open_dongle(ctx)          # first dongle, or open_dongle(ctx, serial)
    verify_genuine(dongle)             # throws unless genuine

    session(dongle) do s               # closed on every exit path
        license = read_record(s, "license")
    end
finally
    close(ctx)
endCode language: Julia (julia)

What you are actually protecting

Julia is the closest commercial neighbour to MATLAB — often the same engineering and scientific buyers, sometimes the same organisation. And as with MATLAB, if you sell a Julia package the valuable part is usually not the code. It is the correlation set, the fitted parameters, the validated coefficients, a proprietary model’s constants: the part that took years of measurement and that a competitor cannot regenerate from your documentation.

That makes the strong pattern easy here, because the thing worth protecting is already data rather than logic:

# Weak -- one deleted line.
is_genuine(dongle) || error("unlicensed")

# Strong -- the parameters only exist with the dongle present.
coefficients = app_decrypt(s, encrypted_blob_shipped_with_your_package)Code language: Julia (julia)

The do-block form of session closes the session even when an exception unwinds through it, so there is no cleanup path to forget.

Code

Runnable sample: julia/verify_and_read.jl. Binding source: bindings/julia. Both are Apache-2.0, in the public SDK repository; the prebuilt native library is attached to each release.

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

KeyNub

A project of AB-Tools GmbH.
Address: Marsstraße 78 · 80335 Munich · Germany
Phone: +49 89 38898588 · Fax: +49 89 38898589
E-mail: info@keynub.com

Managing Director: Andreas Breitschopp
Commercial register HRB 202859 · Amtsgericht München (Munich local court)
VAT ID DE268720895 · Munich tax office for corporations
Grenke Bank AG · IBAN: DE49201304000060270139 · BIC: GREBDEH1XXX

Developers · Payment Methods · Shipping · Terms & Conditions · Right of Withdrawal · Privacy Policy · Legal Notice