This is my first question on stackoverflow so pls be gentle. I'm communicating with a web services in my iphone app and need to verify my request to the host. What i need to do is to take the url ex. "GET http://api.host.com/" together with a secret key running it via a class and generating a HMAC-SHA1 hash to veryfiy my identity. I have tried some example here on stackoverflow but i haven't found any example that worked for me. I got sample code of the .NET class that does what i need it to do and now i need something similar that would work in Xcode for a iphone app. Here is the NET sample code:
public static void CalculateUrlDigest(string url, string secretKey)
{
byte[] utf8Key = Encoding.UTF8.GetBytes(secretKey);
byte[] utf8Message = Encoding.UTF8.GetBytes(url);
HMACSHA1 crypto = new HMACSHA1();
crypto.Key = utf8Key;
byte[] hash = crypto.ComputeHash(utf8Message);
Console.WriteLine("Base64: " + Convert.ToBase64String(hash));
}
So if anyone could help me with a similar class/function for Xcode that would be great.
Best Regards
Hakan