API - Creating signature


I am trying to play with the API to extract data etc...

I am trying to generate the signature with Powershell but I do not appear to get the same signature result in the example as http://vembu-docs.s3.amazonaws.com/ve...

#generate MD5

$Password = "admin"
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$utf8 = new-object -TypeName System.Text.UTF8Encoding
$Passwordhash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($Password)))
$Passwordhash = $Passwordhash.ToLower() -replace '-', ''
Echo 'Password Hash'

21232f297a57a5a743894a0e4a801fc3 --> OK

$unixtime= '1497704250'

#generate sha256 hash of nonce + POST Data
$SecretKey = $Passwordhash + $unixtime
Echo 'Password Hash + unix time'

21232f297a57a5a743894a0e4a801fc31497704250 ---> OK

#get our sha256 hmac
$hmacsha = New-Object System.Security.Cryptography.HMACSHA256
$hmacsha.key = [Text.Encoding]::UTF8.GetBytes($SecretKey)
$signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes("LIST_BACKUPS"))
$signature = [Convert]::ToBase64String($signature)
echo $signature

bNMiJO0KwHDzQSG3CDC5e208pVGBUIyOlbD554+Ev+w= ---> NOT OK

I am not sure why I am not getting back the value like the example in your documentation

283d8b2f9c019353e312f1b9d6ebfdc810d2e2c6 ---> EXPECTED

... any ideas?? this is the first time i have had to use this method to hit an API.



edit retag flag offensive close merge delete