Categories: Licensing

JSON Web Tokens: Compact Software Licenses for Small Devices and Offline Applications

Not every token represents a consumable unit or a time-limited usage allowance. JSON Web Tokens (JWTs) take a different approach. Originally JWTs were used to transport rights and identities in a compact format. Today, they are also used to encode entitlements and license information in use cases for tiny devices. CodeMeter enables centralized management of these tokens and supports generating them both online and offline. This allows software vendors to manage licensing for devices that cannot run CodeMeter Runtime.

A Token with a Different Purpose

In software licensing, the term token is used for different concepts. With Consumable Units, it represents a unit that is consumed; with a Shared License Pool, it represents reusable license capacity; and with Rate Limits, it represents a usage allowance tied to a specific time period.

A JSON Web Token, by contrast, is not a business model in its own right, but a technical format for transferring information and entitlements between systems. A JWT can, for example, specify which software features are enabled, which user or device an entitlement applies to, and when it expires.

A digital signature makes it possible to verify the authenticity and integrity of this information without contacting a central license server every time it is used. This makes JWTs particularly useful for applications with limited resources, mobile devices, and scenarios where a continuous network connection cannot be guaranteed.

The Structure of a JSON Web Token

A signed JWT typically consists of three components: a header, a payload, and a signature.

The header contains information about the token format and the signing algorithm used. This tells the validating application how to verify the signature.

The payload carries the actual information. This can include details about the licensee, permitted software features, administrative privileges, or the license validity period.

For example, the payload can specify that a particular user may use the software and access selected features. It can also define whether that user may create, modify, or delete other users.

The signature protects the integrity of the token. It enables the application to verify whether the token was issued by a trusted party and whether its contents have been modified since it was issued.

In most use cases, the information in a JWT is not encrypted. Confidential data should therefore not be stored in the payload without protection. For licensing, the signature is the key element: It allows entitlements to be verified locally without requiring the issuing system to remain continuously accessible.

Binding Licenses to Users and Devices

Licenses often need to be restricted to specific devices or users. As such, a JWT can contain information that allows it to be bound to a particular identity or hardware.

For user-bound licenses, an email address or another unique user identifier can, for example, be stored in the token. The application then checks whether the identity of the signed-in user matches the identity specified in the token.

Device-bound licenses can use hardware attributes. Examples include MAC addresses, hard drive serial numbers, or cryptographic identities provided by a Trusted Platform Module (TPM).

Licensing for Very Small Devices

One important use case for JWTs is licensing devices that cannot run the full CodeMeter Runtime.

Examples include very small embedded systems, microcontrollers, and other devices with limited resources. They may lack sufficient memory, processing power, or a suitable operating system to support a full licensing environment.

Even so, these devices often need to support different features that can be activated based on the license purchased. A compact, signed license file is well suited to this purpose. The device only needs to be able to evaluate the relevant license information and verify the cryptographic signature. A full CodeMeter Runtime is not required on the target device.

CodeMeter can handle license creation and management. While the device itself only needs a correspondingly lightweight license validation implementation.

The format used does not have to be JWT. Proprietary formats and other standardized formats can follow the same principle: protected license information, a defined device binding, and a verifiable digital signature.

Temporary Offline Entitlements

Another use case involves applications that normally operate online but also need to function temporarily without a network connection.

Consider a predictive maintenance application originally developed as a browser-based cloud service. The same functionality is later made available through a mobile app on smartphones or tablets. During use, the device may temporarily lose its Internet connection. The user still needs to be able to continue working for a limited period. A JWT with a limited validity period is ideal here.

While connected to the central system, the application receives a signed token containing the required entitlements. This token can be bound to the user’s identity and remain valid for a defined period, such as five minutes, ten minutes, or one hour.

If the device subsequently loses its Internet connection, the application can continue to validate the locally stored token and provide the permitted features. Once the token expires, a new entitlement must be obtained. This allows offline access to be limited precisely without having to move all license management to the mobile device.

