2013-09-30 36 views

回答

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 '-','' 
+0

感谢您的更新。我们需要一个与IIS中创建的相同的密钥。但它看起来像生成的值是字符串格式,但IIS中的密钥(验证密钥和解密密钥都是十六进制格式)。你能否以十六进制值更新我(验证密钥和解密密钥所需字节?) – Vinoth