--- eip: 8525 title: FHE Interaction Framework description: Scopes, key contexts, disclosure views and records for interactions computed on fully homomorphically encrypted objects author: Gary Yang (@garyyang-finchip) discussions-to: https://ethereum-magicians.org/t/erc-8525-fhe-interaction-framework-fhe-if/30542 status: Draft type: Standards Track category: ERC created: 2026-11-28 requires: 165, 712, 1271 --- ## Abstract This proposal defines the FHE Interaction Framework (FHE-IF), a framework for interactions that are computed on fully homomorphically encrypted (FHE) objects: several parties submit, pass on, compute on and update protected objects, and information is released to named audiences on valid authority, under declared trust conditions and with recorded evidence. It is meant for computable confidential interaction, with shared protected state where an activity needs it. Subjects are accounts of any kind; autonomous agents are the main intended users. FHE-IF defines eight kinds of object: an activity scope, a crypto profile, a key context with its key epochs, a protected object, a policy version with its authorizer, an operation, a disclosure under a disclosure view, and an item of evidence. It defines two flows that are independent of each other. In the first, an operation is requested, admitted, executed on ciphertexts by a party that needs no decryption capability, and accepted, after which its outputs are objects that later operations may use while they stay encrypted. In the second, a disclosure of one object under one view to one audience is requested, authorized, and released by the holders of decryption capability, who check again at the moment of release that the release still stands. FHE-IF fixes how these objects are identified, bound to each other, authorized, recorded and refused. It does not fix an encryption scheme, parameters, a key generation protocol, a proof system or a place where ciphertexts are stored: those are declared by a profile and a key context, and the same rules apply whatever they declare. ## Motivation Encryption of stored and transmitted data ends where computation starts. A party that is to compute on data is given the data. FHE removes that step: a party computes on ciphertexts and the result is a ciphertext. Execution environments that do this for smart contracts exist, and each has its own handles, access lists and decryption service. What they do not share is a way to say which activity a ciphertext belongs to, who may move that activity forward, what counts as its state, and who may learn which part of it. Several problems repeat: 1. **Protection stops at the asset.** [ERC-7984](./eip-7984.md) defines confidential balances and transfers and leaves the resolution of its pointers to the implementation. [ERC-7627](./eip-7627.md) defines encrypted messages between two accounts, which the recipient decrypts before anything is done with them. Neither covers an interaction in which several parties keep computing on values that nobody decrypts on the way. 2. **Encrypted is taken for correct.** A scheme defines that a decryption equals the function of the inputs under stated conditions. It does not show that an executor nobody trusts ran the function it was asked to run. A ciphertext that an executor returns is a claim. 3. **A role is taken for a key.** Calling an account an auditor enforces nothing. Whoever holds a whole decryption key decrypts whatever was encrypted under it, on or off any ledger. Whether an account can read depends on where keys and shares are, and a framework that hides this behind role names misstates what it protects. 4. **Privacy is one switch.** Activities are called private or public. In practice a client may learn the result and not the losing offers, a finance function a total and not the items, an auditor an approved record, the public that something was concluded. These are different outputs for different audiences, and none of them includes another. 5. **Rules and keys change while work is in flight.** A member leaves, a rule is tightened, a key is rotated, an authorization is revoked after a request and before the decryption. Without stated rules, implementations decide differently whether a release still happens, and information that was released cannot be taken back. 6. **Schemes differ and will change.** Exact and approximate arithmetic, bits and integers, single keys, shared keys and several keys cannot be mixed by assuming that they agree. A framework has to let them be declared and has to treat "these do not belong together" as a result of its own. 7. **Execution privacy was left open.** [ERC-8338](./eip-8338.md) separates the encryption of a stored skill package from execution privacy and leaves the latter to later work. Agents that sell the use of a capability, or negotiate, bid and settle with each other, need the part that was left open. FHE-IF addresses these by making every step of such an interaction answer in full: in which scope, under which rules, with which key context and epoch, on which objects, by whom, with what evidence, and released as which view to whom. ## Specification The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119) and [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174). ### 1. Terms and scope | Term | Meaning | | --- | --- | | Subject | An account: externally owned or a contract. | | Activity scope | A declared range of activity: which objects, operations and disclosures belong together, under which rules. It has a controller and a status. | | Crypto profile | The semantic contract of one way of computing on protected objects: data semantics, encoding, programs, correctness conditions, limits, security, compatibility. | | Key context | An identified key arrangement under one profile: how the key is controlled, who can decrypt, where material is kept, what can be converted. | | Key epoch | One period of a key context, with its own public material, access structure and holders. | | Holder | An account that holds decryption capability of an epoch, such as a key or a share, and is recorded as such. | | Protected object | An input, a state or a result, known to the ledger by a commitment. | | Program | What an operation computes, identified by a hash. | | Operation | A request to carry out a program on named objects, with what became of it. | | Executor | The subject that carries out an operation and submits its result. | | Disclosure view | A definition of what a release contains: from which objects, by which program, with which complete output. | | Audience | The subject that receives a release, or everybody. | | Disclosure | A request to release one object under one view to one audience, with what became of it. | | Release | The act by which holders make the content of an object available to an audience. | | Evidence | A record of who supports which proposition about which object, operation or disclosure, and by what mechanism. | | Authorizer | The contract that answers, for one policy version, whether a subject holds a capability. | | Capability | A named power that the authorizer is asked about. | The following are out of scope: encryption schemes and their parameters, key generation and resharing protocols, proof systems, the encoding of ciphertexts, transport between parties, and where ciphertexts are kept. An organisation, a group or an economic unit is not an object of this framework. One organisation MAY take part in several scopes, one scope MAY span several organisations, and nothing is inherited from an organisation by a scope. Every time in this framework is a number of seconds since the Unix epoch and is compared with the timestamp of the block in which a call is executed. **Homomorphic evaluation.** A scheme in the sense of this framework offers encryption, evaluation of functions on ciphertexts, and decryption by those who hold the capability, such that under the conditions the profile states the decryption of an evaluated ciphertext stands in the stated relation to the function of the decrypted inputs. The relation MAY be exact or approximate. It need not be linear, dimension preserving or of equal cost for every function. An implementation MAY combine homomorphic evaluation with multi-party computation, trusted execution environments and proof systems. It MUST declare, stage by stage, what is visible to whom and on what trust. A stage that is declared as homomorphic evaluation MUST NOT require the party that evaluates to obtain the plaintext of the protected data of that stage. A computation that decrypts inside a trusted environment and computes there is not homomorphic evaluation and MUST NOT be declared as such. ### 2. Conformance A **registry** conforms if it implements `IFHEIFRegistry` and the rules of sections 3 and 5 to 8. A **ledger** conforms if it implements `IFHEIFLedger` and the rules of sections 3 and 9 to 11. An **authorizer** conforms if it implements `IFHEIFAuthorizer`. Each of them MUST implement [ERC-165](./eip-165.md) and report its interface. A **backend** is everything off the ledger that acts for a role: it encrypts, evaluates, holds shares, contributes to releases. A backend conforms to a profile if it meets the obligations that sections 5, 6, 8 and 9 place on executors, holders and submitters. An implementation states what it provides in a conformance statement, a document with four parts that are not levels of one another: | Part | States | | --- | --- | | Base | Which objects, bindings, states and failure semantics of this framework are implemented. | | Enforcement | For each action, by what it is enforced: separate keys, threshold shares, a restricted cryptographic capability, a trusted executor, or admission by the ledger only. | | Evidence | For each proposition, which mechanisms support it and whether it was verified, declared or not supported. | | Records | How disclosures are recorded, who can read the records, whether and how they are anchored, and what the records cannot show. | Declaring a mechanism states that it is used. It rates nothing and MUST NOT be presented as a security level. ### 3. Identifiers and documents A **well-known identifier** is the keccak256 hash of its name. The names of this version are: | Name | Identifier | | --- | --- | | `fheif.evaluation.homomorphic` | `0x99b27d5d8d71037d0ce2464deafa1e7cc6926750d89422b5aaa242bc7cf5cd4c` | | `fheif.evaluation.mixed` | `0xfc9fe000986a9eace9282dd58b9284a6a817916f6f81d1a3df2aba49074dd3fd` | | `fheif.evaluation.test-only` | `0x8b17b2aa51950da47a5c7ebf2ed2f08110e6da542ea274eb25410a6f6febf449` | | `fheif.record.open` | `0xad8211dc97da3c708acfad0a353f0b329afc67d662f31da7d5fb732aed91ec96` | | `fheif.record.committed` | `0x016793a6a230872889fcf1f68b6703faf63e770aeba48049e6a870e9c0df0fb8` | | `fheif.capability.submit-input` | `0xfa6845a78208cde5051c67c3538231a3d0488992caaeed611b141d2ba976447d` | | `fheif.capability.request-operation` | `0xcc3acc671c624a5a8d05ee86fc31fd485cdfcf1efcc8783c4d5429deb31e77c4` | | `fheif.capability.execute-operation` | `0x1db0dee6176a194e60ea048bf3248ad56d81b2c496026f9b1a2065de76c6990f` | | `fheif.capability.accept-result` | `0xe874d9661b47eefa946552f074efc90ec420059f3c1dd7e2dd35edde03150cc4` | | `fheif.capability.request-disclosure` | `0x1f6d7443457ee8bded32d67cae04766f6b42ba4518bbda775a7602c9a7873323` | | `fheif.capability.receive-view` | `0xb527c0fbe9032fa6ecd0e964a59c3e653aa2e4a630e4b927026eacc107d7c2a0` | | `fheif.capability.approve-disclosure` | `0x533f51358dac5c812c4365c214ef92b45e4297a26a7bc3cdb6774e39f52ccbde` | | `fheif.capability.anchor-record` | `0x28830fc50938ea27b76b50da907027dedfeb59f6293f18516c6e14463308095d` | | `fheif.program.identity` | `0x7d186de62dfe10c334edcbf708513a0223f5c87c48b84c1d1b438ad79105bff0` | | `fheif.proposition.input-well-formed` | `0x52945416baa3089895216f8d8fea8230bbe7fbb3806e990e91358bf63d1194ce` | | `fheif.proposition.input-constraint` | `0x24d9497f9057a089562e2093f9828ae4e46cf81b5eb7f7b02d697b42e4f617d9` | | `fheif.proposition.operation-correct` | `0x397cc438a372665cd6f67b22ca22c92d66e899846c12bf7bf2711fac50ec2eb5` | | `fheif.proposition.decryption-correct` | `0x270ea010eb643317af14848caaae6ebe77b2edf81dc6ede1598b6cce7114174a` | | `fheif.proposition.disclosure-authorized` | `0xc2abca58d1e999246e41aa1fdee53b5a4d76a818eb65d2daa7c8af8f8db4f2a9` | | `fheif.proposition.business-accepted` | `0x1bdd1341ab7d7e519961ba29db8a4ebbf4d6f6a7c90e255578ef3910e44cb4bd` | | `fheif.mechanism.none` | `0x33373e84e27b5746f0796b8adb5ba14af871d428cb7b7508b08db2f6bca14947` | | `fheif.mechanism.self-declared` | `0x93c9a6133ef24519d0d12974040237ce91f7be8de71e83a231de6ecc544d02ab` | | `fheif.mechanism.re-execution` | `0x3d1495cd201bd1e60d4c602b37a88cead3536f8f91062f8de5588bbbc9ed7dfa` | | `fheif.mechanism.committee` | `0x2fef02b33f8131cc8af99e4215f2839f283300f27bafa14724ffda1a75033787` | | `fheif.mechanism.zk-proof` | `0xd25d27ea1a7f46ce766ff1a8423f0c609fd3bb16acedff24124495b43e7cd620` | | `fheif.mechanism.tee-attestation` | `0x74961fe726905adfebe4def52301f9a48e2a29d00e76f375dd50445a8fb14be4` | | `fheif.mechanism.optimistic-challenge` | `0x97b8c429bdc0e913223c1f7f024550743e332fbb43eca261bfa221f469c982c7` | | `fheif.mechanism.designated-verifier` | `0x4f0993066b2f78f993c200096d02d1759796bbb6d55e6cd61ab4afc0799eda12` | | `fheif.mechanism.ledger-state` | `0xc5477f4a9b6c3ec3ad5a94a27774e1fb8cc0c289fa6836f158076fd284238bc9` | | `fheif.reason.unsupported` | `0x6541e855b2cb8dfca6e4d61bf4f424dd8bb1cd43cc6b08acbc91612a815cb9d5` | | `fheif.reason.incompatible` | `0x205dd04acf4788f2de697a99a2b53490c9169a4246c30d4b7c52a71105bd8df9` | | `fheif.reason.undeterminable` | `0x2980aec824bb5fa7ac610149cfcd20b62b61c93c1441601a46da84fda3b901b9` | | `fheif.reason.resource` | `0xd71fa39e8283e25effe4a146fafa2e41391416f2e55556a3f56b3c9966752e2a` | | `fheif.reason.expired` | `0xac5cabf6167fe1902fac0686957f320c722dd8451f382a829c491853d4cc7ef4` | | `fheif.reason.not-yet-valid` | `0xa2ade463ad4988cd84fe2369ed4ca2e38dc913374e54dcebf7062a3aa0418a05` | | `fheif.reason.scope-paused` | `0x0c60d7685fce5794d6b8e194b77a5eea475961b39cd4b0a9e6f9c8f6d2b21fb5` | | `fheif.reason.scope-closed` | `0xf6f4ff64cfa9caaeebf1ad73f4ef556a85b0bc92c26c4fbc8dff760be840c07d` | | `fheif.reason.policy-superseded` | `0x119061d828fe8cbb847b20e69bfc0e5b2a284dfc7b83d16bf23ed10d9c7a1640` | | `fheif.reason.epoch-not-usable` | `0x958eed76d73c7edbe12851ecfc08509b9a6d36edc422a1f7bfd7ce6116835366` | | `fheif.reason.view-retired` | `0x5a6a4048de5e9857b501fc7ab7c6e2a857d2a9f4b1f03a87062fae15548e24b4` | | `fheif.reason.not-authorized` | `0x0f364e0bd1f799cb78bf57bfee6eb92099255b6853134969860f401db7e5ea97` | | `fheif.record-kind.disclosure` | `0xc9673be361674d899dbb8a2c7cca1860a3482d4d27aea2c2a8b180ddcacbca8a` | | `fheif.record-kind.batch-root` | `0x72313916d89eccd96565b86e9bc1b5c25c8b73dfee3a103bd97368bcca4fc2a5` | The audience of a release to everybody is the address `0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF`. An identifier that is not listed MAY be used for classes of objects, programs, mechanisms, reasons and record kinds, formed in the same way from a name in a namespace of the party that defines it. A **document** is a JSON object with strings, integers, booleans, arrays and objects. Its hash is the keccak256 hash of its canonical form under [RFC 8785](https://www.rfc-editor.org/rfc/rfc8785). Documents are published by whoever declares them; the registry and the ledger hold their hashes. | Document | Schema | Hashed into | | --- | --- | --- | | Crypto profile | [`fheif-profile.schema.json`](../assets/eip-8525/schemas/fheif-profile.schema.json) | profile identifier | | Key context | [`fheif-key-context.schema.json`](../assets/eip-8525/schemas/fheif-key-context.schema.json) | descriptor of a key context | | Key material of an epoch | [`fheif-key-material.schema.json`](../assets/eip-8525/schemas/fheif-key-material.schema.json) | material hash of an epoch | | Access structure of an epoch | [`fheif-key-access.schema.json`](../assets/eip-8525/schemas/fheif-key-access.schema.json) | access hash of an epoch | | Activity scope | [`fheif-scope.schema.json`](../assets/eip-8525/schemas/fheif-scope.schema.json) | descriptor of a scope | | Policy version | [`fheif-policy.schema.json`](../assets/eip-8525/schemas/fheif-policy.schema.json) | policy hash | | Program | [`fheif-program.schema.json`](../assets/eip-8525/schemas/fheif-program.schema.json) | program hash | | View output | [`fheif-view-output.schema.json`](../assets/eip-8525/schemas/fheif-view-output.schema.json) | output hash of a view | | Conformance statement | [`fheif-conformance.schema.json`](../assets/eip-8525/schemas/fheif-conformance.schema.json) | not hashed on the ledger | Identifiers of objects are derived, so that any party can compute them before a transaction is sent. With `abi.encode` and `abi.encodePacked` as in Solidity: | Identifier | Value | | --- | --- | | Profile | `keccak256(abi.encode(descriptorHash, evaluationClass))` | | Key context | `keccak256(abi.encode(chainId, registry, creator, salt, "key-context"))` | | Scope | `keccak256(abi.encode(chainId, registry, creator, salt, "scope"))` | | View | `keccak256(abi.encode(scopeId, programHash, outputHash, keyContextId, keccak256(abi.encodePacked(inputClasses))))` | | Input object | `keccak256(abi.encode(ledger, scopeId, keyContextId, keyEpoch, classId, commitment, uint8(1), bytes32(uint256(uint160(submitter))), uint256(0)))` | | Output object | `keccak256(abi.encode(ledger, scopeId, keyContextId, outputEpoch, outputClass, commitment, uint8(2), operationId, index))` | | Operation | The [EIP-712](./eip-712.md) digest of the operation request under the domain of the ledger. | | Disclosure | The EIP-712 digest of the disclosure request under the domain of the ledger. | ### 4. Types ```solidity /// @notice Status of an activity scope. enum ScopeStatus { NONE, ACTIVE, PAUSED, CLOSED } /// @notice Status of one key epoch of a key context. /// ACTIVE accepts inputs, operation outputs and disclosures. RETIRED accepts no new objects; /// objects already accepted under it may still be disclosed or converted. REVOKED accepts nothing. enum EpochStatus { NONE, ACTIVE, RETIRED, REVOKED } /// @notice What a new key epoch declares about objects of the epoch before it. /// RETAIN keeps them under the earlier epoch. CONVERT permits operations that take inputs of the /// earlier epoch and produce outputs of the new one. RESET revokes the earlier epoch. enum CarryOver { NONE, RETAIN, CONVERT, RESET } /// @notice What a policy version lets later versions do with objects accepted under it. /// NARROW_ONLY: a later version can only take authority away. GOVERN: a later version decides alone. enum SuccessorRight { NARROW_ONLY, GOVERN } enum ObjectOrigin { NONE, INPUT, OUTPUT } enum ObjectStatus { NONE, PROPOSED, ACCEPTED, REJECTED } enum OperationStatus { NONE, ADMITTED, RESULT_SUBMITTED, ACCEPTED, REJECTED, FAILED, CANCELLED, EXPIRED } enum DisclosureStatus { NONE, REQUESTED, AUTHORIZED, RELEASED, REFUSED, EXPIRED } /// @notice A crypto profile: the semantic contract of one way of computing on protected objects. struct Profile { bytes32 descriptorHash; bytes32 evaluationClass; address registrant; uint64 registeredAt; } /// @notice A key context. Its key material, access structure and holders are those of its epochs. struct KeyContext { bytes32 profileId; address controller; bytes32 descriptorHash; uint32 currentEpoch; } /// @notice What is declared when a key epoch is opened. struct EpochInit { bytes32 materialHash; bytes32 accessHash; uint16 releaseQuorum; address[] holders; } struct KeyEpoch { bytes32 materialHash; bytes32 accessHash; uint16 releaseQuorum; uint16 holderCount; EpochStatus status; CarryOver carryOver; uint64 openedAt; } struct PolicyInit { bytes32 policyHash; address authorizer; SuccessorRight successorRight; } struct Policy { bytes32 policyHash; address authorizer; SuccessorRight successorRight; uint64 activatedAt; } struct Scope { address controller; bytes32 descriptorHash; bytes32 recordMode; uint64 policyVersion; ScopeStatus status; } /// @notice A disclosure view: what a release under it contains, and from what it is computed. struct ViewDefinition { bytes32 scopeId; bytes32 programHash; bytes32 outputHash; bytes32 keyContextId; uint64 policyVersion; bool retired; bytes32[] inputClasses; } struct InputSubmission { bytes32 scopeId; bytes32 keyContextId; uint32 keyEpoch; bytes32 classId; bytes32 commitment; string locator; } struct OutputSubmission { bytes32 commitment; string locator; } struct ProtectedObject { bytes32 scopeId; bytes32 keyContextId; uint32 keyEpoch; bytes32 classId; bytes32 viewId; bytes32 commitment; bytes32 originId; address submitter; uint64 policyVersion; ObjectOrigin origin; ObjectStatus status; } /// @notice An operation request. Its EIP-712 digest is the operation identifier. struct OperationRequest { bytes32 scopeId; uint64 policyVersion; bytes32 keyContextId; uint32 inputEpoch; uint32 outputEpoch; bytes32 programHash; bytes32 viewId; bytes32 outputClass; bytes32[] inputs; address requester; address executor; uint256 nonce; uint64 validUntil; } struct Operation { OperationRequest request; OperationStatus status; address submittedBy; bytes32[] outputs; } /// @notice A disclosure request. Its EIP-712 digest is the disclosure identifier. struct DisclosureRequest { bytes32 scopeId; bytes32 objectId; bytes32 viewId; bytes32 keyContextId; uint32 keyEpoch; uint64 policyVersion; address audience; bytes32 deliveryKeyHash; address requester; uint256 nonce; uint64 validAfter; uint64 validUntil; } struct Disclosure { DisclosureRequest request; DisclosureStatus status; uint16 approvalsRequired; uint16 approvals; uint16 attestations; } /// @notice One piece of evidence: who supports which proposition about which subject, and how. struct Evidence { bytes32 proposition; bytes32 mechanism; address attester; bytes32 payloadHash; uint64 recordedAt; } struct Anchor { bytes32 scopeId; bytes32 recordKind; address anchoredBy; uint64 anchoredAt; } /// @notice Well-known identifiers. Each is the keccak256 hash of the string shown. library FHEIF { // Evaluation classes of a profile. bytes32 internal constant EVAL_HOMOMORPHIC = keccak256("fheif.evaluation.homomorphic"); bytes32 internal constant EVAL_MIXED = keccak256("fheif.evaluation.mixed"); bytes32 internal constant EVAL_TEST_ONLY = keccak256("fheif.evaluation.test-only"); // Record modes of a scope. bytes32 internal constant RECORD_OPEN = keccak256("fheif.record.open"); bytes32 internal constant RECORD_COMMITTED = keccak256("fheif.record.committed"); // Capabilities resolved by the authorizer of a policy version. bytes32 internal constant CAP_SUBMIT_INPUT = keccak256("fheif.capability.submit-input"); bytes32 internal constant CAP_REQUEST_OPERATION = keccak256("fheif.capability.request-operation"); bytes32 internal constant CAP_EXECUTE_OPERATION = keccak256("fheif.capability.execute-operation"); bytes32 internal constant CAP_ACCEPT_RESULT = keccak256("fheif.capability.accept-result"); bytes32 internal constant CAP_REQUEST_DISCLOSURE = keccak256("fheif.capability.request-disclosure"); bytes32 internal constant CAP_RECEIVE_VIEW = keccak256("fheif.capability.receive-view"); bytes32 internal constant CAP_APPROVE_DISCLOSURE = keccak256("fheif.capability.approve-disclosure"); bytes32 internal constant CAP_ANCHOR_RECORD = keccak256("fheif.capability.anchor-record"); // The program of a view that releases an object as it is. bytes32 internal constant PROGRAM_IDENTITY = keccak256("fheif.program.identity"); // The audience of a release that is open to everybody. address internal constant AUDIENCE_PUBLIC = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF; // Propositions an item of evidence can support. bytes32 internal constant PROP_INPUT_WELL_FORMED = keccak256("fheif.proposition.input-well-formed"); bytes32 internal constant PROP_INPUT_CONSTRAINT = keccak256("fheif.proposition.input-constraint"); bytes32 internal constant PROP_OPERATION_CORRECT = keccak256("fheif.proposition.operation-correct"); bytes32 internal constant PROP_DECRYPTION_CORRECT = keccak256("fheif.proposition.decryption-correct"); bytes32 internal constant PROP_DISCLOSURE_AUTHORIZED = keccak256("fheif.proposition.disclosure-authorized"); bytes32 internal constant PROP_BUSINESS_ACCEPTED = keccak256("fheif.proposition.business-accepted"); // Mechanisms by which a proposition is supported. bytes32 internal constant MECH_NONE = keccak256("fheif.mechanism.none"); bytes32 internal constant MECH_SELF_DECLARED = keccak256("fheif.mechanism.self-declared"); bytes32 internal constant MECH_REEXECUTION = keccak256("fheif.mechanism.re-execution"); bytes32 internal constant MECH_COMMITTEE = keccak256("fheif.mechanism.committee"); bytes32 internal constant MECH_ZK_PROOF = keccak256("fheif.mechanism.zk-proof"); bytes32 internal constant MECH_TEE_ATTESTATION = keccak256("fheif.mechanism.tee-attestation"); bytes32 internal constant MECH_OPTIMISTIC_CHALLENGE = keccak256("fheif.mechanism.optimistic-challenge"); bytes32 internal constant MECH_DESIGNATED_VERIFIER = keccak256("fheif.mechanism.designated-verifier"); bytes32 internal constant MECH_LEDGER_STATE = keccak256("fheif.mechanism.ledger-state"); // Reasons given when an operation fails or a request can no longer proceed. bytes32 internal constant REASON_UNSUPPORTED = keccak256("fheif.reason.unsupported"); bytes32 internal constant REASON_INCOMPATIBLE = keccak256("fheif.reason.incompatible"); bytes32 internal constant REASON_UNDETERMINABLE = keccak256("fheif.reason.undeterminable"); bytes32 internal constant REASON_RESOURCE = keccak256("fheif.reason.resource"); bytes32 internal constant REASON_EXPIRED = keccak256("fheif.reason.expired"); bytes32 internal constant REASON_NOT_YET_VALID = keccak256("fheif.reason.not-yet-valid"); bytes32 internal constant REASON_SCOPE_PAUSED = keccak256("fheif.reason.scope-paused"); bytes32 internal constant REASON_SCOPE_CLOSED = keccak256("fheif.reason.scope-closed"); bytes32 internal constant REASON_POLICY_SUPERSEDED = keccak256("fheif.reason.policy-superseded"); bytes32 internal constant REASON_EPOCH_NOT_USABLE = keccak256("fheif.reason.epoch-not-usable"); bytes32 internal constant REASON_VIEW_RETIRED = keccak256("fheif.reason.view-retired"); bytes32 internal constant REASON_NOT_AUTHORIZED = keccak256("fheif.reason.not-authorized"); // Kinds of record that can be anchored by commitment. bytes32 internal constant KIND_DISCLOSURE_RECORD = keccak256("fheif.record-kind.disclosure"); bytes32 internal constant KIND_BATCH_ROOT = keccak256("fheif.record-kind.batch-root"); } ``` ### 5. Crypto profiles A profile is registered by its descriptor hash and an evaluation class. Anybody MAY register a profile. A registered profile never changes; a changed descriptor is another profile. The evaluation class is one of: | Class | Meaning | | --- | --- | | `fheif.evaluation.homomorphic` | Every operation under the profile is homomorphic evaluation in the sense of section 1. | | `fheif.evaluation.mixed` | Some stages are not. The descriptor MUST list the stages and mark each one in which protected data is visible in plaintext, with the party it is visible to and the trust it rests on. | | `fheif.evaluation.test-only` | The profile protects nothing. It exists to exercise flows. A consumer MUST NOT treat objects of such a profile as confidential. | A profile descriptor MUST state: | Dimension | Content | | --- | --- | | Data semantics | Exact or approximate; the type of values; encoding, scaling and packing; the range of inputs; behaviour on overflow and reduction; for approximate values, what an error means. | | Programs | Which operations are supported and how a program, circuit or model version is identified. | | Correctness conditions | For which inputs, parameters and extent of computation the stated relation holds; what is known about the probability of failure or the confidence of an error bound. These are stated apart from data semantics: an exact scheme can fail to decrypt correctly, and an approximate one can give a bound that holds with a stated probability. | | Limits | Depth, resources, time, and what refresh or conversion is available. | | Security | Parameters; the attack model they are chosen for; the model under which decrypted results may be released and the protection that model requires; whether inputs are proven well formed; whether an output hides how it was computed. | | Compatibility | Which keys, parameters, encodings and versions of an implementation can be combined. | | Evidence | For each proposition of section 9.5 that the profile supports, the mechanism, what is compared, and when two results count as the same. | The following rules apply to every backend: - An object, key or request of a profile that a party does not know MUST be recognised as unknown and refused. - Objects of different profiles, key contexts or key epochs MUST NOT be treated as compatible unless a conversion is declared for them. A conversion needs a declared mechanism, an authorization and stated semantics. - A backend MUST NOT fall back to a weaker protection without failing. - Where a party cannot determine whether a protected operation is supported or was carried out correctly, the result is "unsupported" or "undeterminable". It is never a success. - A failure that is detected is reported as a failure. A profile MUST NOT claim that every incorrect result is detected unless it states the mechanism that detects it. A profile distinguishes three sources of error and MUST NOT present one as covering another: the difference between an original model or function and the program it was turned into, the error of the encrypted computation itself, and the error of the model with respect to the world. Evidence that a program was carried out says nothing about the other two. ### 6. Key contexts and key epochs A key context is identified, has a controller and belongs to one profile. A number of an epoch alone identifies nothing: a reference to key material is always the pair of key context and epoch. A key context descriptor MUST state, as four separate things that can be combined freely: | Dimension | Examples | | --- | --- | | Control of the key | Generated by one party; generated jointly so that no party holds the whole key; generated in a trusted environment. | | Access structure of decryption | One holder; all of n holders; t of n holders; a structure with several keys in which each input has its own. | | Custody and execution environment | Holders keep their own shares; a service keeps the shares; shares are kept in trusted environments. | | Conversion | None; key switching between named epochs; re-encryption towards a named recipient key. | A descriptor MUST state by what each boundary it claims is enforced. Two different numbers of approvals or of holders written into a policy over one key give no different cryptographic thresholds: where a difference is claimed, the descriptor MUST say whether it rests on separate key contexts, on a special access structure or on the policy of a service. A structure in which one key can derive another exists only where the profile declares the construction; it is never assumed. Key material is of five kinds, and holding one implies nothing about another: | Material | Used to | Is not | | --- | --- | --- | | Signing key of a subject | Show who made a request or gave an authorization. | A capability to decrypt. | | Public encryption key | Put an input under a key context. | A right to read. | | Evaluation material | Carry out the declared operations and conversions. | A decryption key. | | Decryption key or share | Decrypt alone or together with others. | The rules about who may ask for a release. | | Delivery key of an audience | Receive what a release makes available to that audience only. | A capability to decrypt anything else. | Public keys and evaluation material that the profile allows to be public MAY be published. A decryption key or a share MUST NOT be published in the clear. Where and how sealed secret material is kept is stated by the descriptor. **Epochs.** An epoch has a material hash, an access hash, a set of holders, a release quorum and a status: | Status | New inputs and outputs | Release of its objects | Input to a declared conversion | | --- | --- | --- | --- | | `ACTIVE` | yes | yes | no | | `RETIRED` | no | yes | yes | | `REVOKED` | no | no | no | Opening an epoch declares what becomes of the objects of the epoch before it: `RETAIN` (they stay under the earlier epoch, which is retired), `CONVERT` (as `RETAIN`, and operations that take inputs of the earlier epoch and produce outputs of the new one are admitted), or `RESET` (the earlier epoch is revoked). Incrementing a number is not a rotation: a new epoch MUST carry the hash of its own material and its own holders, and a backend MUST generate that material anew. The following are separate and change independently of each other: the key epoch, the policy version, the source of membership or qualification that an authorizer reads, and time. Adding a subject that may receive one view does not require a new epoch. A subject that controls a scope, a subject that controls a key context and a holder are three roles. None implies another. A subject that takes part in the activity of a scope is not thereby a holder, and a holder that leaves the activity keeps the shares of the epochs it was a holder of. That a subject can no longer read later objects is true only from an epoch whose material was generated without it. ### 7. Scopes, policy versions and capabilities A scope has a controller, a descriptor, a record mode, a current policy version and a status: `ACTIVE`, `PAUSED` or `CLOSED`. A closed scope does not reopen. A scope admits the key contexts whose objects it accepts; a key context MAY be admitted by several scopes and a scope MAY admit several key contexts. The descriptor of a scope MUST declare what the scope exposes, surface by surface: who takes part; inputs; intermediate state; outputs; programs and models; timing, counts and the linkage of requests; and in which form anything public is public. A single statement that a scope is private is not a declaration. Fields of ledger records are public; a scope that needs them hidden MUST use the committed record mode of section 9.6 or a mechanism it names, and MUST NOT rely on a label. **Policy versions.** A policy version consists of the hash of a policy document, the address of an authorizer and a successor right. The controller of a scope activates the next version. Earlier versions remain readable. An object is bound, when it is accepted, to the policy version in force. For authority over an object that was accepted under an earlier version: - if that earlier version has the successor right `NARROW_ONLY`, a subject holds a capability only if the authorizer of the earlier version and the authorizer of the current version both say so, and the number of approvals a release needs is the higher of the two; - if it has the successor right `GOVERN`, the current version decides alone. A later version therefore cannot widen who may compute on, request or receive what was accepted before it, unless the version under which it was accepted reserved that from the start. A new authorization that the rules of the earlier version provide for remains possible, because the authorizer of the earlier version gives it. **Capabilities.** The ledger asks the authorizer of a policy version whether a subject holds a capability with respect to a class of objects and a resource: | Capability | Asked when | Resource | | --- | --- | --- | | `fheif.capability.submit-input` | an input is registered | zero | | `fheif.capability.request-operation` | an operation is requested, once for every input | program hash | | `fheif.capability.execute-operation` | a result is submitted or a failure is reported | program hash | | `fheif.capability.accept-result` | a result is accepted or rejected | program hash | | `fheif.capability.request-disclosure` | a disclosure is requested, and again at release | view identifier | | `fheif.capability.receive-view` | a disclosure is requested, and again at release; asked of the audience | view identifier | | `fheif.capability.approve-disclosure` | a disclosure is approved or refused | view identifier | | `fheif.capability.anchor-record` | a commitment is anchored | record kind | No capability includes another. Controlling a scope, controlling a key context, being a holder, executing, approving and receiving are separate. Reading is always expressed as a view over a class of objects; an output of one round that becomes an input of the next does not change who may read it. An identity, a credential, a membership, a listing or a decision of a group MAY be what an authorizer reads to reach its answer. None of them is a capability by itself, and none of them gives decryption capability. What is public needs no capability to be observed or verified. The capability to execute concerns what the ledger admits. Where evaluation material is public, anybody can compute on ciphertexts off the ledger, and this framework does not claim otherwise; only an admitted and accepted result is an object of the scope. An authorizer that lets a capability be passed on MUST allow it only in a form that is the same or narrower, and MUST refuse where it cannot decide that the form is narrower. ```solidity /// @title FHE Interaction Framework: authorizer of a policy version /// @notice Answers, for one policy version of one scope, whether a subject holds a capability. /// How the answer is reached (a table of grants, a membership list, a credential, a proof, a /// decision of a group) is the authorizer's own business. The ledger asks and never assumes. interface IFHEIFAuthorizer { /// @notice Whether `subject` holds `capability` over objects of `classId` with respect to `resource`. /// @param scopeId The activity scope. /// @param policyVersion The policy version the answer is given for. /// @param subject The account asked about. For a release open to everybody it is the public audience address. /// @param capability One of the capability identifiers. /// @param classId The class of the object concerned, or zero when no object is concerned. /// @param resource The program hash for operation capabilities, the view identifier for disclosure /// capabilities, the record kind for anchoring, or zero. function isAuthorized( bytes32 scopeId, uint64 policyVersion, address subject, bytes32 capability, bytes32 classId, bytes32 resource ) external view returns (bool); /// @notice How many separate approvals a release of `viewId` over an object of `classId` to /// `audience` needs before it is authorized. Zero means none. function requiredApprovals(bytes32 scopeId, uint64 policyVersion, bytes32 classId, bytes32 viewId, address audience) external view returns (uint256); } ``` **Registry interface.** ```solidity /// @title FHE Interaction Framework: registry of profiles, key contexts, scopes and views interface IFHEIFRegistry { event ProfileRegistered( bytes32 indexed profileId, bytes32 descriptorHash, bytes32 indexed evaluationClass, address indexed registrant, string uri ); event KeyContextCreated( bytes32 indexed keyContextId, bytes32 indexed profileId, address indexed controller, bytes32 descriptorHash, string uri ); event KeyContextControlTransferred(bytes32 indexed keyContextId, address indexed previous, address indexed next); event EpochOpened( bytes32 indexed keyContextId, uint32 indexed epoch, bytes32 materialHash, bytes32 accessHash, uint16 releaseQuorum, address[] holders, CarryOver carryOver ); event EpochStatusChanged(bytes32 indexed keyContextId, uint32 indexed epoch, EpochStatus status); event ScopeCreated( bytes32 indexed scopeId, address indexed controller, bytes32 descriptorHash, bytes32 recordMode, string uri ); event ScopeControlTransferred(bytes32 indexed scopeId, address indexed previous, address indexed next); event ScopeStatusChanged(bytes32 indexed scopeId, ScopeStatus status); event PolicyActivated( bytes32 indexed scopeId, uint64 indexed version, bytes32 policyHash, address indexed authorizer, SuccessorRight successorRight ); event KeyContextAdmitted(bytes32 indexed scopeId, bytes32 indexed keyContextId); event KeyContextDismissed(bytes32 indexed scopeId, bytes32 indexed keyContextId); event ViewDefined( bytes32 indexed viewId, bytes32 indexed scopeId, bytes32 indexed programHash, bytes32 outputHash, bytes32 keyContextId, bytes32[] inputClasses, uint64 policyVersion ); event ViewRetired(bytes32 indexed viewId); error ZeroValue(); error AlreadyExists(bytes32 id); error UnknownProfile(bytes32 profileId); error UnknownKeyContext(bytes32 keyContextId); error UnknownEpoch(bytes32 keyContextId, uint32 epoch); error UnknownScope(bytes32 scopeId); error UnknownView(bytes32 viewId); error NotController(address caller); error InvalidHolders(); error InvalidCarryOver(); error InvalidEpochStatus(EpochStatus status); error InvalidScopeStatus(ScopeStatus status); error KeyContextNotAdmitted(bytes32 scopeId, bytes32 keyContextId); // Profiles /// @notice Registers a crypto profile. The identifier binds the descriptor to its evaluation class. function registerProfile(bytes32 descriptorHash, bytes32 evaluationClass, string calldata uri) external returns (bytes32 profileId); function profileOf(bytes32 profileId) external view returns (Profile memory); // Key contexts /// @notice Creates a key context under `profileId` and opens its first epoch. The caller controls it. function createKeyContext( bytes32 salt, bytes32 profileId, bytes32 descriptorHash, string calldata uri, EpochInit calldata firstEpoch ) external returns (bytes32 keyContextId); /// @notice Opens the next epoch. The epoch before it becomes RETIRED, or REVOKED under RESET. function openEpoch(bytes32 keyContextId, EpochInit calldata init, CarryOver carryOver) external returns (uint32 epoch); /// @notice Revokes an ACTIVE or RETIRED epoch. Nothing proceeds under a revoked epoch. function revokeEpoch(bytes32 keyContextId, uint32 epoch) external; function transferKeyContextControl(bytes32 keyContextId, address next) external; function keyContextOf(bytes32 keyContextId) external view returns (KeyContext memory); function epochOf(bytes32 keyContextId, uint32 epoch) external view returns (KeyEpoch memory); /// @notice Whether `account` may attest releases under `epoch`. function isHolder(bytes32 keyContextId, uint32 epoch, address account) external view returns (bool); // Scopes and policy versions /// @notice Creates an activity scope with its first policy version. The caller controls it. function createScope( bytes32 salt, bytes32 descriptorHash, string calldata uri, bytes32 recordMode, PolicyInit calldata firstPolicy ) external returns (bytes32 scopeId); /// @notice Activates the next policy version of a scope. function updatePolicy(bytes32 scopeId, PolicyInit calldata next) external returns (uint64 version); function pauseScope(bytes32 scopeId) external; function resumeScope(bytes32 scopeId) external; /// @notice Closes a scope. A closed scope does not reopen. function closeScope(bytes32 scopeId) external; function transferScopeControl(bytes32 scopeId, address next) external; function admitKeyContext(bytes32 scopeId, bytes32 keyContextId) external; function dismissKeyContext(bytes32 scopeId, bytes32 keyContextId) external; function scopeOf(bytes32 scopeId) external view returns (Scope memory); function policyOf(bytes32 scopeId, uint64 version) external view returns (Policy memory); function isKeyContextAdmitted(bytes32 scopeId, bytes32 keyContextId) external view returns (bool); // Disclosure views /// @notice Defines a disclosure view of a scope. The identifier is derived from every argument. function defineView( bytes32 scopeId, bytes32 programHash, bytes32 outputHash, bytes32 keyContextId, bytes32[] calldata inputClasses ) external returns (bytes32 viewId); /// @notice Retires a view. No release proceeds under a retired view. function retireView(bytes32 viewId) external; function viewOf(bytes32 viewId) external view returns (ViewDefinition memory); } ``` ### 8. Disclosure views Who may learn what is expressed first as an output and then as a release of that output. A disclosure view is defined by the controller of a scope and binds: - the scope and the policy version at definition; - the range of inputs, as classes of objects; - the program, by hash; - the complete output, by the hash of a view output document that states the layout, what the output contains, what it leaves out and, for approximate values, its precision; - the key context. The audience, conditions and validity of a release are not part of a view. They are bound by the authorization and by the disclosure request. "Public" is an audience, not a form of output: the same view can be released to one subject or to everybody. A view is realised in one of two ways: - **Computed view.** An operation names the view. Its program MUST be the program of the view and every input MUST be of a class in the range of the view. Its accepted output is an object that carries the view identifier, and only such an object can be released under the view. - **Identity view.** The program of the view is `fheif.program.identity`. An accepted object of a class in the range of the view can be released under it as it is. The identity view is a view like any other. No subject holds it by rank: the controller of a scope and the controller of a key context have it only if the authorizer says so. A release makes available one whole object. A view therefore bounds everything its audience can decrypt: - A backend MUST NOT deliver to an audience contributions for an object that holds more than the output the view states and rely on the audience or on a user interface to show less. - Where a scheme packs several values into one ciphertext, the positions outside the stated layout of a view output MUST be cleared, isolated or re-encapsulated as the profile states, so that they carry nothing of the inputs. A permitted output can reveal an input. A view whose program is chosen by the requester can be the identity, and sums that differ in one input give that input. A policy that allows a view SHOULD bound which views exist over a class, who may receive them, how often, and under which conditions of aggregation; a limit on the information released over several requests MAY be declared as part of a policy. ### 9. Objects, operations, disclosures, evidence and records #### 9.1 Protected objects An object is known to the ledger by a commitment to its content. This framework does not require a ciphertext to be on the ledger and does not forbid it: where an object is obtained, how long it is available and how its integrity is checked against the commitment are stated by the profile. A party MUST check an object against its commitment before it uses it. An input is registered by a subject that holds the capability for its class, under an admitted key context and an `ACTIVE` epoch, and is accepted on registration. An output is proposed when a result is submitted and becomes accepted when the result is accepted. Only an accepted object can be an input of an operation or the object of a disclosure. An accepted object stays bound to its scope, key context, key epoch, class, view and policy version. #### 9.2 Operations An operation is identified before it is computed. Its request binds the scope, the policy version, the key context, the epoch of its inputs and of its outputs, the program, the view if its output is a view output, the class of its outputs, its inputs, the requester, the executor or zero for any authorized executor, a nonce and the time until which it is valid. A ledger MUST admit a request only if all of the following hold, and MUST revert otherwise: 1. the identifier was not used before; 2. the scope is `ACTIVE`, the named policy version is the current one and the time of validity has not passed; 3. the key context is admitted by the scope and the epoch of the outputs is `ACTIVE`; 4. the epoch of the inputs equals that of the outputs, or the epoch of the outputs directly follows it, was opened with `CONVERT`, and the epoch of the inputs is `RETIRED`; 5. a named view belongs to the scope, is not retired, has the named key context and the named program; 6. every input is accepted, belongs to the scope, and has the named key context and input epoch; and, where a view is named, a class in its range; 7. the requester holds `fheif.capability.request-operation` for the program over every input, under the rule of section 7 for objects of earlier versions. | Status | Reached by | Meaning | | --- | --- | --- | | `ADMITTED` | request | The ledger admitted the request. Nothing was computed. | | `RESULT_SUBMITTED` | the executor | Outputs were proposed. They are a claim of the executor. | | `ACCEPTED` | a subject with `fheif.capability.accept-result` | The outputs are objects of the scope. | | `REJECTED` | the same capability | The outputs are rejected. | | `FAILED` | the executor | The executor reports, with a reason, that it cannot carry the operation out. | | `CANCELLED` | the requester, before a result | The request is withdrawn. | | `EXPIRED` | anybody | The operation can no longer be completed: its time passed, its scope closed, its policy version was superseded, or its output epoch is no longer `ACTIVE`. | Submitting a result and accepting it need the scope to be `ACTIVE`, the policy version of the request to be current, the time of validity not to have passed and the output epoch to be `ACTIVE`. An operation in flight when a policy version is superseded cannot be completed and is requested again under the new version. A pause holds an operation and a resume lets it continue. An executor MUST act only on an operation that the ledger admitted, MUST carry out the program the request names on the objects it names, and MUST report a failure where it cannot. That a result was submitted says nothing about its correctness; what an acceptor requires before it accepts is stated by the policy and supported by evidence. #### 9.3 Disclosures A disclosure request binds the scope, the object, the view, the key context and epoch of the object, the policy version, the audience, the hash of the delivery key of the audience or zero, the requester, a nonce, and the times from which and until which it is valid. A ledger in the open record mode MUST record a request only if all of the following hold, and MUST revert otherwise: 1. the identifier was not used before; 2. the scope is `ACTIVE`, its record mode is open, the named policy version is the current one, and the time until which the request is valid has not passed; 3. the object is accepted, belongs to the scope, and has the named key context and epoch, and that epoch is `ACTIVE` or `RETIRED`; 4. the view belongs to the scope, is not retired and has the key context of the object; and the object carries the view identifier, or the view is an identity view and the class of the object is in its range; 5. the requester holds `fheif.capability.request-disclosure` and the audience holds `fheif.capability.receive-view` for the view over the class of the object, under the rule of section 7 for objects of earlier versions. A request that binds another object, scope, key context, epoch, view or policy version than the one it is used for is a different request. A holder MUST NOT contribute to a decryption of anything but the object of a recorded disclosure, and MUST NOT treat a ciphertext as legitimate because it can be loaded or decrypted. | Status | Reached by | Meaning | | --- | --- | --- | | `REQUESTED` | request, where approvals are required | Waits for approvals. | | `AUTHORIZED` | request where none are required, or the last required approval | Holders may release. | | `RELEASED` | the attestation that completes the release quorum of the epoch | Final. Never changed. | | `REFUSED` | a subject with `fheif.capability.approve-disclosure`; or anybody, once the request can never be released | Final. | | `EXPIRED` | anybody, after the time until which the request was valid | Final. | The number of approvals a release needs is given by the authorizer. An approval is given by a subject that holds `fheif.capability.approve-disclosure`. Approving a release, controlling a key context and holding a share are three powers. **Release.** A holder attests on the ledger that it contributes. The ledger MUST refuse an attestation unless, in the block of the attestation: - the disclosure is `AUTHORIZED`; - the scope is `ACTIVE` and the policy version of the request is current; - the epoch is `ACTIVE` or `RETIRED`, the key context is admitted and the view is not retired; - the time is within the validity of the request; - the requester and the audience still hold their capabilities; - the caller is a holder of the epoch of the object and has not attested before. Authority is thus checked at the release, by every holder, and not only at the request. A revocation, an expiry, a retired view, a revoked epoch, a superseded policy version or a closed scope that comes after the request and before the quorum ends the release; a pause holds it. A request that was approved, a contribution that was computed, a delivery that reached the audience and content that the audience read are different facts, and a record states only the one it shows. A holder: - MUST contribute only after its own attestation is included, and SHOULD wait until the block is final under the rule the scope declares, since a reorganisation changes the ledger and does not make released content unknown again; - MUST deliver its contribution so that only the audience of the request can use it, to the delivery key the request committed to; for a release to everybody it MAY publish it; - MUST apply the protection the profile requires for released results. What was released stays released. A revocation ends requests that were not yet released, and later objects where a later epoch excludes a subject. It does not recall content, and it does not remove a share or a key from whoever holds it. #### 9.4 Signed requests A request MAY be submitted by its requester or by anybody together with a signature of the requester over the EIP-712 typed data of the request. The domain has the name `FHE Interaction Framework`, the version `1`, the chain identifier and the address of the ledger. The types are: ```text OperationRequest(bytes32 scopeId,uint64 policyVersion,bytes32 keyContextId,uint32 inputEpoch,uint32 outputEpoch,bytes32 programHash,bytes32 viewId,bytes32 outputClass,bytes32[] inputs,address requester,address executor,uint256 nonce,uint64 validUntil) DisclosureRequest(bytes32 scopeId,bytes32 objectId,bytes32 viewId,bytes32 keyContextId,uint32 keyEpoch,uint64 policyVersion,address audience,bytes32 deliveryKeyHash,address requester,uint256 nonce,uint64 validAfter,uint64 validUntil) ``` EIP-712 gives no protection against replay. In this framework the digest is the identifier of the request, a ledger MUST refuse an identifier that was used, the domain binds the request to one ledger on one chain, and the request carries its own validity. For a requester that is a contract, the ledger MUST verify the signature through [ERC-1271](./eip-1271.md). The answer of a contract can depend on its state and on time, so two cases are kept apart: - A signature that carries a request that is not yet admitted is verified when it is submitted, against the signer as it is then. - A request that was admitted stands by the record of the ledger. It is not verified against the signer again, and it ends by its own validity and by the rules of sections 9.2 and 9.3. #### 9.5 Evidence Evidence is recorded per proposition. A record names its subject, a proposition, a mechanism, the attester, a hash of the supporting material and the time. | Proposition | States | | --- | --- | | `fheif.proposition.input-well-formed` | An input has the form the profile requires. | | `fheif.proposition.input-constraint` | An input satisfies a stated constraint, such as a range or an eligibility. | | `fheif.proposition.operation-correct` | The outputs are the named program applied to the named inputs. | | `fheif.proposition.decryption-correct` | Released content stands in the declared relation to the object. | | `fheif.proposition.disclosure-authorized` | A release complied with the policy in force. | | `fheif.proposition.business-accepted` | A consumer accepts a result by its own rules. | Mechanisms are open. This version names: none, self-declared, re-execution, committee, zero-knowledge proof, attestation of a trusted execution environment, optimistic challenge, designated verifier, and the state of the ledger itself. - One subject MAY carry several records, for several propositions and by several mechanisms. There is no single flag that states that something is verified, and a ledger MUST NOT derive one. - A statement that there is no evidence, and a self-declaration, are recorded as what they are. They MUST NOT be presented as a verification. - Recording evidence changes no state of an operation or a disclosure. - A profile that names re-execution MUST state what is compared and when two results are the same. Equal bytes of ciphertexts are such a rule only where the profile establishes that a correct evaluation is deterministic. - A profile that names optimistic challenge MUST state what a challenger can obtain, how a challenge is raised and decided, and the period. A release that depends on the outcome of a challenge waits for it; a later dispute does not recall a release. #### 9.6 Records and anchors A disclosure that happens through this framework MUST leave a record that can be authenticated and that binds the authorization to the object, the view and the audience. Where the record is kept, who can read it and how it is anchored are declared by the scope: - **Open record mode.** Requests, approvals, attestations and releases are records of the ledger, with their accounts and identifiers. - **Committed record mode.** Records are kept off the ledger by the parties and the bodies that audit them. The ledger holds commitments. A ledger MUST refuse open disclosure requests in a scope of this mode. A commitment to one record is `keccak256(abi.encode(recordHash, salt))` with a salt of 32 random bytes. A commitment to a batch is the root of a tree of such commitments, in which a parent is the keccak256 hash of its two children in ascending order. A record whose content can be guessed MUST NOT be committed without a salt. That a record was committed does not show that every decryption was recorded. Open records disclose who takes part with whom, who audits whom and which activities share participants, although they hold no plaintext. **Ledger interface.** ```solidity /// @title FHE Interaction Framework: ledger of protected objects, operations, disclosures and evidence interface IFHEIFLedger { event InputSubmitted( bytes32 indexed objectId, bytes32 indexed scopeId, address indexed submitter, bytes32 classId, bytes32 keyContextId, uint32 keyEpoch, bytes32 commitment, string locator ); event OperationAdmitted( bytes32 indexed operationId, bytes32 indexed scopeId, address indexed requester, bytes32 programHash, bytes32 viewId ); event ResultSubmitted(bytes32 indexed operationId, address indexed executor, bytes32[] outputs); event OutputProposed(bytes32 indexed objectId, bytes32 indexed operationId, bytes32 commitment, string locator); event ResultAccepted(bytes32 indexed operationId, address indexed acceptedBy); event ResultRejected(bytes32 indexed operationId, address indexed rejectedBy, bytes32 reason); event OperationFailed(bytes32 indexed operationId, address indexed reportedBy, bytes32 reason); event OperationCancelled(bytes32 indexed operationId); event OperationExpired(bytes32 indexed operationId, bytes32 reason); event DisclosureRequested( bytes32 indexed disclosureId, bytes32 indexed scopeId, bytes32 indexed objectId, bytes32 viewId, address audience, address requester, uint256 approvalsRequired ); event DisclosureApproved(bytes32 indexed disclosureId, address indexed approver, uint256 approvals); event DisclosureAuthorized(bytes32 indexed disclosureId); event ReleaseAttested(bytes32 indexed disclosureId, address indexed holder, uint256 attestations); event DisclosureReleased(bytes32 indexed disclosureId); event DisclosureRefused(bytes32 indexed disclosureId, address indexed refusedBy, bytes32 reason); event DisclosureExpired(bytes32 indexed disclosureId); event EvidenceRecorded( bytes32 indexed subjectId, bytes32 indexed proposition, bytes32 indexed mechanism, address attester, bytes32 payloadHash, string uri, uint256 index ); event RecordAnchored( bytes32 indexed commitment, bytes32 indexed scopeId, bytes32 indexed recordKind, address anchoredBy ); error ScopeNotActive(bytes32 scopeId, ScopeStatus status); error PolicyVersionMismatch(uint64 named, uint64 current); error KeyContextNotAdmitted(bytes32 scopeId, bytes32 keyContextId); error EpochNotUsable(bytes32 keyContextId, uint32 epoch, EpochStatus status); error ConversionNotDeclared(bytes32 keyContextId, uint32 inputEpoch, uint32 outputEpoch); error NotAuthorized(address subject, bytes32 capability); error ObjectExists(bytes32 objectId); error ObjectNotAccepted(bytes32 objectId); error ObjectScopeMismatch(bytes32 objectId); error KeyContextMismatch(bytes32 objectId); error ViewMismatch(bytes32 viewId); error InputOutOfRange(bytes32 objectId, bytes32 viewId); error RequestAlreadyUsed(bytes32 requestId); error RequestExpired(bytes32 requestId); error InvalidRequest(); error InvalidSignature(); error InvalidState(bytes32 id); error NotRequester(address caller); error NotDesignatedExecutor(address caller); error NotKeyHolder(address caller); error AlreadyRecorded(address caller); error NotReleasable(bytes32 disclosureId, bytes32 reason); error StillReleasable(bytes32 disclosureId); error NotExpired(bytes32 id); error RecordModeMismatch(bytes32 scopeId); error UnknownSubject(bytes32 subjectId); /// @notice The registry this ledger reads scopes, key contexts and views from. function registry() external view returns (address); /// @notice The EIP-712 domain separator of this ledger. function DOMAIN_SEPARATOR() external view returns (bytes32); /// @notice The identifier of an operation request: its EIP-712 digest under this ledger's domain. function hashOperationRequest(OperationRequest calldata request) external view returns (bytes32); /// @notice The identifier of a disclosure request: its EIP-712 digest under this ledger's domain. function hashDisclosureRequest(DisclosureRequest calldata request) external view returns (bytes32); // Protected objects /// @notice Registers an input as a protected object of a scope. It is accepted on registration. function submitInput(InputSubmission calldata submission) external returns (bytes32 objectId); function objectOf(bytes32 objectId) external view returns (ProtectedObject memory); // Operations /// @notice Admits an operation requested by the caller. function requestOperation(OperationRequest calldata request) external returns (bytes32 operationId); /// @notice Admits an operation on a signature of `request.requester` over the request. function requestOperationWithSignature(OperationRequest calldata request, bytes calldata signature) external returns (bytes32 operationId); /// @notice Records the outputs an executor proposes for an admitted operation. function submitResult(bytes32 operationId, OutputSubmission[] calldata outputs) external returns (bytes32[] memory objectIds); /// @notice Accepts a submitted result. Its outputs become accepted objects of the scope. function acceptResult(bytes32 operationId) external; function rejectResult(bytes32 operationId, bytes32 reason) external; /// @notice Reports that an admitted operation cannot be carried out. function failOperation(bytes32 operationId, bytes32 reason) external; function cancelOperation(bytes32 operationId) external; /// @notice Ends an operation that can no longer be completed. function expireOperation(bytes32 operationId) external; function operationOf(bytes32 operationId) external view returns (Operation memory); // Disclosures /// @notice Records a disclosure request of the caller. function requestDisclosure(DisclosureRequest calldata request) external returns (bytes32 disclosureId); /// @notice Records a disclosure request on a signature of `request.requester` over the request. function requestDisclosureWithSignature(DisclosureRequest calldata request, bytes calldata signature) external returns (bytes32 disclosureId); function approveDisclosure(bytes32 disclosureId) external; /// @notice Records that a key holder contributes to the release, after checking again that the /// release is authorized now. The disclosure is released when the epoch's quorum has attested. function attestRelease(bytes32 disclosureId) external; function refuseDisclosure(bytes32 disclosureId, bytes32 reason) external; function expireDisclosure(bytes32 disclosureId) external; /// @notice Whether a release could proceed now, and if not, why. function isReleasable(bytes32 disclosureId) external view returns (bool releasable, bytes32 reason); function disclosureOf(bytes32 disclosureId) external view returns (Disclosure memory); function hasApproved(bytes32 disclosureId, address approver) external view returns (bool); function hasAttested(bytes32 disclosureId, address holder) external view returns (bool); // Evidence /// @notice Records evidence of the caller about an object, an operation, a disclosure or an anchor. function recordEvidence( bytes32 subjectId, bytes32 proposition, bytes32 mechanism, bytes32 payloadHash, string calldata uri ) external returns (uint256 index); function evidenceCount(bytes32 subjectId) external view returns (uint256); function evidenceAt(bytes32 subjectId, uint256 index) external view returns (Evidence memory); // Committed records /// @notice Anchors the commitment of a record that is kept off the ledger. function anchorRecord(bytes32 scopeId, bytes32 recordKind, bytes32 commitment) external; function anchorOf(bytes32 commitment) external view returns (Anchor memory); /// @notice Whether `commitment` opens to `recordHash` with `salt`. function verifyRecordOpening(bytes32 commitment, bytes32 recordHash, bytes32 salt) external pure returns (bool); /// @notice Whether `leaf` is a member of the batch committed by `root`. function verifyBatchMembership(bytes32 root, bytes32 leaf, bytes32[] calldata proof) external pure returns (bool); } ``` ### 10. Failure semantics A refusal names its ground. A ledger MUST revert with an error that names a condition that failed; where several fail, which of them is named is not specified. A request that can no longer proceed ends with one of these reasons: | Reason | Meaning | | --- | --- | | `fheif.reason.unsupported` | The profile or the backend does not support what was asked. | | `fheif.reason.incompatible` | Objects, keys or parameters do not belong together. | | `fheif.reason.undeterminable` | It cannot be determined whether the result is correct. | | `fheif.reason.resource` | A declared limit of depth, size or time was reached. | | `fheif.reason.expired` | The time of validity passed. | | `fheif.reason.not-yet-valid` | The time from which a request is valid has not come. | | `fheif.reason.scope-paused` | The scope is paused. This reason can end. | | `fheif.reason.scope-closed` | The scope is closed. | | `fheif.reason.policy-superseded` | The policy version of the request is no longer current. | | `fheif.reason.epoch-not-usable` | The key epoch or key context can no longer be used for this. | | `fheif.reason.view-retired` | The view was retired. | | `fheif.reason.not-authorized` | A capability the request rests on is not held. | Nothing proceeds on the unknown. An absent answer, an unknown profile, an unreadable source or an undecidable condition is never read as consent. ### 11. Invariants 1. Every object has exactly one scope, key context, key epoch, class and policy version, and they never change. 2. Only an accepted object is an input of an operation or the object of a disclosure. 3. No operation is admitted across scopes, key contexts or key epochs, except a conversion to the directly following epoch that was opened with `CONVERT`. 4. An identifier of a request is used once. 5. An object is released only under the view it carries, or under an identity view whose range contains its class. 6. No disclosure becomes `RELEASED` without the attestations of the release quorum of the epoch of its object, each given while the release stood. 7. `RELEASED` is final. 8. A policy version later than that of an object does not widen authority over the object, unless the earlier version has the successor right `GOVERN`. 9. No capability follows from controlling a scope, controlling a key context, being a holder, executing or approving. 10. Evidence changes no state. 11. Nothing is accepted under an epoch that is not `ACTIVE`, and nothing is released under an epoch that is `REVOKED`. 12. An admitted request does not depend on a later answer of its signer. ## Rationale **Scope, key context and organisation are three things.** A group can run a public progress board, a quoting round among its members, a delivery to one client and an audit that needs approval. If these shared a key because they share a group, every member would read everything. Keeping the three apart lets one key context serve several scopes and one scope use several key contexts, and it makes "who is in the group" a question an authorizer answers and never a question of keys. **Views instead of levels.** Levels suppose that who sees more also sees what the others see. A client, a finance function, an auditor and the public see different things, none of which includes another. Stating the output of each audience as a view, and releasing whole view outputs only, turns "who may know what" into something that is computed, committed to and checked. A field that only names a form of output, such as "aggregate", would not say which inputs, which function, which precision or whether a result was ever cleared for release. **A release is a whole object.** If a holder contributed to the decryption of a large object and the audience were trusted to look at a part, the view would be a courtesy. Requiring that the released object holds the view output and nothing else puts the boundary where the cryptography is. **Capabilities are asked, not listed.** A fixed table of members in the ledger would exclude open participation, temporary qualification, credentials and decisions of groups. The ledger asks one question of one contract and takes the answer. The example authorizer is a table of grants because that is the simplest thing that answers the question. **Authority is checked at the release.** Decryption cannot be undone. A request can be valid when it is made and not when it is served, so each holder asks again in the block in which it commits to contribute. With a threshold of holders this gives a simple property: a revocation that reaches the ledger before the last required attestation stops the release. **A later policy version only narrows.** If a controller could rewrite the rules for what was already submitted, the boundary participants agreed to would last until the next transaction of the controller. Taking the intersection of the earlier and the current answer keeps later versions able to tighten and unable to widen, and a scope that wants its later versions to govern says so in its first version, where participants can see it. **Requests in flight end with their policy version.** Carrying an admitted request across a change of rules would need a rule for every combination of old request and new policy. Ending it and asking again under the new version is one rule, has one outcome and costs one transaction. **Evidence per proposition.** One interaction can have a proof that an input is well formed, a re-execution of the computation, signatures of holders over a decryption and an approval of a group for the release. A single flag would say that something was verified and not what. Mechanisms are named and never ranked, because a mechanism that proves the form of an input says nothing about a computation. **Records can be commitments.** A record without plaintext can still show who works with whom and who is under audit. A scope chooses whether its records are fields of the ledger or commitments on it. **Storage is declared, not prescribed.** Ciphertexts of current schemes range from kilobytes to megabytes. Some deployments keep them on a chain, most do not. The ledger needs the commitment and nothing else. **Dependencies.** ERC-165 identifies the interfaces. EIP-712 gives requests an identifier that any party computes off the ledger and that an agent can sign without sending a transaction. ERC-1271 is needed because agents are commonly contract accounts. No clock interface is required: a key epoch is a version and not a clock, and times are plain timestamps. **Relation to other proposals.** ERC-7984 defines confidential fungible balances whose amounts are pointers; such a balance can be an object of a scope, and this framework adds what a token interface leaves to the implementation. ERC-7627 covers messages that the recipient decrypts; a message that is to be computed on while encrypted is an input here. ERC-8338 names execution privacy as later work; a program of this framework can be the protected execution of such a package. Decisions of a group under [ERC-8436](./eip-8436.md) can be what an authorizer reads before it counts an approval, a group under [ERC-8447](./eip-8447.md) can bind its activities to one or several scopes, disputes under [ERC-8471](./eip-8471.md) can cite operations, disclosures and evidence of this ledger, information flows under [ERC-8489](./eip-8489.md) can name a scope as the boundary of a mode, and a task under [ERC-8414](./eip-8414.md) can be settled on an accepted result. Each of these is an optional binding. None is required, and none gives a capability or decryption capability by itself. Records of operations and evidence can also be read by systems that account for work; whether work was wanted, useful or to be paid is theirs to decide and is not defined here. ## Backwards Compatibility No backward compatibility issues found. The framework introduces new contracts and changes no existing interface. Existing execution environments for encrypted computation can be described by a profile and a key context, with their own access lists and decryption services behind an authorizer and a set of holders. ## Test Cases ### The matching case Two suppliers each submit a quote and a client submits a cap, all encrypted as 16 bits under a key that the three of them generated jointly; each holds one share and all three are needed to decrypt. An executor that holds no share is asked for three rounds: 1. `best-quote`: which quote is lower, and the lower quote. A tie goes to the second supplier. 2. `cap-check`: whether the lower quote does not exceed the cap. 3. Four views of the result: for the client whether a deal was made, who won it and at what price; for each supplier whether it won; for everybody whether a deal was made. No object is decrypted between the rounds. A second account re-executes each round and the client accepts on that evidence. With the quotes 41250 and 39800 and the cap 40000, the client view decrypts to a deal with the second supplier at 39800, the first supplier's view to 0, the second supplier's view to 1 and the public view to 1. With the quotes 30500 and 31000 and the cap 30000, there is no deal and every position of the client view is 0. The following are refused, each with the error named: | Request | Error | | --- | --- | | A supplier requests the client view. | `NotAuthorized` | | A used disclosure request is submitted again. | `RequestAlreadyUsed` | | The client view output is requested under the public view. | `ViewMismatch` | | The state is requested under the client view. | `ViewMismatch` | | A request names a policy version that is not current. | `PolicyVersionMismatch` | | A request names another key context or key epoch than that of the object. | `KeyContextMismatch` | | A second scope, whose controller granted itself every capability, requests or computes on an object of the first. | `ObjectScopeMismatch` | | A request carries the signature of another account. | `InvalidSignature` | | A holder attests before the required approvals. | `InvalidState` | | A holder attests after the audience's capability was revoked. | `NotReleasable` with `fheif.reason.not-authorized` | | A holder attests after the validity of the request. | `NotReleasable` with `fheif.reason.expired` | | A holder attests while the scope is paused. | `NotReleasable` with `fheif.reason.scope-paused` | | A result is submitted, or a holder attests, after the policy version was superseded. | `PolicyVersionMismatch`, `NotReleasable` with `fheif.reason.policy-superseded` | | An input is submitted under a retired epoch. | `EpochNotUsable` | | A holder of a later epoch only attests for an object of an earlier one, or the reverse. | `NotKeyHolder` | | Objects of two epochs are named in one operation. | `KeyContextMismatch` | | An object of a revoked epoch is requested. | `EpochNotUsable` | A release of the state as it is to an auditor needs two approvals. After the first holder attested and contributed, the capability of the auditor is revoked: the second holder is refused, withholds its contribution, and the disclosure ends `REFUSED`; one contribution of three gives the auditor nothing. When the second supplier leaves, a new epoch is opened with `RETAIN` and with key material that the remaining holders and a new supplier generate. The shares of the first epoch do not open an object of the second. An object of the first epoch is still released by the holders of the first epoch, the supplier that left among them, until that epoch is revoked. ### Vectors [`constants.json`](../assets/eip-8525/vectors/constants.json) holds the well-known identifiers, the type strings and type hashes, and the interface identifiers: | Interface | Identifier | | --- | --- | | `IFHEIFRegistry` | `0x2b46110f` | | `IFHEIFLedger` | `0x037b2205` | | `IFHEIFAuthorizer` | `0xb293c9c5` | | Type | Type hash | | --- | --- | | `OperationRequest` | `0x7f2ecb849b15b324d91dde4d87dd2b9149e51384017428d8e6a6fd74282c2bab` | | `DisclosureRequest` | `0x2b16dcd95d3a74f6c1bbc7d4f2cf55443d2d462d3a740c0acf0b1d6eadaf4751` | [`identifiers.json`](../assets/eip-8525/vectors/identifiers.json) holds one worked derivation of every identifier of section 3 on chain 11155111, with a registry at `0x1111111111111111111111111111111111111111` and a ledger at `0x2222222222222222222222222222222222222222`: | Value | Result | | --- | --- | | Domain separator of the ledger | `0x9c48001a062ce8af3bb1a718a57a88ddf2175f31b9e7e67e2edf6b6a0fee4d9e` | | Profile identifier | `0x6e05eafaa915e2ad1011b2a892c586504b492ea1e1e33e50df6ae7b62057f0f7` | | Key context identifier | `0x0757640d95a92ceb3676e4898d2c8ef21ff474d07a873928f2cff336cf58f2f5` | | Scope identifier | `0xb8d21ba93189150488cf8902b6393d3dc7c6241883b29eb9eac4321f8b6be045` | | View identifier | `0xe198c6f63acc878886b9d0edffc4cb2aabc6b1dec64e8f4a4d2f7f4509d38953` | | Input object identifier | `0xd80e6926222ea9253d41214fc086b8afee1bc4fa0298e0f1a041eb49ab58efff` | | Operation identifier | `0xf2bb8d27cf2ac3774426ab8e5d483197661191689905f06dd9d76ceaa48ccee2` | | Output object identifier | `0x32ecc46199d6b52c10557141cb5c7097dcd9ec62200d659707af44bd722d5983` | | Disclosure identifier | `0x7ca5b493c1504d6c1cdff8c83fb101efd9245d55178a26b5b5bc4a7b184ad8e2` | | Commitment of a record | `0xb3bfaae6fbbe1b357144e47f82a614303b5bc91420bfd1ece8aa036241471970` | | Root of a batch of four | `0xe7fd5b0d37be357b5000c2e52df007acc9eecd4218de71d686ec265b8f136767` | The file also holds signatures over the two requests by the account `0xADA006Ad307445C27cF1b202a96beB0F70aeeC90`, which a ledger at the stated address accepts. [`documents.json`](../assets/eip-8525/vectors/documents.json) holds the hash of every example document. ### Documents of the matching case | Document | File | | --- | --- | | Profile, homomorphic | [`profile.json`](../assets/eip-8525/examples/matching/profile.json) | | Profile, test only | [`profile-test-only.json`](../assets/eip-8525/examples/matching/profile-test-only.json) | | Key context | [`key-context.json`](../assets/eip-8525/examples/matching/key-context.json) | | Key material and access structure of an epoch | [`key-material-epoch-1.json`](../assets/eip-8525/examples/matching/key-material-epoch-1.json), [`key-access-epoch-1.json`](../assets/eip-8525/examples/matching/key-access-epoch-1.json) | | Scope | [`scope.json`](../assets/eip-8525/examples/matching/scope.json) | | Policy version | [`policy.json`](../assets/eip-8525/examples/matching/policy.json) | | Programs | [`best-quote.json`](../assets/eip-8525/examples/matching/programs/best-quote.json), [`cap-check.json`](../assets/eip-8525/examples/matching/programs/cap-check.json), [`view-client.json`](../assets/eip-8525/examples/matching/programs/view-client.json), [`view-supplier-a.json`](../assets/eip-8525/examples/matching/programs/view-supplier-a.json), [`view-supplier-b.json`](../assets/eip-8525/examples/matching/programs/view-supplier-b.json), [`view-public.json`](../assets/eip-8525/examples/matching/programs/view-public.json) | | View outputs | [`client.json`](../assets/eip-8525/examples/matching/views/client.json), [`supplier-a.json`](../assets/eip-8525/examples/matching/views/supplier-a.json), [`supplier-b.json`](../assets/eip-8525/examples/matching/views/supplier-b.json), [`public.json`](../assets/eip-8525/examples/matching/views/public.json), [`audit.json`](../assets/eip-8525/examples/matching/views/audit.json) | | Conformance statement | [`conformance.json`](../assets/eip-8525/examples/matching/conformance.json) | ## Reference Implementation | File | Content | | --- | --- | | [`FHEIFTypes.sol`](../assets/eip-8525/contracts/interfaces/FHEIFTypes.sol) | Types and well-known identifiers | | [`IFHEIFRegistry.sol`](../assets/eip-8525/contracts/interfaces/IFHEIFRegistry.sol), [`IFHEIFLedger.sol`](../assets/eip-8525/contracts/interfaces/IFHEIFLedger.sol), [`IFHEIFAuthorizer.sol`](../assets/eip-8525/contracts/interfaces/IFHEIFAuthorizer.sol) | The three interfaces | | [`FHEIFRegistry.sol`](../assets/eip-8525/contracts/FHEIFRegistry.sol) | Profiles, key contexts and epochs, scopes and policy versions, views | | [`FHEIFLedger.sol`](../assets/eip-8525/contracts/FHEIFLedger.sol) | Objects, operations, disclosures, evidence, anchors, signed requests | | [`FHEIFGrantAuthorizer.sol`](../assets/eip-8525/contracts/modules/FHEIFGrantAuthorizer.sol) | An example authorizer: a table of grants that can be signed, passed on in narrower form, revoked and frozen | The registry and the ledger have no owner, no upgrade path and no privileged account. A key context and a scope are controlled by the account that created them. The matching case of the test cases was run end to end against these contracts with a backend built on a threshold variant of the BFV scheme over bits: the three holders generate the key jointly, each in a process of its own that reads only its own share; the executor and the re-executing account run in processes that are given the public material only; holders seal their contributions to the delivery key of the audience. A second backend that computes on plain bits and is registered under the test-only evaluation class runs the same flow and protects nothing. In that run all roles were processes on one machine; inputs were not proven well formed and partial decryptions were not proven correct, and the conformance statement of the example says so. ## Security Considerations **Whoever holds a whole key decrypts.** No record on a ledger prevents a subject that holds a complete decryption key, or enough shares, from decrypting ciphertexts it can obtain, outside any recorded path. The protection of a scope is that of its key context: who generated the key, who holds what, and how many holders have to act together. A reader of a scope looks at the key context descriptor and at the holders of the epoch before anything else. A release quorum on the ledger records contributions; it is not what makes decryption impossible below the threshold. The key arrangement does that or nothing does. **Collusion.** With a threshold of holders, confidentiality holds against fewer holders than the threshold and fails against the threshold. In the matching case the three parties whose data is protected are the holders, so none of them can be bypassed; a deployment that gives the shares to a service trusts that service to that extent. **Computation is not confined.** Where evaluation material is public, anybody computes on ciphertexts. Ciphertexts are malleable by design. What the ledger controls is which results become objects and which objects are released. A deployment in which an unadmitted computation followed by a decryption would be harmful relies on holders contributing only to recorded disclosures. **Released results can endanger keys.** For several schemes, including exact ones under parameters that allow a noticeable probability of incorrect decryption, an adversary that sees decrypted results of ciphertexts it helped to form can learn about the key. Exact data semantics does not rule this out. A profile states its parameters, its correctness assumption, the model under which results are released and the protection it applies, such as noise added to partial decryptions, and holders release only objects of recorded disclosures whose origin the ledger shows. **Outputs leak inputs.** A view that is allowed can still reveal what it was computed from, alone or together with other views and repeated requests. Encrypted computation protects the computation; the boundary of what is released is set by which views exist and how often they are served. **Inputs.** A submitter that encrypts a value outside the form a program expects can corrupt a result or learn about other inputs through a view. Unless a profile provides proofs of well-formed inputs, this is trusted, and evidence records it as declared. **Executors.** A result is a claim until it is supported. Re-execution detects a wrong result where the profile makes evaluation deterministic and somebody other than the executor re-executes. It detects nothing where the acceptor and the executor act together. **Partial decryptions.** A holder that contributes a wrong share can make a release fail or, in some schemes, alter what the audience obtains. Without a proof of correct contribution this is not detected by the audience. **Records are public.** Open records show which accounts requested, executed, approved, attested and received what and when. Commitments hide this only with random salts, and timing remains visible. **Controllers.** The controller of a scope can pause it, close it, retire views and activate policy versions. It cannot widen authority over earlier objects where the successor right is narrow-only, and it holds no capability it is not granted. The controller of a key context can open and revoke epochs and thereby stop releases; it cannot release. An authorizer is code chosen by the controller: a scope is as trustworthy as the authorizer of its policy version, and participants read it before they submit. **Signatures.** A signed request can be submitted by anybody, once, on one ledger and one chain, within its validity. A contract account that changes its keys affects signatures that are not yet submitted and not requests that were admitted. **Finality.** A holder that contributes before the block of its attestation is final can release on a state that the chain later drops. **Test-only profiles.** A profile of the test-only class is public about protecting nothing. A consumer that does not read the evaluation class of the profile of a key context can take a rehearsal for protection. **Agents.** An agent that receives a ciphertext does not thereby understand it. It decides, on what it can see, which protected operation to request; a backend computes; the agent receives the views it is entitled to, or passes references to objects on. Confidentiality of inputs does not hide a program or a model from the party that evaluates it: hiding a program needs the program to be protected data of an operation, which a profile declares where it provides it. ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md).