Skip to content

Generate Mac

paymentcryptographydataplane_generate_mac R Documentation

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

Description

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 they key must have KeyModesOfUse set to Generate and Verify.

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 can't be used across different Amazon Web Services accounts.

Related operations:

  • verify_mac

Usage

paymentcryptographydataplane_generate_mac(KeyIdentifier, MessageData,
  GenerationAttributes, MacLength)

Arguments

KeyIdentifier

[required] The keyARN of the MAC generation encryption key.

MessageData

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

GenerationAttributes

[required] The attributes and data values to use for MAC generation within Amazon Web Services Payment Cryptography.

MacLength

The length of a MAC under generation.

Value

A list with the following syntax:

list(
  KeyArn = "string",
  KeyCheckValue = "string",
  Mac = "string"
)

Request syntax

svc$generate_mac(
  KeyIdentifier = "string",
  MessageData = "string",
  GenerationAttributes = list(
    Algorithm = "ISO9797_ALGORITHM1"|"ISO9797_ALGORITHM3"|"CMAC"|"HMAC_SHA224"|"HMAC_SHA256"|"HMAC_SHA384"|"HMAC_SHA512",
    EmvMac = list(
      MajorKeyDerivationMode = "EMV_OPTION_A"|"EMV_OPTION_B",
      PrimaryAccountNumber = "string",
      PanSequenceNumber = "string",
      SessionKeyDerivationMode = "EMV_COMMON_SESSION_KEY"|"EMV2000"|"AMEX"|"MASTERCARD_SESSION_KEY"|"VISA",
      SessionKeyDerivationValue = list(
        ApplicationCryptogram = "string",
        ApplicationTransactionCounter = "string"
      )
    ),
    DukptIso9797Algorithm1 = list(
      KeySerialNumber = "string",
      DukptKeyVariant = "BIDIRECTIONAL"|"REQUEST"|"RESPONSE",
      DukptDerivationType = "TDES_2KEY"|"TDES_3KEY"|"AES_128"|"AES_192"|"AES_256"
    ),
    DukptIso9797Algorithm3 = list(
      KeySerialNumber = "string",
      DukptKeyVariant = "BIDIRECTIONAL"|"REQUEST"|"RESPONSE",
      DukptDerivationType = "TDES_2KEY"|"TDES_3KEY"|"AES_128"|"AES_192"|"AES_256"
    ),
    DukptCmac = list(
      KeySerialNumber = "string",
      DukptKeyVariant = "BIDIRECTIONAL"|"REQUEST"|"RESPONSE",
      DukptDerivationType = "TDES_2KEY"|"TDES_3KEY"|"AES_128"|"AES_192"|"AES_256"
    )
  ),
  MacLength = 123
)