KeyNub License Dongle — Perl binding

use KeyNub::LicDongle qw(%STATUS $SCOPE_DEVELOPER);

my $dongle = KeyNub::LicDongle->open;      # first dongle, or ->open($serial)
$dongle->verify_genuine;                   # dies unless genuine
$dongle->session_open;
my $data = $dongle->app_decrypt($blob);    # <- build the licence check on this
$dongle->session_close;
$dongle->close;

Perl 5.20+ and FFI::Platypus, the one dependency:

cpanm FFI::Platypus

It uses the flat API, not the core ABI

Unlike the other scripting bindings, this one calls keynub_licdongle_flat — the same surface COBOL and Fortran use. Perl has no way to describe a C struct layout that computes its own padding, so a core-ABI binding would have to hand-write unpack templates with explicit offsets, and a wrong offset there reads a neighbouring field: a plausible wrong value rather than a crash, and the hardest kind of bug to notice. The flat API has no structs at all, so the problem does not arise.

What that costs: no progress reporting, because the flat API has no callbacks. Records are read in one call.

Set KEYNUB_LICDONGLE_FLAT_LIBRARY to point at a specific library.

Notes

Read ../../docs/integration-security.md before writing the check. exit unless $dongle->is_genuine is one line to delete, and Perl ships as source — obfuscation and pp only raise the effort. What cannot be deleted is data the program needs and only the dongle can decrypt.

Status

Shipping this one is still an open decision. It works and it is tested like everything else, but on an engineering-dongle language list Perl reads as padding to a technical evaluator. It is here because it was cheap once the toolchain was in place; see the binding list.