Centralized Management with CodeMeter License Central

Even if the target application does not use CodeMeter Runtime, CodeMeter License Central can serve as the central license management platform. The Custom Licensing Adapter is available for this purpose. This add-on enables the generation of license formats that are not based directly on conventional CodeMeter license containers.

Software vendors can continue to use existing proprietary license formats while consolidating their licensing processes in CodeMeter License Central. This approach is particularly useful for older devices whose licensing mechanisms cannot readily be changed.

The same principle can be applied to JSON Web Tokens. The software vendor defines its products and license options in CodeMeter License Central. During activation, the Custom Licensing Adapter generates a JWT instead of a conventional CodeMeter license.

The license information from CodeMeter License Central is mapped to the fields in the token. Product Codes, expiration dates, and enabled features, for example, can be transferred directly to the corresponding JWT fields.

Alternatively, multiple license options can be mapped to compact bit fields or other application-specific data structures. This mapping is defined to the appropriate license format in question.

CodeMeter License Central thus remains the central source of license information, while the target devices continue to use a format tailored to their requirements.

Generating Signed Licenses Offline

Licensing becomes particularly challenging when both the target device and the entire production process must operate without an Internet connection. One example is the manufacture of small precision motors. Each motor receives an individual, cryptographically protected license during production.

The production environment is completely isolated from the Internet. Neither inbound nor outbound connections are permitted. Online activation through a central license server is therefore not an option.

CodeMeter supports an alternative approach for these scenarios: The entitlement to generate new licenses is provided in a local CodeMeter license container. The example described uses a CmDongle. From a technical perspective, a similar concept can also be implemented with a CmActLicense.

The license container holds the required cryptographic keys, along with information specifying which licenses may be generated and how many may be issued. This makes it possible to generate licenses entirely offline.

Unit Counter Limits the Number of Licenses

A Unit Counter prevents a local production facility from generating an unlimited number of licenses. The software vendor uses it to specify how many signed license tokens the production environment may issue. One example is an allowance of 1,000 units. The production facility receives a license container authorizing it to generate a maximum of 1,000 licenses. The counter is decremented accordingly for each license issued.

This allows the vendor to control the permitted production quantity even when the facility has no connection to a central license server. In addition, a template in the license container can define which basic license information and features may be included in the generated tokens.

The production software is therefore not free to issue arbitrary entitlements. It can only generate licenses within the specified limits. This combines the flexibility of local license generation with control over permitted license contents and quantities.

Protecting Private Keys in the License Container

Creating digitally signed tokens requires a private cryptographic key. This key requires particularly strong protection. If it falls into the wrong hands, it could be used to generate additional tokens whose signatures the target devices would recognize as valid.

CodeMeter therefore provides a way to store key material securely inside a license container. The Universal Data (UvD) license option is generally used for this purpose. Among other things, it supports key material for RSA and elliptic curve cryptography.

The private keys are stored so that they cannot be read out at runtime. Instead, the production application can have CodeMeter perform the designated cryptographic operations. This means the production software can have a token signed without gaining access to the private key itself. Combined with Unit Counter, this makes it possible to limit the number of permitted signing operations or licenses issued.

The target devices then need only the corresponding public key to verify the signature of their license. License generation and verification are thus separated. The private key remains in the protected production environment, while verification can take place on the individual device.

The Key Advantage: CodeMeter without CodeMeter Runtime

An application does not need to use CodeMeter Runtime to benefit from the CodeMeter licensing infrastructure. With JSON Web Tokens and comparable signed license formats, software vendors can centralize their license management in CodeMeter License Central while supporting very small devices and mobile applications that operate offline.

Protected keys and Unit Counter also make it possible to generate individual licenses in completely isolated production environments. CodeMeter thus combines centralized control over license rights with the freedom to use the appropriate license format on each target device.

 

KEYnote 52 - Edition Fall/Winter 2026

To top