Table of Contents
- Overview
- Verify Enabled Secrets Engines
- Enable the Transit Engine
- Create and Inspect an Encryption Key
- Rotate an Encryption Key
- Encrypt Data
- Rewrap Data After Rotation
- Decrypt Ciphertexts
- Enforce Minimum Decryption Version
- Conclusion
Overview
The Transit Secrets Engine provides cryptographic functions as a service. It allows you to offload encryption, decryption, key management, and more to Vault without storing raw data. Learn more in the official docs: Transit Secrets Engine.Verify Enabled Secrets Engines
First, check which secrets engines are active on your Vault dev server:In Vault dev mode, the
cubbyhole/, identity/, secret/ (KV v2), and sys/ engines are enabled by default.Enable the Transit Engine
Enable the Transit engine at the default pathtransit/:
You can also add a description when enabling:
Create and Inspect an Encryption Key
Create a new key namedtraining:
Rotate an Encryption Key
Rotatetraining to generate a new version:
Encrypt Data
- Base64-encode your plaintext:
- Encrypt the encoded string:
ciphertext for later use.
Rewrap Data After Rotation
After rotating to version 3:Decrypt Ciphertexts
Decrypt version 2:Enforce Minimum Decryption Version
To block decryption of older ciphertext, setmin_decryption_version=3:
Any ciphertext with a version lower than the
min_decryption_version will be rejected.Conclusion
In this lesson, you have:- Enabled and configured the Transit Secrets Engine
- Created, rotated, and inspected encryption keys
- Encrypted, decrypted, and rewrapped data
- Enforced minimum decryption version policies