- Enabling Transit at its mount point
- Creating, rotating, and inspecting keys
- Encrypting and decrypting data
- Rewrapping ciphertext after key rotation
- Enforcing a minimum decryption version
This demo uses a Vault development server for simplicity. Do not use a dev server in production workloads.
Prerequisites
- A running Vault development server (default mounts).
- The
vaultCLI installed and authenticated (VAULT_ADDR,VAULT_TOKEN).
1. Verify Installed Secret Engines
Ensure Transit is not yet enabled:2. Enable the Transit Secrets Engine
Enable at the default mount (transit/):
Optionally add a description when enabling:
3. Create an Encryption Key
Create a new key namedtraining (default: AES-256-GCM96):
latest_version, min_decryption_version, and supported operations.
4. Rotate the Key
Generate a new version for thetraining key:
latest_version incremented.
5. Encrypt Data
First, Base64-encode your plaintext:training key:
6. Rotate Again & Rewrap Ciphertext
Rotate to version 3:ciphertext and key_version=3.
7. Decrypt Ciphertext
7.1 Decrypt Version 2
7.2 Decrypt Version 3
8. Enforce a Minimum Decryption Version
Disallow decryption of data encrypted with older key versions:After setting
min_decryption_version=3, any attempt to decrypt version 2 will fail with: