Where should I store the license file and alias files?
Global Licenses or User-Specific Licenses
When using Protection PLUS 5 SDK, one of the factors when deciding where to store the license and alias files is to determine who will need to have access to the license. Do you want to share the license with all the user's on the system, or does each user on the system need their own license?
Global alias and license file locations are locations which are shared by all users on a system. The advantage to using global locations is that the application only needs to be activated once on a given system. However, the drawback to this is that you typically need to consider setting permissions on these locations when deploying your application. Some examples on how you can configure some global alias locations is provided in the code below.
User-specific alias and license file locations are convenient because they can help you to avoid problems that need to be addressed when users with limited access to a system try to use your software. More specifically, if your application were to use user-specific locations exclusively, the primary benefit would be that users would never need elevated access to run and activate your application. However, the significant drawback is that because the locations used are unique to each user which signs-on to a system, each user will have his or her own license file and aliases, meaning each user will need to activate to be able to use the application. Some example code is provided below to show how you can configure some user-specific alias locations.
If you are using a read-only license and require a global license, having the license file in the application folder is satisfactory. Tampering with a read-only license is extremely difficult as the client does not have all the necessary encryption key. More information on Read-Only licenses can be found in the License Files topic of the Protection PLUS 5 manual.
When storing license data, you will need to be mindful of the platform's data storage guidelines. When using writable license files, you may need to store the licenses in a location where they will be retained even when the application is uninstalled.
- For Windows Desktops/Servers, if you are using writable licenses then the registry is a good location. Be mindful of the permissions of the license file locations.
- Universal Windows Platform applications could use the ApplicationData class. For example: ApplicationData.Current.LocalFolder.Path.
- iOS developers should be familiar with Apple's File System Basics.
- Android developers should be familiar with saving files on device storage. If you are targeting Android 11 or newer, be aware of the Scoped Storage limitations.
- Linux, macOS, and Windows Desktop developers can refer to the Global Locations and User-Specific Locations section above for information on license storage.
This blog contains information on common Windows folder locations although it does not include Windows 10.