Skip to main content
Version: Next

CMAC

Generate

const cmac = Cryptopp.CMAC.generate(str, key, 'AES', 'hex');

Parameters

ParameterTypeRequiredDefault
datastring
ArrayBuffer
keystring
ArrayBuffer
cipherName 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

ParameterTypeRequiredDefault
datastring
ArrayBuffer
keystring
ArrayBuffer
cipherName of any supported block cipher
macstring
ArrayBuffer
macStringEncoding"hex"
"base64"
"base64url"
"hex"

Returns: boolean