AWS payment-cryptography: Clarify HMAC algorithm selection and key usage constraints
Summary
Rewrites the HMAC example to state that Algorithm must be set to HMAC (the key determines the hash) and that HMAC_SHA224/256/384/512 may only be used with a TDES or AES key whose KeyUsage is TR31_M7_HMAC_KEY.
Security assessment
Provides concrete guidance preventing misuse of HMAC parameters and mismatched key types/KeyUsage, which is cryptographic best-practice documentation rather than a fix for a specific flaw.
Evidence
+Because the key algorithm is an HMAC algorithm, set `Algorithm` to `HMAC`, and the key sets the hash. Use `HMAC_SHA224`, `HMAC_SHA256`, `HMAC_SHA384`, or `HMAC_SHA512` only with a TDES or AES key that has KeyUsage set to `TR31_M7_HMAC_KEY`.
Diff
diff --git a/payment-cryptography/latest/userguide/generate-mac.md b/payment-cryptography/latest/userguide/generate-mac.md index 84304e7..d60df38 100644 --- a//payment-cryptography/latest/userguide/generate-mac.md +++ b//payment-cryptography/latest/userguide/generate-mac.md @@ -51 +51,3 @@ CMAC and HMAC algorithms don't require padding. All others require that the data -In this example, we will generate a HMAC (Hash-Based Message Authentication Code) for card data authentication using HMAC algorithm `HMAC_SHA256` and HMAC encryption key. The key must have KeyUsage set to `TR31_M7_HMAC_KEY` and KeyModesOfUse to `Generate`. The hash length (e.g. 256) is defined when the key is created and cannot be modified. +In this example, we will generate a HMAC (Hash-Based Message Authentication Code) for card data authentication using an `HMAC_SHA256` key. The key must have KeyUsage set to `TR31_M7_HMAC_KEY` and KeyModesOfUse to `Generate`. The hash length (e.g. 256) is defined when the key is created and cannot be modified. + +Because the key algorithm is an HMAC algorithm, set `Algorithm` to `HMAC`, and the key sets the hash. Use `HMAC_SHA224`, `HMAC_SHA256`, `HMAC_SHA384`, or `HMAC_SHA512` only with a TDES or AES key that has KeyUsage set to `TR31_M7_HMAC_KEY`.