# RFC-0011: Keyrings, Additional Recipients, and Escrow - **Status:** Proposed; supersedes the `Protector.__init__` signature in RFC-0004 and the single-provider seal/open/rewrap rules of the envelope specification sections 8.1, 8.2, and 8.4. - **Owner:** API and format leads; security-owner approval required. - **Last updated:** 2026-11-29 ## Context The envelope format has always allowed up to 32 recipients that wrap the same data key, but `Protector` could configure exactly one provider and sealed exactly one recipient. Enterprises need more than one at seal time: - **Disaster recovery.** A second region's KMS key, so that losing a region or a key does not make data unrecoverable. - **Escrow and break-glass.** An offline recovery key (for example an HPKE key pair in a safe or an HSM) that can open everything sealed under a policy, without the online provider. - **Migration.** Two providers during a move between clouds. Wrapping a second recipient afterwards with `rewrap` is not a substitute: it leaves a window in which the only recipient is the primary, and it requires a second pass over every envelope. ## Binding decision ```python class Protector: def __init__( self, *, policy: Policy, primary_key: KeyRef, provider: KeyProvider | None = None, providers: Iterable[KeyProvider] | None = None, additional_keys: Iterable[KeyRef] = (), audit_sink: AuditSink | None = None, ) -> None: ... ``` - Exactly one of `provider` and `providers` is given. Provider identifiers are unique; there is no discovery, ordering preference, or fallback by name (dependency rule 11). - Every configured provider must be permitted by the policy. - `primary_key` and each of `additional_keys` must belong to a configured provider and name distinct logical keys (`provider_id`, `key_id`). Their count must not exceed `Policy.max_recipients`. - **Seal** resolves and wraps every recipient key, primary first, through the provider that owns it, all bound to the same protected bytes. If any recipient cannot be resolved or wrapped, nothing is emitted: a silently missing escrow recipient would surface only during an incident. - **Open** tries, in envelope order, each recipient whose provider is configured. (Amended by RFC-0031: only recipients that name a trusted key, a recipient key or a declared decryption key, are tried, each key version once.) Authentication failures, provider failures, and `KEY_STATE_DENIED` move on to the next recipient (a disabled or destroyed primary version is precisely the case an escrow recipient exists for); any other policy refusal is final. - **Rewrap** replaces the recipient with the destination's provider and key identifier when there is one (rotation), and otherwise the recipient that unwrapped (migration). All other recipients stay in place, so a rotation never drops the escrow recipient even when the escrow key did the unwrap. ## Security consequences - Every recipient can decrypt everything sealed with it. An escrow key is therefore as sensitive as the union of the data it covers; keep it offline, under dual control, and audit every use. - The recipient manifest MAC already authenticates the full recipient list, so an attacker without the DEK cannot add, drop, or reorder recipients. - Policies keep their upper bound on recipients, so a configuration cannot grow envelopes without limit. ## Compatibility consequences The root exports are unchanged (still the 15 RFC-0004 names). The format is unchanged: v4.0 readers already accept several recipients. The constructor keeps `provider=` for the single-provider case; `primary_key` is still required. Because 4.0 is unreleased, this is not a breaking change for any published version (SemVer: additive for 4.0.0). ## Alternatives considered - **A separate `Keyring` object.** Rejected for now: it would add a public name to the root facade for what is a list of providers and keys. - **Best-effort escrow** (seal even if an additional key fails). Rejected: a recovery path that is silently absent is worse than a loud failure. - **Fallback on every error during open.** Rejected: a `POLICY_DENIED` from a provider is an authorization decision and must not be bypassed by trying another key. ## Test and validation requirements `tests/integration/test_keyring.py` covers opening through each recipient alone, stream metadata, escrow fallback on provider failure and on `KEY_STATE_DENIED`, finality of other policy refusals, rotation that keeps the escrow recipient, migration, idempotent rewrap, audit attribution, and every configuration error. The contract test pins the constructor signature. ## Supersession rules Changes to the constructor require a further API RFC. Changes to the open fallback rules require format-lead and security-owner approval.