Offloading Cryptography with the Vault Transit Engine
Stop leaking keys in config files. Learn how to use the Vault Transit engine to offload cryptographic operations, ensuring plaintext keys never leave your secure vault.
29 May 2026, 06:29 UTC

The Problem: Key Sprawl and Exposure
When applications handle encryption, keys end up in environment variables, config files, or application memory. The core risk is key sprawl, where the secret used to encrypt data exists across dozens of instances.
The Vault Transit Engine treats cryptography as a service. The application sends plaintext to Vault and receives ciphertext back. The plaintext key never leaves Vault's secure boundary.
How Transit Operates
Transit provides API endpoints for symmetric and asymmetric cryptographic operations. Supported algorithms include AES-GCM as the default for symmetric encryption, ChaCha20Poly1305, and RSA, ECDSA, Ed25519 for asymmetric needs.
Key versioning is central. Rotating a key creates a new version instead of overwriting the old one. Vault tracks which version encrypted a value, allowing seamless decryption of older data while new encryption uses the latest version.
Symmetric Encryption Workflow
The following assumes Vault 1.12+ and administrative permissions to configure the engine.
Enable the Transit secret engine on your local terminal with an authenticated Vault session.
# Enable the transit engine at the 'transit' path
vault secrets enable transitCreate a named key. Vault generates the key material internally.
# Create a key with the default AES-GCM algorithm
vault write -f transit/keys/app-payment-keyEncrypt data. Vault expects plaintext via the CLI.
# Encrypt the string 'secret-credit-card-number'
vault transit encrypt app-payment-key secret-credit-card-numberVault returns a ciphertext string starting with vault:v1:. The v1 indicates the key version used.
Decrypt data by sending the ciphertext back.
# Decrypt the ciphertext returned from the previous step
vault transit decrypt app-payment-key vault:v1:encrypted-data-stringPerformance Trade-offs and Limitations
Offloading crypto improves security but adds a network round-trip per operation.
- Latency: Every crypto operation is an API call. High throughput workloads increase response times.
- CPU Saturation: Cryptographic operations are CPU intensive. Size Vault nodes for expected request volume.
- Policy Risk: Overly broad policies granting update on transit/decrypt to many roles allow unintended decryption.
Verifying the Implementation
Confirm the mount is active.
vault transit list-endpointsPerform a round-trip test with a known plaintext and verify the decrypted output matches exactly.
Inspect audit logs for encrypt and decrypt events. Key material should never appear in logs.
To rotate a key, use vault write -f transit/keys/app-payment-key/rotate. New data uses the new version while old data remains decryptable.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.