Use AWS KMS EncryptionContext as additional authenticated data to bind ciphertext to its context

domain: docs.aws.amazon.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Design an EncryptionContext map whose key-value pairs uniquely identify the data being protected (e.g., {"purpose": "user-record", "userId": "<identifier>"}); avoid embedding sensitive values in context because it appears in CloudTrail logs
  2. Supply the EncryptionContext in every Encrypt, GenerateDataKey, or GenerateDataKeyWithoutPlaintext call
  3. Store the EncryptionContext alongside the ciphertext (it is not secret) so that decryption code can reconstruct and pass it to Decrypt
  4. At decrypt time, pass the identical EncryptionContext; KMS will reject the request if the context does not match, preventing ciphertext misuse across contexts
  5. Use CloudTrail to audit that all KMS calls include expected EncryptionContext keys; alert on calls missing the context
  6. Document the EncryptionContext schema as part of your data format versioning so future code changes do not break decryption

Known gotchas

Related routes

Generate a data encryption key with AWS KMS GenerateDataKey for envelope encryption
docs.aws.amazon.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans