EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

HardwareIdentification.GetPackageSpecificToken | getPackageSpecificToken method

Applies to Windows and Windows Phone

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.

Syntax


var hardwareToken = Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(nonce);

Parameters

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.

Remarks

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.

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;



Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

See also

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

 

 

Mostrar:
© 2014 Microsoft