verifyMac method

Future<VerifyMacOutput> verifyMac({
  1. required String keyIdentifier,
  2. required String mac,
  3. required String messageData,
  4. required MacAttributes verificationAttributes,
  5. int? macLength,
})

Verifies a Message Authentication Code (MAC).

You can use this operation to verify MAC for message data authentication such as . In this operation, you must use the same message data, secret encryption key and MAC algorithm that was used to generate MAC. You can use this operation to verify a DUPKT, CMAC, HMAC or EMV MAC by setting generation attributes and algorithm to the associated values.

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:

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException. May throw VerificationFailedException.

Parameter keyIdentifier : The keyARN of the encryption key that Amazon Web Services Payment Cryptography uses to verify MAC data.

Parameter mac : The MAC being verified.

Parameter messageData : The data on for which MAC is under verification. This value must be hexBinary.

Parameter verificationAttributes : The attributes and data values to use for MAC verification within Amazon Web Services Payment Cryptography.

Parameter macLength : The length of the MAC.

Implementation

Future<VerifyMacOutput> verifyMac({
  required String keyIdentifier,
  required String mac,
  required String messageData,
  required MacAttributes verificationAttributes,
  int? macLength,
}) async {
  _s.validateNumRange(
    'macLength',
    macLength,
    4,
    32,
  );
  final $payload = <String, dynamic>{
    'KeyIdentifier': keyIdentifier,
    'Mac': mac,
    'MessageData': messageData,
    'VerificationAttributes': verificationAttributes,
    if (macLength != null) 'MacLength': macLength,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/mac/verify',
    exceptionFnMap: _exceptionFns,
  );
  return VerifyMacOutput.fromJson(response);
}