Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading device serial number and/or IMEI from UWP app

Tags:

c#

uwp

I am working on an app that will obtain an X.509 certificate for a device that will be used to encrypt various configuration data. Ideally, this certificate would contain information that can be correlated with procurement records. Is there any way to read the device serial number or IMEI from a universal windows app?

like image 463
Carl Avatar asked Mar 13 '23 18:03

Carl


1 Answers

As for UWP in general, to get a system unique id (not IMEI), you might want to check out these classes:

Windows.System.Profile.SystemIdentification

and

Windows.System.Profile.HardwareIdentification

E.g.: you can query a unique device id with:

var buffer = SystemIdentification.GetSystemIdForPublisher();

Which has the following remarks according to msdn:

The ID has the following characteristics:

  • Unique for every system
  • Can be created offline
  • Persists across rebooting, OS upgrades/reinstalls, and so on
  • Persists across hardware modifications
  • Available in OneCore
  • Available on the factory floor for licensing purposes

https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.systemidentification.getsystemidforpublisher.aspx

Be aware that the return type is an IBuffer and produces some raw (non-string-like-readable) bytes so you might need to serialize that.

More info

https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.systemidentification.aspx

and

https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.hardwareidentification.aspx

like image 166
Stefan Avatar answered Mar 23 '23 04:03

Stefan