# Quorum recovery An escrow key held by one person makes that person able to read everything. A *quorum* recipient splits the data key among custodians so that any `threshold` of them can recover it together, and fewer learn nothing: split knowledge and dual control, as key-management standards such as PCI DSS require for recovery keys. The data key is split with Shamir secret sharing, and each share is wrapped with HPKE to one custodian's public key, classical or post-quantum hybrid. Each share is bound to its envelope, the quorum version, and its position, so shares cannot be moved between envelopes or swapped. Between 2 and 16 custodians are supported. ## Seal to a quorum Sealing needs only the custodians' public keys. Use the quorum as an additional recipient next to the everyday primary key: ```python from cryptography_suite import EncryptionContext, KeyRef, Policy, Protector from cryptography_suite.providers.hpke import HpkeRecipientProvider, generate_private_key from cryptography_suite.providers.quorum import DEFAULT_PROVIDER_ID, QuorumRecipientProvider cfo, ciso, counsel = (generate_private_key() for _ in range(3)) custodians = [cfo.public_key(), ciso.public_key(), counsel.public_key()] primary = HpkeRecipientProvider(provider_id="example.kms") # stands in for a key service primary_key = primary.add_identity("minutes", generate_private_key()) board = QuorumRecipientProvider() board.add_quorum("board", custodians, threshold=2) sealer = Protector( providers=[primary, board], policy=Policy(), primary_key=primary_key, additional_keys=[KeyRef(DEFAULT_PROVIDER_ID, "board")], ) context = EncryptionContext({"tenant": "acme"}, purpose="board-minutes") envelope = sealer.seal(b"board minutes, 2026-11-30", context=context) ``` ## Recover in a distributed ceremony In a ceremony, no custodian's private key leaves its owner. The coordinator holds only public keys and an ephemeral ceremony key; each custodian decrypts only their own share and re-encrypts it to the coordinator. Every message is JSON text, so it can travel by email, a ticket, or removable media. ```python from cryptography_suite import ProviderError from cryptography_suite.providers.quorum import RecoveryCeremony, release_share # Coordinator ceremony = RecoveryCeremony() coordinator = QuorumRecipientProvider(ceremony=ceremony) quorum_key = coordinator.add_quorum("board", custodians, threshold=2) reader = Protector(provider=coordinator, policy=Policy(), primary_key=quorum_key) try: reader.open(envelope, context=context) except ProviderError as error: print(error.code) # CAPABILITY_UNSUPPORTED: shares are needed requests = {request.index: request.to_json() for request in ceremony.requests()} # Read this to each custodian over a channel they trust, such as a call. fingerprint = ceremony.fingerprint # Each custodian, on their own machine, with their own key and the # fingerprint they were told released_by_cfo = release_share(requests[1], cfo, coordinator=fingerprint) released_by_counsel = release_share(requests[3], counsel, coordinator=fingerprint) # Coordinator ceremony.accept(released_by_cfo) ceremony.accept(released_by_counsel) assert reader.open(envelope, context=context) == b"board minutes, 2026-11-30" ceremony.close() # wipe the released shares ``` A request contains no secret: the custodian's encrypted share, the coordinator's ephemeral public key, a one-time token encrypted to the custodian, and a digest that identifies the envelope. Requests and responses may travel over channels nobody trusts: - A custodian releases only to the coordinator whose fingerprint they were given out of band, so an altered or forged request that names another key collects nothing. Check the fingerprint by a channel the request did not come through, and check what you are asked to release. - A release carries a MAC under the request's token, which only its custodian can decrypt. The coordinator refuses anything else before decrypting it, and the first authenticated release for a share stands. A released share is only as honest as its custodian. Recovery searches the released shares for a combination the integrity tag accepts, so one wrong release cannot block recovery once enough honest ones arrive. Each release inconsistent with the recovered key is listed in `ceremony.rejected`, and because releases are authenticated, it names the custodian who sent it: ```python assert ceremony.rejected == () ``` ## Recover in one process When the custodians are present together, register their private keys with the provider instead: ```python together = QuorumRecipientProvider() quorum_key = together.add_quorum("board", custodians, threshold=2) together.add_custodian_identity(ciso) together.add_custodian_identity(counsel) reader = Protector(provider=together, policy=Policy(), primary_key=quorum_key) assert reader.open(envelope, context=context) == b"board minutes, 2026-11-30" ``` ## Change the custodians A quorum version fixes its threshold and custodian set. Changing either adds a new version under the same name, and `rewrap` moves envelopes to it, just as with any key rotation: ```python new_custodian = generate_private_key() new_version = board.add_quorum( "board", [cfo.public_key(), counsel.public_key(), new_custodian.public_key()], threshold=2, ) moved = sealer.rewrap(envelope, destination_key=new_version) assert sealer.inspect(moved).recipients[1].version == new_version.version ``` Rewrapping needs one trusted key that can open the envelope: here the sealer's primary key, so no custodian is involved. ## Practice - Custodians keep their private keys offline, each protected by their own password (`private_key_pem`), or in a hardware token. - Hybrid custodian keys (`HpkeKem.MLKEM768_X25519`) keep the shares confidential against a future quantum adversary. - Rehearse the ceremony before you need it, and record who released what. - The GF(2^8) arithmetic uses table lookups. It runs only when sealing and recovering, and is not meant for machines where an attacker can time those operations at fine grain.