MAC Generate2 (CSNBMGN2)

Use the MAC Generate2 service to generate a keyed hash message authentication code (HMAC) or a ciphered message authentication code (CMAC) for the message string provided as input. A MAC key with key usage that can be used for generate is required to calculate the MAC.

The MAC generate key must be in a variable-length HMAC key token for HMAC and an AES MAC token for CMAC. The key must have key usage that allows the key to generate MACs.

For the HMAC algorithm, clear key tokens are supported. Clear HMAC keys can be built using the Key Token Build2 (CSNBKTB2) callable service.