HardwareIdentification HardwareIdentification HardwareIdentification HardwareIdentification Class

Definition

Provides the ability to obtain a hardware identifier that represents the current hardware.

public : static class HardwareIdentificationpublic static class HardwareIdentificationPublic Static Class HardwareIdentification// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows Desktop Extension SDK (introduced v10.0.10240.0) Windows Mobile Extension SDK (introduced v10.0.10240.0) Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.System.Profile.ProfileHardwareTokenContract (introduced v1)

Examples

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.
var packageSpecificToken;

packageSpecificToken =  Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(nonce);

// hardware id, signature, certificate IBuffer objects 
// that can be accessed through properties.
var hardwareId = packageSpecificToken.id;
var signature = packageSpecificToken.signature;
var certificate = packageSpecificToken.certificate;
// 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;
// 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;
// nonce is an IBuffer object that would be sent from the cloud service.
Dim packageSpecificToken As Windows.System.Profile.HardwareToken

packageSpecificToken = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(nonce)

// hardware id, signature, certificate IBuffer objects 
// that can be accessed through properties.
Dim hardwareId As Windows.Storage.Streams.IBuffer = packageSpecificToken.Id
Dim signature As Windows.Storage.Streams.IBuffer = packageSpecificToken.Signature
Dim certificate As Windows.Storage.Streams.IBuffer = packageSpecificToken.Certificate

Remarks

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

Note

: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Methods

GetPackageSpecificToken(IBuffer) GetPackageSpecificToken(IBuffer) GetPackageSpecificToken(IBuffer) GetPackageSpecificToken(IBuffer)

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.

public : static HardwareToken GetPackageSpecificToken(IBuffer nonce)public static HardwareToken GetPackageSpecificToken(IBuffer nonce)Public Static Function GetPackageSpecificToken(nonce As IBuffer) As HardwareToken// You can use this method in JavaScript.
Parameters
nonce
IBuffer IBuffer IBuffer 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.

Returns

Remarks

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

See Also

See Also