GetPackageSpecificToken | getPackageSpecificToken method
Collapse the table of content
Expand the table of content

HardwareIdentification.GetPackageSpecificToken | getPackageSpecificToken method

Gets a hardware identifier (ASHWID) that represents the current hardware. The returned ASHWID will be different for each application package. In other words, this API will return different identifiers when called by two apps from different packages. It will return the same identifier when called by two apps that are part of the same package.


static HardwareToken^ GetPackageSpecificToken(
  IBuffer^ nonce



Type: IBuffer

The cryptographic nonce is optional. The nonce is recommended when ASHWID needs to be verified on the cloud against replay attacks. In the scenarios where nonce is desired, the remote server should generate a random nonce and pass it to the client app, and then verify that the signature has the expected nonce once the ASHWID is received from the client system.

Return value

Type: HardwareToken

The hardware Id information.


The GetPackageSpecificToken is designed for use by professional developers who have experience with licensing content and with sufficient expertise in cryptography

See Guidance on using the App Specific Hardware ID (ASHWID) to implement per-device app logic for more information.


The following code shows how to get the hardware id of a device using GetPackageSpecificToken.

// nonce is an IBuffer object that would be sent from the cloud service.
HardwareToken^ packageSpecificToken;

packageSpecificToken =  Windows::System::Profile::HardwareIdentification::GetPackageSpecificToken(nonce);

// hardware id, signature, certificate IBuffer objects 
// that can be accessed through properties.
IBuffer^ hardwareId = packageSpecificToken->Id;
IBuffer^ signature = packageSpecificToken->Signature;
IBuffer^ certificate = packageSpecificToken->Certificate;

Requirements (Windows 10 device family)

Device family

Desktop, introduced version 10.0.10240.0
Mobile, introduced version 10.0.10240.0
Universal, introduced version 10.0.14393.0

API contract

Windows.System.Profile.ProfileHardwareTokenContract, introduced version 1.0


Windows::System::Profile [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::System::Profile [C++]



See also

Guidance on using the App Specific Hardware ID (ASHWID) to implement per-device app logic



© 2016 Microsoft