The following C# code creates the hash that I need to generate in a POSTMAN Pre-Request Script so that it can be added to the sent message.
using (HMACSHA1 hmac = new HMACSHA1(ASCIIEncoding.ASCII.GetBytes(KeyString)))
hash = Convert.ToBase64String( hmac.ComputeHash(ASCIIEncoding.ASCII.GetBytes(StringToHash)));
The KeyString and StringToHash are being created correctly, but the signature generated from the code below is not matching.
var signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(CryptoJS.enc.Hex.parse(StringToHash),CryptoJS.enc.Hex.parse(KeyString)));
- I think the CryptoJS.enc.Base64.stringify is correct and the CryptoJS.HmacSHA1 is likely alright, but how do I create the equivalent ASCII encoded byte arrays?
- Can I link a simple C# .dll into POSTMAN to do the hashing in C#?
- I could not find any documentation for the POSTMAN OAUTH helper, would it “help” in this case?