The Wolfram Language reaches the dongle through ForeignFunctionLoad, part of the language since version 13.1, and loads the native library at run time — so the paclet is pure Wolfram Language with no LibraryLink shim to compile, the same in Mathematica, the Wolfram Engine and wolframscript. 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.
PacletDirectoryLoad["<clone of the SDK repository>/bindings/wolfram/KeyNubLicDongle"]
Needs["KeyNub`KeyNubLicDongle`"]Code language: Mathematica (mathematica)
Reading a license
Needs["KeyNub`KeyNubLicDongle`"]
h = LicDongleOpen[]; (* first dongle, or LicDongleOpen[serial] *)
LicDongleVerifyGenuine[h]; (* a Failure unless genuine *)
LicDongleSessionOpen[h];
license = LicDongleReadRecord[h, "license"];
LicDongleSessionClose[h];
LicDongleClose[h];Code language: Mathematica (mathematica)
What you are actually protecting
The Wolfram Language is the closest neighbour to MATLAB, Julia and R on this list — the same engineering and scientific buyers, often the same organisation. And as with those three, if you sell a Wolfram package the valuable part is usually not the code. It is the fitted model, the calibrated parameters, the validated coefficients: the part that took years of data to build 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. *)
If[!LicDongleGenuineQ[h], Abort[]];
(* Strong -- the parameters only exist with the dongle present. *)
parameters = BinaryDeserialize[LicDongleAppDecrypt[h, sealedBlobShippedWithYourPackage]];Code language: Mathematica (mathematica)
Failures are Failure objects carrying "Status", "Operation" and "Detail", so FailureQ gates and the status branches; LicDongleGenuineQ fails closed. The paclet calls the SDK’s flat companion API, the one designed for foreign function interfaces: integer handles and buffers, no hand-written structure layouts.
Shipping the native library with a Wolfram Language application
The KeyNub/KeyNubLicDongle paclet calls the SDK’s flat API through ForeignFunctionLoad, so there is no LibraryLink shim to compile. It finds natives/<platform>/ in an SDK clone on its own; elsewhere, name the flat library with LicDongleLibraryPath before the first call, or set KEYNUB_LICDONGLE_FLAT_LIBRARY.
A notebook, a standalone application built with the Wolfram Engine, or a package distributed to colleagues takes the same paclet. The prebuilt libraries for every platform are in the SDK repository’s natives/<platform>/ folder, with a SHA-256 manifest: Windows x64, x86 and ARM64, Linux x86_64 and aarch64, and universal macOS binaries for Intel and Apple silicon. On Linux, install the udev rule from NATIVES.md once, so that ordinary users may open the device.
Questions Wolfram Language developers ask
Which Wolfram Language versions does the paclet support?
Wolfram Language 13.1 and later, which introduced ForeignFunctionLoad, in Mathematica, Wolfram Desktop and the Wolfram Engine on Windows, Linux and macOS.
Can a Mathematica package be protected with a hardware dongle?
Yes. A package’s value is usually in its data and its parameters; ship those sealed with the dongle and decrypt them when the package loads, rather than testing a flag.
Does a Wolfram Language 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 Wolfram Language 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.
Who can read the license records on a dongle?
Anyone holding the dongle: a program opens a session and reads records, and can decrypt data sealed for that dongle. Writing records, erasing them and incrementing counters need your write key. What the dongle guarantees is that none of it is available without the dongle present.
Can a license written from Wolfram Language 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: wolfram/verify_and_read.wls. Binding source: bindings/wolfram. 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