0

我尝试生成机器密钥来手动更新 web.config,但我需要 powershell 脚本来做同样的事情。谁可以帮我这个事?

在此处输入图像描述

4

1 回答 1

1

这行得通吗?

$key = "2012"
$string = "End of the world is nowhere near us."
$sha256 = New-Object System.Security.Cryptography.HMACSHA256
$sha256.key = [Text.Encoding]::ASCII.GetBytes($key)
$signature = $sha256.ComputeHash([Text.Encoding]::ASCII.GetBytes($string))
$hash = ([Convert]::ToBase64String($signature)) -replace '-',''
于 2013-09-30T06:17:12.780 回答