The Windows.Security.Cryptography
namespace does contain HMAC.
You create a
MacAlgorithmProvider
object by calling the staticOpenAlgorithm
method and specifying one of the following algorithm names:HMAC_MD5 HMAC_SHA1 HMAC_SHA256 HMAC_SHA384 HMAC_SHA512 AES_CMAC
public static byte[] HmacSha1Sign(byte[] keyBytes, string message){
var messageBytes= Encoding.UTF8.GetBytes(message);
MacAlgorithmProvider objMacProv = MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
CryptographicKey hmacKey = objMacProv.CreateKey(keyBytes.AsBuffer());
IBuffer buffHMAC = CryptographicEngine.Sign(hmacKey, messageBytes.AsBuffer());
return buffHMAC.ToArray();
}