AWS payment-cryptography: Document valid MacLength values and Mac length constraint
Summary
Expands the MacLength description with per-algorithm valid lengths and adds a constraint that for ISO9797 and CMAC the number of hex characters in Mac must equal MacLength.
Security assessment
Clarifies MAC verification length requirements, which supports correct cryptographic validation behavior, but it is documentation of API parameter constraints rather than a fix for a specific vulnerability.
Evidence
+For `ISO9797_ALGORITHM1`, `ISO9797_ALGORITHM3`, and `CMAC`, the number of hexadecimal characters in `Mac` must equal this value.
Diff
diff --git a/payment-cryptography/latest/DataAPIReference/API_VerifyMac.md b/payment-cryptography/latest/DataAPIReference/API_VerifyMac.md index 0ac90f0..8a9b070 100644 --- a//payment-cryptography/latest/DataAPIReference/API_VerifyMac.md +++ b//payment-cryptography/latest/DataAPIReference/API_VerifyMac.md @@ -77 +77,22 @@ Required: Yes -The length of the MAC. +The length of the MAC. The unit and valid values depend on the MAC algorithm: + + * `ISO9797_ALGORITHM1`, `ISO9797_ALGORITHM3`, and `CMAC` with a TDES key: 8 or 16 hexadecimal characters. + + * `CMAC` with an AES key: 8, 16, or 32 hexadecimal characters. + + * `AS2805_4_1`: 8 hexadecimal characters. + + * `DukptCmac`, `DukptIso9797Algorithm1`, and `DukptIso9797Algorithm3`: + + * TDES working key: 8 or 16 hexadecimal characters. + + * AES working key: 8, 16, or 32 hexadecimal characters. + + * `EmvMac`: 4 or 8 bytes. + + * HMAC: this value is currently ignored. `Mac` must be the full output of the hash algorithm: 56, 64, 96, or 128 hexadecimal characters for SHA-224, SHA-256, SHA-384, or SHA-512. + + + + +For `ISO9797_ALGORITHM1`, `ISO9797_ALGORITHM3`, and `CMAC`, the number of hexadecimal characters in `Mac` must equal this value.