How the Sealing process works
mainThe sealing process follows these steps to transform a plain secret into a Sealed Secret:
- Secret Encryption: The secret is encrypted using AES-256-GCM with a randomly generated 32-byte single-use session key ($K_s$). This produces the
AES encrypted data. - Session Key Encryption: The session key ($K_s$) is encapsulated using the controller's public key ($K_{pub}$) via RSA-OAEP with SHA-256. This step uses a
labelderived from the controller's scope configuration to ensure the secret can only be decrypted by the intended controller instance. - Storage: The final Sealed Secret is a concatenated byte array:
size of AES encrypted key (2 bytes) || RSA encrypted data || AES encrypted data.
RSA-OAEP Label Scopes
The label used during encryption depends on the controller's scope:
- Default scope:
label = Secret's namespace || Secret's name - Namespace-wide scope:
label = Secret's namespace - Cluster-wide scope:
labelis empty
Secret
|
│
K_s────────────►│
│ │
K_pub───────►│ │
│ │
label───────►│ 2. │
│ │
┌──────────────────────┬───────▼───────┬──────▼───────┐
Sealed Secret data = │size of AES encrypted │ RSA encrypted │ AES encrypted│
│key (2 bytes) │ data │ data │
└──────────────────────┴───────────────┴──────────────┘