CMAC
Generate
const cmac = Cryptopp.CMAC.generate(str, key, 'AES', 'hex');
Parameters
Parameter | Type | Required | Default |
---|---|---|---|
data | string ArrayBuffer | ✅ | |
key | string ArrayBuffer | ✅ | |
cipher | Name of any supported block cipher | ✅ | |
encodeTo | "hex" "base64" "base64url" | ❌ | "hex" |
Returns: Based on data
input type: ArrayBuffer
or string
Verify
const cmac_verify = Cryptopp.CMAC.verify(str, key, 'AES', cmac, 'hex');
Parameters
Parameter | Type | Required | Default |
---|---|---|---|
data | string ArrayBuffer | ✅ | |
key | string ArrayBuffer | ✅ | |
cipher | Name of any supported block cipher | ✅ | |
mac | string ArrayBuffer | ✅ | |
macStringEncoding | "hex" "base64" "base64url" | ❌ | "hex" |