Vault Architecture Fundamentals · Topic 1 of 3
How Vault Encrypts Data
Vault Associate (003): the cryptographic barrier, the untrusted storage backend, and the encryption key, root key and unseal key hierarchy in order.
- 4 min
- Includes a diagram
- The barrier encrypts everything leaving Vault; the storage backend holds only encrypted data.
- The storage backend is outside the barrier and untrusted.
- The barrier cipher is 256-bit AES in GCM mode with 96-bit random nonces.
What it is
Vault encrypts everything it writes to storage. The part of Vault that does this is the cryptographic barrier. Data is encrypted before it leaves for the storage backend and decrypted when it comes back.
The storage backend sits outside the barrier and is considered untrusted. Whoever can read the storage sees only encrypted data.
How it works
The barrier
The barrier is Vault's encryption layer, responsible for encrypting and decrypting Vault data. Vault's security model states that the barrier automatically encrypts all data leaving Vault using a 256-bit AES cipher in Galois Counter Mode (GCM) with 96-bit nonces, and the nonce is randomly generated for every encrypted object. In practice, all data at rest is encrypted.
Because the storage backend is untrusted, it does not matter whether it is Integrated Storage, Consul or another backend. It holds ciphertext only.
Data in transit
Clients use TLS to verify the identity of the server and to establish a secure channel to Vault. The barrier protects data at rest, and TLS protects data on the network. Do not mix the two up.
The key hierarchy
Vault protects its data with a chain of keys.
| Key | What it does | Where it lives |
|---|---|---|
| Encryption key | Encrypts all Vault data written to storage | Stored in the keyring, protected by the root key |
| Root key | Protects the encryption key | Stored alongside other Vault data, encrypted by the unseal key |
| Unseal key | Encrypts the root key | Split into shares with Shamir's Secret Sharing by default |
During initialization Vault generates the encryption key, which protects all Vault data. That key is protected by a root key stored alongside all other Vault data, and the root key is in turn encrypted by the unseal key.
Why this matters
When Vault starts, the unseal key is not available, so the root key cannot be decrypted. Vault can reach storage but cannot read it. This is the sealed state, covered on the next page.
Once enough unseal key shares are supplied, the chain opens: the unseal key decrypts the root key, the root key decrypts the encryption key, and the encryption key decrypts the data. The root key stays in memory only while Vault is unsealed.
Rotating the encryption key
The command vault operator rotate rotates the underlying encryption key that secures data written to storage. It installs a new key in the key ring. The new key encrypts new data, and older keys in the ring still decrypt older data.
It is an online operation per cluster.
After unseal
After unsealing, Vault loads its configured audit devices, auth methods and secrets engines, then serves requests.
How the exam asks about this
- "Where does Vault encrypt data before storing it?" In the cryptographic barrier.
- "Can an attacker who reads the storage backend read secrets?" No, because the backend is untrusted and holds only encrypted data.
- "Which key encrypts the data stored by Vault?" The encryption key, which is protected by the root key.
What to remember for the exam
- The barrier encrypts everything leaving Vault; the storage backend holds only encrypted data.
- The storage backend is outside the barrier and untrusted.
- The barrier cipher is 256-bit AES in GCM mode with 96-bit random nonces.
- The key order is unseal key protects root key, and root key protects encryption key.
- Initialization generates the encryption key; the unseal key is split into Shamir shares by default.
vault operator rotateinstalls a new encryption key; older keys stay in the ring to decrypt older data.
Do not describe the storage backend as the thing that encrypts data. Vault encrypts through the barrier before data reaches the backend, so a stolen backend alone is not enough to read secrets.
Common mistakes
Saying the unseal key encrypts the data directly. The unseal key encrypts the root key. The root key protects the encryption key, and the encryption key protects the data.
Confusing barrier and TLS. The barrier covers data at rest in storage. TLS covers the connection between the client and Vault.
Assuming rotation re-encrypts old data. The rotate command adds a new key for new data. Older keys remain in the ring to decrypt data written earlier.
Check yourself
What does the cryptographic barrier do?
It encrypts all data before it leaves Vault for the storage backend and decrypts it on the way back.
Why is the storage backend called untrusted?
It sits outside the barrier, so Vault encrypts the data first and the backend only ever holds ciphertext.
Which key is encrypted by the unseal key?
The root key, which in turn protects the encryption key used for all Vault data.
Topic 1 of 3 in Vault Architecture Fundamentals
Test yourself on Vault Architecture Fundamentals
The full HashiCorp Vault Associate 003 question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by HashiCorp. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.