94
Views
1
Comments
HMAC SHA256 hex digest
Question

Greetings,
I have a facing an issue with HMAC SHA-256 to hash the below text according to Authentication
documentation   of pusher https://pusher.com/docs/channels/library_auth_reference/rest-api#method-get-users

"POST\n/apps/" + app_id +
"/events\nauth_key=" + key +
"&auth_timestamp=" + auth_timestamp +
"&auth_version=" + auth_version +
"&body_md5=" + body_md5

i have to put my string like above one but in outsystems it does't provide \n  because of which i am using Chr(13) or NewLine() to get the end hash but i am not getting desired  result and for hashing I am using crypto api ComputeMAc

"POST"+Chr(13)+"/apps/" + app_id +"/events"+Chr(13)+"auth_key=" + key +"&auth_timestamp=" + auth_timestamp +"&auth_version=" + auth_version +"&body_md5=" + body_md5


Thanks in advance :)


2019-09-24 18-41-25
Jorge Martins
 
MVP

Hi Anand kumar,

You cannot use NewLine() because that would return "\r\n" which is not what you want, so using Chr(13) would be the way to go.

If you use the values in the example available on the link you shared, do you get the exact same HMAC SHA256 hex digest? If not, it's a problem in how you are building the string (extra spaces, wrong newline characters, that sort of thing).

If the digest is correct, then it's the way you are adding it to the request that is problematic, and you may need to experiment with an external tool like Postman or SOAP UI to call the web service directly and more easily see what you're missing.

Hope this helps!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.