Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 36 ยท Concepts and Setup

Seal, Unseal and Shamir's Secret Sharing

Understand why Vault starts sealed, how Shamir's Secret Sharing splits the root key into shares with a threshold, and how auto-unseal differs. Runnable Shamir demo.

When Vault starts, it can read nothing: its data is encrypted and the key is not in memory. This state is called sealed. To use Vault, someone must unseal it by providing enough key material to rebuild the root key. By default Vault splits that key using Shamir's Secret Sharing, so that no single person holds the whole key.

This lesson explains the idea, shows the default numbers (5 shares, threshold 3), covers auto-unseal and manual sealing, and lets you run a real implementation of Shamir's scheme.

Vault itself cannot run on this site. The Python Shamir code is a teaching implementation over a prime field. Real Vault uses its own audited implementation; never roll your own cryptography for production.

Why seal at all?

A server can be stolen, a disk imaged, a memory dump leaked. If Vault kept its key on disk, anyone with the disk would own every secret. Sealing makes Vault safe at rest: after a restart or an emergency vault operator seal, the key is gone from memory and a human (or an auto-unseal service) must bring it back.

Shamir's Secret Sharing

The scheme splits a secret into n shares so that any k shares (the threshold) rebuild it, while k-1 shares reveal nothing about it. It works with polynomials: a secret is the constant term of a random polynomial of degree k-1; each share is a point on the curve. Any k points determine the polynomial (and its constant term); fewer do not.

Vault's defaults:

Setting Default Meaning
key-shares 5 Number of unseal key shares produced at init
key-threshold 3 Shares needed to unseal

Give the shares to different people or systems. Losing two of them is fine; losing three means nobody can unseal.

flowchart LR
    RK["Root key"] -->|"split 5, threshold 3"| S1["Share 1"]
    RK --> S2["Share 2"]
    RK --> S3["Share 3"]
    RK --> S4["Share 4"]
    RK --> S5["Share 5"]
    S1 & S3 & S5 -->|"any 3"| RK2["Root key rebuilt in memory"]

Three of five shares reconstruct the key; two do not.

Shamir's scheme you can run

Python Split a secret into 5 shares, rebuild with 3

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Any three shares return the secret exactly. Two shares produce an unrelated number: nothing about the real secret leaks. Vault adds extra steps, including encoding the shares as base64 strings, but the mathematics is the same.

Unsealing step by step

Terminal
vault operator unseal      # prompts for a share; run it 3 times with 3 different shares
vault status               # shows Sealed true/false and "Unseal Progress 1/3"

Each call adds one share to an in-memory progress counter. Shares can come from different people on different machines. vault operator unseal -reset clears the progress if someone typed a wrong share. Once the threshold is met Vault becomes unsealed and serves requests.

The threshold in practice

Python How many shares can you lose?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

1 of 1 is convenient for a lab and a single point of failure for a company; 5 of 5 is a recipe for being locked out. Choose a threshold that survives people leaving and still needs real cooperation.

Auto-unseal

Typing shares after every restart is a pain for clusters and automatic recovery. Auto-unseal delegates protection of the root key to an external trusted service: a cloud KMS (AWS KMS, Azure Key Vault, Google Cloud KMS), an HSM through PKCS#11, or another Vault using Transit. Vault asks that service to decrypt its root key at startup. Notes:

  • With auto-unseal, the shares are called recovery keys. They cannot unseal; they authorize sensitive operations such as generating a root token.
  • Your availability now depends on the KMS and its permissions, so protect those.
  • It is configured in a seal stanza of the config file, covered in The Vault Configuration File.

Sealing on purpose

vault operator seal seals a running Vault, a useful kill switch during an incident. It requires a privileged token. Afterwards every request except status checks fails until Vault is unsealed again.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. With the default 5 shares and threshold 3, how many shares do you need to unseal?

    Any 3 of the 5 shares reconstruct the root key.
  2. 2. What does having only 2 of the 3 required shares reveal about the key?

    Below the threshold, Shamir's scheme is information-theoretically secure; the points fit any secret.
  3. 3. With auto-unseal, what are the shares called and what do they do?

    A cloud KMS or HSM unseals automatically; recovery keys protect operations such as root token generation.
  4. 4. What is a good reason to run vault operator seal?

    A sealed Vault cannot read data. It is an emergency brake.

Summary

  • Vault starts sealed; unsealing rebuilds the root key in memory.
  • Shamir's scheme splits the key into n shares, any k of which recover it; fewer reveal nothing.
  • Defaults are 5 shares with a threshold of 3; choose values that survive staff changes.
  • Auto-unseal uses a KMS or HSM, and the shares become recovery keys.
  • vault operator seal is an emergency brake.

Next: Initializing and Unsealing Vault