Can anyone convert the below code to Objective-C?
Server has the code below implemented and I have to do the same thing on client side.
private string Signature()
{
string publicKey = PUBLICKEY;
string secretKey = PRIVATEKEY;
string email = YOUREMAIL;
if (String.IsNullOrWhiteSpace(secretKey) || String.IsNullOrWhiteSpace(publicKey))
return "";
string signature;
var secretBytes = Encoding.UTF8.GetBytes(secretKey);
var valueBytes = Encoding.UTF8.GetBytes(publicKey);
using (var hmac = new HMACSHA256(secretBytes))
{
var hash = hmac.ComputeHash(valueBytes);
signature = Convert.ToBase64String(hash);
}
string authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(email + ":" + signature));
return authInfo;
}