0

I tried generating machine key to update web.config manually, but I need powershell script to do the same. Can any one help me on this?

enter image description here

Vinoth
  • 1,975
  • 21
  • 34

1 Answers1

1

Does this work?

$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 '-',''
Richard
  • 106,783
  • 21
  • 203
  • 265
ravikanth
  • 24,922
  • 4
  • 60
  • 60
  • Thanks for the update. We need a key like same as one created in IIS. But it looks like the value generated is in string format but the keys in the IIS (both Validation key and Decryption key) are in hexadecimal format. Can you please update me with hexadecimal values (Validation key and Decryption key required bytes?) – Vinoth Sep 30 '13 at 07:28