Implementing envelope encryption with aws kms

From mukul975/Anthropic-Cybersecurity-Skills · View interactive version

Implementing envelope encryption with aws kms is an AI agent skill from the GitHub repository mukul975/Anthropic-Cybersecurity-Skills. Implements envelope encryption with AWS KMS, encrypting data locally with a data encryption key (DEK) and protecting that DEK with a KMS-managed key (KEK), covering the encrypt/decrypt flow, KMS key types, and security validation criteria. Use when designing key management for encrypting large or nu

How to use this skill

Skill file

Implementing Envelope Encryption with AWS KMS

Overview

Envelope encryption is a strategy where data is encrypted with a data encryption key (DEK), and the DEK itself is encrypted with a master key (KEK) managed by AWS KMS. This approach allows encrypting large volumes of data locally while keeping the master key secure in a hardware security module (HSM) managed by AWS. This skill covers implementing envelope encryption using AWS KMS GenerateDataKey API.

When to Use

Prerequisites

Objectives

Key Concepts

Envelope Encryption Flow

  1. Call kms:GenerateDataKey to get plaintext DEK + encrypted DEK
  2. Use plaintext DEK to encrypt data locally (AES-256-GCM)
  3. Store encrypted DEK alongside ciphertext
  4. Discard plaintext DEK from memory
  5. For decryption: call kms:Decrypt on encrypted DEK, then decrypt data

Advantages Over Direct KMS Encryption

| Aspect | Direct KMS | Envelope Encryption |

|--------|-----------|-------------------|

| Max data size | 4 KB | Unlimited |

| Latency | Network round-trip per operation | Local encryption |

| Cost | $0.03/10,000 requests | Fewer KMS requests |

| Offline | Not possible | Yes (with cached DEKs) |

KMS Key Types

Security Considerations

Validation Criteria

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.