Skip to content

Software License Dongle for C#, VB.NET and .NET

The .NET binding is a single NuGet package that carries the native library for you, so there is no “copy this DLL next to your executable” step and no architecture guessing.

dotnet add package KeyNub.LicenseDongleCode language: Bash (bash)

Reading a license

using KeyNub.LicenseDongle;

using var dongle = Dongle.Open();          // first dongle found
if (!dongle.IsGenuine)
    return LicenseResult.NotGenuine;

dongle.SessionOpen();
byte[] license = dongle.RecordRead("license");Code language: C# (cs)

Dongle is IDisposable, so a using declaration closes the device on every exit path, including exceptions. That matters more than it sounds: the driver keeps a small fixed table of open handles, and a leaked one is a support call three weeks later.

C#, VB.NET and F# share one assembly

There is no separate VB binding. KeyNub.LicenseDongle is a .NET assembly, so Visual Basic and F# consume exactly the same API. We ship a VB.NET sample anyway, because the call style differs enough to be worth showing — Using blocks, no var, and Option Strict On, which is what you want for interop.

Do not gate on a boolean

An if (licensed) is one IL instruction away from if (true), and .NET assemblies are especially easy to inspect and rewrite — a decompiler will hand someone a readable copy of your check. Obfuscation slows that down; it does not stop it. Make the program need something the dongle produces instead:

// Weak: a branch a patcher removes.
if (dongle.IsGenuine) EnableFeature();

// Strong: the values only exist when the dongle does.
byte[] coefficients = dongle.AppDecrypt(EncryptedBlobFromInstaller);Code language: C# (cs)

Because the decrypted data is an input rather than a permission, removing the check does not unlock the feature — it removes the feature’s data.

All supported languages · 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