Since the Name in a version 5 UUID is based on a hardware ID, it’s a good idea to have a fallback system in case the device’s hardware changes. End users will often update parts of their PC’s and this can cause your app to no longer work on that device when it still should.
One way to do this is to save the UUID along with multiple hardware ID’s (disk ID, processor ID, MAC address, etc) in a local file (you should hide and/or encrypt this file) and then compare these saved values to the current values. You will be able to detect partial changes and make some assumptions about the device.
This lets you be reasonably sure the end user is only installing your app on the number of devices you want, but still gives them the freedom to upgrade their hardware or uninstall and reinstall your app without issue.
Checking Hardware Info #
Create a function in your app to check the device’s current information against the saved file. Your app will need elevated administrative privileges.
First, gather the users current hardware info:
import subprocess
import uuid
import re
def get_processor_id():
# Execute the Windows command to get the processor ID
result = subprocess.check_output(['wmic', 'cpu', 'get', 'ProcessorId'], shell=True)
# Decode the result and split by newline to get the actual ID
processor_id = result.decode().split('\n')[1].strip()
return processor_id
def get_device_id():
# Execute the Windows command to get the device ID
result = subprocess.check_output(['wmic', 'csproduct', 'get', 'UUID'], shell=True)
# Decode the result and split by newline to get the actual ID
device_id = result.decode().split('\n')[1].strip()
return device_id
def get_mac_address():
# Get the MAC address using uuid.getnode() and format it
mac = ':'.join(re.findall('..', '%012x' % uuid.getnode()))
return mac
# Gather current hardware data
current_processor_id = get_processor_id()
current_device_id = get_device_id()
current_mac_address = get_mac_address()
# Print current hardware data (for testing)
print("Current Processor ID:", current_processor_id)
print("Current Device ID:", current_device_id)
print("Current MAC Address:", current_mac_address)
And then compare that info to the saved data…
# Path to the file containing the saved hardware data
saved_data_file_path = "path/to/your/saved_hardware_data.txt"
# Read the saved hardware data from the file
with open(saved_data_file_path, 'r') as file:
saved_device_id = file.readline().strip()
saved_processor_id = file.readline().strip()
saved_mac_address = file.readline().strip()
# Compare the current hardware data with the saved data
if (current_device_id == saved_device_id and
current_processor_id == saved_processor_id and
current_mac_address == saved_mac_address):
print("Success! The current device matches the saved hardware data.")
else:
print("Warning! The current device does not match the saved hardware data.")
Partial Matches #
If the UUID and one or more hardware ID’s don’t match, but at least one hardware ID does still match, you could assume the end user has upgraded their device but it is still the same device.
If Nothing Matches #
If nothing matches it likely means your app is running on a new device, possibly because of theft or because your user has bought a new PC. If the match fails you can handle it as your policies see fit, like directing them to contact you to confirm their identity before allowing a new UUID.
Updating UUIDs #
We do not allow UUIDs to be programmatically deleted or updated in the key library without a developer’s intervention. Once a UUID is set, it is locked to that key unless you manually change it in the Dashboard. There is no way to tell a legitimate update and a malicious end user apart that could not be exploited.
If you trust the use of the key is legitimate, you have some options. You can keep the old UUID and allow an additional UUID by increasing the maximum amount of UUIDs for that key, or you can simply delete the old UUID. Deleting the old UUID is the preferred method.
Editing UUIDs In The Dashboard #
To edit/delete a UUID, go to your Dashboard > View All Keys and use the search function to find the key. Click on the key to see that key’s settings. Find the UUID in the list and click it. Now you can either edit the UUID or leave the field blank to erase the UUID from the system.

Additionally you must deactivate the key to assign it a new UUID. You can do this in your Dashboard. On the next key check the new device UUID will be assigned and locked to the key, and the key will be reactivated.
Until the UUID is updated in the Dashboard the key will continue to fail.