Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 6f0ac0d

Browse files
committed
Add device key generator
1 parent e040ca3 commit 6f0ac0d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/generate-device-key.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
param(
5+
[Parameter(Mandatory=$true)][string]$key,
6+
[Parameter(Mandatory=$true)][string]$id
7+
)
8+
9+
$hmacsha = New-Object System.Security.Cryptography.HMACSHA256
10+
$hmacsha.key = [Convert]::FromBase64String($key)
11+
12+
$deviceKey = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($id))
13+
$deviceKey = [Convert]::ToBase64String($deviceKey)
14+
15+
Write-Output $deviceKey

0 commit comments

Comments
 (0)