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.
using Pkg; Pkg.add("KeyNubLicenseDongle")Code language: Julia (julia)
Reading a License
using KeyNubLicenseDongle
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 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.
Shipping the Native Library with a Julia Application
The KeyNubLicenseDongle package in the General registry brings the native library with it as a Pkg artifact holding the SDK release, from which it picks the library for the running platform; Pkg.add is the whole installation. In a clone of the SDK it uses the checkout’s natives/ instead, and KEYNUB_LICDONGLE_LIBRARY names a specific library.
A PackageCompiler app or system image includes the artifact like any other, so the deployed program needs nothing added. On Linux, install the udev rule from NATIVES.md once, so that ordinary users may open the device.
Questions Julia Developers Ask
Which Julia Versions Does the Binding Support?
Julia 1.10 and later, on Windows, Linux and macOS, with ccall and no packages beyond the standard library.
Can a Julia Application Compiled with PackageCompiler Be Protected with a Dongle?
Yes. The compiled app carries the package and its artifact; gate on data the computation needs, decrypted through the dongle at start, rather than on a flag.
Does a Julia Application Need Administrator Rights to Talk to the Dongle?
No, and no driver either: the dongle is a USB HID device that the operating systems handle with their built-in class drivers. On Linux, install the shipped udev rule once so that ordinary users may open it; without the rule the SDK reports access denied and names the cause in its error detail.
Does a Julia License Check Need an Internet Connection?
No. Verification is a local exchange between your program and the dongle over USB: the SDK checks the dongle’s certificate chain to KeyNub’s root and runs a live challenge-response. There is no activation server and no account, so the check works on air-gapped machines.
Does It Run on ARM: Windows on ARM, Apple Silicon, aarch64 Linux?
Yes. The SDK ships native libraries for Windows x64, x86 and ARM64, Linux x86_64 and aarch64, and universal macOS binaries for Intel and Apple silicon.
Can a License Written from Julia Be Read by a Program in Another Language?
Yes. Every binding drives the same core library and the same dongle, and records and sealed data are language-neutral bytes. Your issuing tool can be written in one language and your product in another.
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 libraries are in the repository’s natives/ folder, one per platform.
All supported languages · All industries · Buy a KeyNub · Ask us something