Skip to content

Software License Dongle for Fortran

Fortran binds through ISO_C_BINDING, which is standard Fortran 2003 and needs nothing vendor-specific: the same module works with gfortran, Intel and NAG.

use keynub_licdongle
integer(c_int32_t) :: handle, status
logical :: genuine

handle = keynub_open()                        ! > 0, or a negative status
if (handle < 0) error stop 'no KeyNub dongle attached'

status = keynub_verify_genuine(handle, genuine)
status = licdf_session_open(handle)
status = licdf_session_close(handle)
status = licdf_close(handle)Code language: Fortran (fortran)

Why Fortran Codes Are Worth Protecting

A Fortran solver is often the most valuable software an engineering company owns, and the least replaceable: decades of validation, published results depending on it, and physical correctness nobody wants to re-derive. It is also frequently licensed per seat or per cluster to organisations large enough that an honest licence count matters commercially.

The pattern that fits best here is the one Fortran already suggests: encrypt the material property tables, empirical coefficients or validated constants your solver reads at start-up. Those are the part a competitor cannot regenerate, they are already data rather than code, and without the dongle the solver has no physics to solve.

One Module, and What to Link

The binding is a single Fortran 2003 module built on iso_c_binding, plus helpers for the two things that are awkward from Fortran: NUL-terminated strings and caller-allocated output buffers. There is no build system of its own – you compile the module alongside your program and link one library.

That library is self-contained: the core, Mbed TLS and hidapi are compiled into it, so there is nothing else for a customer to install and no shared-library version to negotiate. Which matters for the codes Fortran still ships commercially – aerospace and structural analysis, CFD, computational physics, reservoir and process simulation – where the build environment is often frozen on purpose.

Shipping the Native Library with a Fortran Application

The binding is one module, keynub_licdongle.f90, written against Fortran 2003 iso_c_binding over the SDK’s flat API. Compile it with your program and link the flat library: gfortran myprogram.f90 keynub_licdongle.o -L<natives/<platform>> -lkeynub_licdongle_flat; Intel Fortran and other F2003 compilers take the same module.

At run time the shared library must be findable as usual: PATH on Windows, an rpath or LD_LIBRARY_PATH on Linux. On Linux, install the udev rule from NATIVES.md once, so that ordinary users may open the device.

Questions Fortran Developers Ask

Which Fortran Compilers Does the Binding Support?

Any compiler with Fortran 2003 iso_c_binding: gfortran, Intel Fortran (ifx and ifort) and others. The module has no compiler-specific extensions.

Can a Fortran Solver Be Protected with a Hardware Dongle?

Yes, and solvers are the easy case: material models, correlations, turbulence constants and reference results are data the program cannot invent. Ship them encrypted with the dongle and decrypt them at start; without a dongle the solver has no coefficients.

Does a Fortran 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 Fortran 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.

Does It Run on ARM: Windows on ARM, Apple Silicon, aarch64 Linux?

Yes. The SDK ships native libraries for Windows x64, x86 and ARM64, Linux x86_64 and aarch64, and universal macOS binaries for Intel and Apple silicon.

Can a License Written from Fortran 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: fortran/verify_and_read. Binding source: bindings/fortran. 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