Skip to content

Software License Dongle for Delphi

Delphi applications are disproportionately likely to be exactly the kind of software worth protecting: long-lived engineering, measurement, medical and industrial tools, often with a decade or more of accumulated domain knowledge inside them.

They are also disproportionately likely to be stuck on a dongle whose vendor has moved on, discontinued the part, or dropped support for the parallel or USB-A device the software was built around. KeyNub binds through a plain Pascal unit over the same stable C ABI every other language uses, so migrating is a matter of swapping the calls, not restructuring the application.

Using it

Add LicDongle.pas to your project and deploy the shared library alongside your executable.

uses LicDongle;

var
  Ctx: TLicdCtx;
  Dev: TLicdDevice;
  Genuine: TLicdGenuineResult;
begin
  if licd_init(Ctx) <> LICD_OK then Halt(1);
  try
    if licd_open(Ctx, nil, Dev) <> LICD_OK then Exit;   // first dongle found
    try
      if licd_verify_genuine(Dev, Genuine) <> LICD_OK then Exit;
      if licd_session_open(Dev) = LICD_OK then
      begin
        // records and app-crypto go through Dev while the session is open
        licd_session_close(Dev);
      end;
    finally
      licd_close(Dev);
    end;
  finally
    licd_free(Ctx);
  end;
end;Code language: Delphi (delphi)

Bitness

Deploy the shared library matching your build target — a 32-bit Delphi application needs the 32-bit library, and both are supplied. Unlike the VB6 route, there is no calling-convention trap here: Delphi declares cdecl correctly, which is what the C ABI uses.

Do not gate on a boolean

// Weak: one patched conditional jump.
if Genuine.genuine <> 0 then EnableFeature;

// Strong: data the program cannot compute for itself.
if licd_app_decrypt(Dev, @Blob[0], Length(Blob), OutBuf, OutLen) = LICD_OK then
  LoadCoefficients(OutBuf, OutLen);Code language: Delphi (delphi)

Native code is harder to patch than a .NET assembly, but not hard enough to rely on. Put the dongle on the critical path and the question stops being how well your check is hidden.

Code

Runnable sample: delphi/VerifyAndRead.dpr. Binding source: bindings/delphi. Lazarus package: keynub_licdongle.lpk. 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