The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

KeyNub License Dongle — R package

library(KeyNubLicDongle)

ctx <- licd_context()
dongle <- licd_open(ctx)                     # first dongle, or licd_open(ctx, serial)
licd_verify_genuine(dongle)                  # signals an error unless genuine
data <- licd_with_session(dongle,
  licd_app_decrypt(dongle, sealed))          # <- build the licence check on this
licd_close(dongle)
licd_close(ctx)

No packages. The R code reaches the SDK’s C library through a small C layer that R compiles when the package is installed, so nothing sits in the path of the check that a customer could substitute.

R is the closest neighbour to the MATLAB and Julia bindings, and sells to the same kind of buyer. If you sell an R package, the thing worth protecting is usually not the code but the data: fitted parameters, a validated correlation set, a proprietary model’s coefficients. That is what licd_app_encrypt()/licd_app_decrypt() is for.

Setup

install.packages("KeyNubLicDongle")

CRAN ships the package compiled for Windows and macOS; on Linux, R compiles the C layer with the system compiler, as for any source package. Straight from the repository instead:

install.packages("remotes")
remotes::install_github("AB-KeyNub/KeyNub-SDK", subdir = "bindings/r")

The package loads the native library at run time and does not carry it. Take keynub_licdongle for your platform from the SDK’s natives folder and either put it where the operating system finds libraries (PATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH) or name it before the first call:

licd_library("/opt/keynub/libkeynub_licdongle.so")

KEYNUB_LICDONGLE_LIBRARY in the environment does the same. In a clone of the repository the package finds natives/<platform>/ on its own, from the working directory upwards, so the samples run with nothing set. A process loads the library once; licd_library() tells which. On Linux, install the udev rule described in NATIVES.md so the dongle is accessible without root.

Notes

Read docs/integration-security.md before writing the check. if (!licd_is_genuine(dongle)) stop() is one line to delete, and R ships as source. What cannot be deleted is data the program needs and only the dongle can decrypt.

Tests

tests/stub.R runs without a dongle: it compiles a stand-in for the C ABI from tests/licd_stub.c with R’s own toolchain (R CMD SHLIB) and exercises every call against it, which is what R CMD check runs.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.