v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1415176206.9 KB

Generates a Message Authentication Code (MAC) cryptogram within Amazon Web Services Payment Cryptography.

You can use this operation to authenticate card-related data by using known data values to generate MAC for data validation between the sending and receiving parties. This operation uses message data, a secret encryption key and MAC algorithm to generate a unique MAC value for transmission. The receiving party of the MAC must use the same message data, secret encryption key and MAC algorithm to reproduce another MAC value for comparision.

You can use this operation to generate a DUPKT, CMAC, HMAC or EMV MAC by setting generation attributes and algorithm to the associated values. The MAC generation encryption key must have valid values for KeyUsage such as TR31_M7_HMAC_KEY for HMAC generation, and the key must have KeyModesOfUse set to Generate.

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

Cross-account use: This operation supports cross-account use when the key has a resource-based policy that grants access. For more information, see Resource-based policies.

Related operations:

  • VerifyMac
post/mac/generate

Request body

KeyIdentifierstring required

The <code>keyARN</code> of the MAC generation encryption key.

MessageDatastring password required

The data for which a MAC is under generation. This value must be hexBinary.

MacLengthinteger

The length of a MAC under generation.

Response

Success

KeyArnstring required

The <code>keyARN</code> of the encryption key that Amazon Web Services Payment Cryptography uses for MAC generation.

KeyCheckValuestring required
<p>The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.</p> <p>Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.</p>
Macstring password required

The MAC cryptogram generated within Amazon Web Services Payment Cryptography.