Local License File
After license activation the SDK creates an encrypted file that contains license information. This article provides information about the local license file and data location.
See also: Security and Cryptographic Providers for more information about license encryption and Custom License Storage for information about alternative ways to save license.
- Initialized LicenseManager (or LicenseHandler) with your configuration using the appropriate settings.
- Created a LicenseID using either LicenseID::fromKey or LicenseID::fromUser function, depending on the activation method you prefer.
- Implemented basic license management, including license activations, deactivations, and both online and local license checks.
The location of the license file depends on the operating system in use.
On Windows, the default SDK data location is: {SystemDrive}:/Users/{UserName}/AppData/Local/LicenseSpring/{ProductCode}
On Linux, the default SDK data location is: HOME/.LicenseSpring/LicenseSpring/{ProductCode}
On macOS, the default SDK data location is: ~/Library/Application Support/LicenseSpring/{ProductCode}
To get the location and name of local license file use the following method:
To change the location of local license file, use:
You can also delete all files created by SDK using the clearLocalStorage method:
If preferred, it is also possible to adjust the location of the local license file before the creation of the LicenseManager object in the C++ SDK. This is possible by constructing the ExtendedOptions object with the license file path as the lone parameter:
Alternatively, it is possible to set the license file path after the ExtendedOptions using the the setLicenseFilePath() method as follows:
In case the license file gets corrupted during encryption or writing, local license data could be lost. To prevent this, you can check if the local license file is corrupted either on every license file write through a flag in ExtendedOptions, or whenever you want.
Note: This introduces a runtime overhead due to decrypting an encrypted string.
Changing the data location allows to implement different scenarios, making the license file acessible by certain users and applications.
The default data location makes the license available for the current user only. To make it available for all users of the device, set a path that all users can acess, e.g.:
When you have multiple apps that use LicenseSpring, you can provide a single license for all products. If the user activates a license for one product, the other apps could access the license without license reactivation. To achieve this, make the data location path not product-dependent:
Note: Currently license files created by different SDKs are not compatible. Make sure to store the license files created by different SDKs separately.
LocalLicenseException will be thrown if the SDK attempts to read a license file created by another SDK. It also occurs when the local license file is damaged or cannot be loaded or saved.