Last Modified October 2, 2026
- Home
- Guides
- Must Read Topics
- Location of CDM
The location of the CDM License File is a critical element of your software_DNA implementation
This location must be accesible in Read/Write mode for the User(s) of the application
on the target device. The recommended location of the CDM license file depends on the licensing objective and the OS (Windows, Mac,
Linux, or Android) as described below.
The location of the CDM License file is set with the DNA_SetProperties("CDMPathName",<pathName>) (V6 or later) or
the DNA_SetCDMPathName(<pathName>) API call and must be
the first call made to the DNA Library. If not used, the CDM License file will be located to the default location indicated
below which may not be the recommended location.
NOTE: in the table, "per User" is used for when multiple "Users" are defined on the same computer
| OS |
License Objective |
Recommended CDM <pathName> (must use UTF-8 encoding) |
Default Location |
| Windows |
One License per Computer |
C:\Users\Public\ <app_name> \ <app_name>.CDM
|
the directory of the EXE, typically within the C:\Program Files\ directory |
| One License per User |
<Application.LocalUserAppDataPath> \ <app_name>.CDM |
the directory of the EXE, typically within the C:\Program Files\ directory |
| MAC OSX |
One License per Computer with one User |
/Users/<username>/Library/Application Support/<app_name>/<app_name>.CDM
|
Package Contents -> MacOS |
| One License per User |
/Users/<username>/Library/Application Support/<app_name>/<app_name>.CDM
|
Package Contents -> MacOS |
| One License for many MAC Users |
/Users/<username>/Library/Application Support/<app_name>/<app_name>.CDM
Use a multi-computer or multi-user License and DNA_SetProperties("UserID",NSUserName())
|
Package Contents -> MacOS |
| Linux |
One License per Computer |
/var/tmp/<app_name>/<app_name>.CDM
(See notes below)
|
the directory of the EXE |
| One License per User |
/home/<username>/.config/<app_name>/<app_name>.CDM
|
the directory of the EXE |
| Android |
One License per Device |
getApplicationContext().getFilesDir()+ File.separator + "<app_name>.txt"
(the App-specific secure storage location on Android)
|
(do not use) |
Notes on CDM Location for Windows
One License per Computer, shared by all Users
On Windows, in order to protect the system environment on the
user's computer, some directories are not "Read / Write" for all Users, such as:
C:\Program Files directory
C:\ProramData directory
Our recommended location ensures all Users have the required "Read / Write" permissions.
If the DNA_SetProperties() or DNA_SetCDMPathName() API call is not used,
the CDM file will be written to the folder where the App is stored, or a VirtualStore folder which is likely to create conflicts as multiple CDM files could exist on the computer.
One License per Windows User
Each Windows User on the same computer would need their own License Activation Code.
In addition to our recommended location above, the CDM License file could be stored in the following location:
-
Application.CommonAppDataPath
-> C:\ProgramData\<app_name>\<app_name>\
Environment.SpecialFolder.CommonApplicationData
-> C:\ProgramData
Use only for "One License per User" scenario
Although described as a common directoy for application files, the ProgramData directory only allows read-write access to the creator of a
file in that directory. Other Users only have read access and would not be able to validate the CDM License file.
-
Environment.GetEnvironmentVariable("USERPROFILE") + "\\<app_name>\\<app_name>.CDM"
-> C:\Users\<user>\<app_name>\<app_name>.CDM
Use only for "One License per User" scenario
-
Environment.SpecialFolder.CommonDocuments
-> C:\Users\Public\Documents
Use only for "One License per User" scenario
If Windows Defender Folder Control is enabled on the computer (possible in Enterprise environments),
then this folder will have restricted access permissions for other Users.
Notes on CDM Location for MAC OS
The default location for the CDM License file is in the application Package Contents directory and should not be used
when Code Signing or App SandBox are used.
The CDMPathName should be an absolute path to the target location. Do not use a path with the Tilde such as ~/Library/.... You can use the stringByExpandingTildeInPath function to convert such a path to an absolute path.
One License per Computer with one User
Other locations can be used with the following considerations:
| / Users / <userName> / <app_name> /
<app_name>.CDM |
| / Users / Shared |
- these directories are ONLY Read/Write for the original writer of the files in that directory. All other users will have
Read Only access even when "shared"
- if the CDM License file is created in these directories on Activation of the software, then only this user
would have Read/Write access to the CDM file. Other users would only have Read ONLY access and
software_DNA will not work
- Use these locations if there is assurance of only one user on the MAC computer.
One License for multiple MAC Users (V6.00)
This approach will allow different Users on the same MAC computer to share the same License Code:
- use a Multi-Computer or Multi-User License
- set up the DNA Properties as follows:
DNA_SetProperties("CDMPathName","/Users/"+NSUserName()+"/Library/Application Support/<app_name>/<app_name>.CDM")
DNA_SetProperties("userID",NSUserName())
The NSUserName() function will ensure each CDM License file is unique and specific to the MAC User
The Users sharing the same License may be on different computers.
Other locations that can be used:
| / Users / <userName> / <app_name> /
<app_name>.CDM |
Explanation of CDM Location for Linux
The location of the CDM License will depend on where the Application is installed (root or home directories) as this will determine the
read-write access permissions of where the CDM license file can be stored. The installation script may need to modify access permissions.
For example, if the App is installed in the $Home directory of the User and the default CDM Location is used, then no special permissions
are required and each User would need their own License Activation Code, and
have their own CDM License file.
If the App is installed in the root directory (/usr/lib/...), the CDM License file could be installed in /var/tmp/<app_name>
/<app_name>.CDM. The installation script would need to create the folder and a dummy (empty) CDM file and change the
permissions to read-write for all User(s).
Explanation of CDM Location for Android
The recommend location is the App-specific internal secure storage allocated to your App by the Android OS, which has
the required "Read / Write" access permissions.
The location is determined via Android API calls:
getApplicationContext().getFilesDir() + File.separator + "<app_name>.CDM"
Do not use sub-directories, and use only the CDM file name. For example:
getApplicationContext().getFilesDir() + File.separator + "HelloWorld.CDM"