Start a Conversation

Unsolved

This post is more than 5 years old

704

June 17th, 2013 11:00

Having issue with getting proper signature

Hi all,

I'm working on the rest API for some internal automations and cannot get the signature to come back correct. I'm always getting the code 1032 from the API. (just trying to run a basic GET tags, nothing special)

In short I'm...

1) getting the current date

2) getting the x-emc headers

3) canonicalized the headers

4) combine the HTTP request method+\n+Content Type+\n+Range+\n+Date+\n+CanonicalizedResource+\n+CanonicalizedHeaders to get the Hash String

5) Then I run the following code in powershell to decode the secret share, and then SHA1 the hash with the decoded secret and then re-encode that to produce the signature

$args[0] is the input shared secret

$args[1] is the input hash string

$decoded = [System.Convert]::FromBase64String($args[0])

$decodedSecret = [System.Text.Encoding]::UTF8.GetString($decoded)

$hmacsha = New-Object System.Security.Cryptography.HMACSHA1

$hmacsha.key = [Text.Encoding]::ASCII.GetBytes($decodedSecret)

$signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($args[1]))

$encoded = [System.Text.Encoding]::UTF8.GetBytes($signature)

$encodedSig = [System.Convert]::ToBase64String($encoded)

echo $encodedSig

Not sure if I'm missing something or doing a step wrong, but I was curious if there was any online testing tool that I could send a request into and see what the expected signature is or something? That makes it a lot easier than guess and check.

For reference I'm using Cisco Process Orchestrator to call the API.

No Responses!
No Events found!

Top