CertificateEncryption - generateMac(String key, String algorithm, String data)

Generates the Message Authentication Code (MAC), which is used to authenticate a message.

Table 1. Parameters
Name Type Description
key String Key used to sign the message.
algorithm String Algorithm used to generate the MAC: HmacSHA256, HmacSHA1, HmacMD5, and so on.
data String Data to be processed.
Table 2. Returns
Type Description
String MAC in base64 format.
var mac = new CertificateEncryption;
mac.generateMac("sample_key", "HmacSHA256", "sample_data");