docs/protocol/architecture/kms.md
This document explains one of the key components of the Zama Protocol - The Key Management Service (KMS), responsible for the secure generation, management, and usage of FHE keys needed to enable confidential smart contracts.
The KMS is a decentralized network of several nodes (also called "parties") that run an MPC (Multi-Party Computation) protocol:
It works entirely off-chain, but is orchestrated through the Gateway, which initiates and tracks all key-related operations. This separation of powers ensures strong decentralization and auditability.
The system follows the NIST SP 800-57 key lifecycle model, managing key states such as Active, Suspended, Deactivated,and Destroyed to ensure proper rotation and forward security.
The KMS performs decryption using a threshold decryption protocol — at least a minimum number of MPC parties (e.g., 9 out of 13) must participate in the protocol to robustly decrypt a value.
All decryption operation outputs are signed by each node and the output can be verified on-chain for full auditability.
The KMS generates Common Reference Strings (CRS) needed to validate Zero-Knowledge Proofs of Knowledge (ZKPoK) when users submit encrypted values.
This ensures encrypted inputs are valid and well-formed, and that a user has knowledge of the plaintext contained in the submitted input ciphertext.
Each MPC node runs by default inside an AWS Nitro Enclave, a secure execution environment that prevents even node operators from accessing their own key shares. This design mitigates insider risks, such as unauthorized key reconstruction or selling of shares.
The KMS adheres to a formal key lifecycle, as per NIST SP 800-57:
| State | Description |
|---|---|
| Pre-activation | Key is created but not in use. |
| Active | Key is used for encryption and decryption. |
| Suspended | Temporarily replaced during rotation. Still usable for decryption. |
| Deactivated | Archived; only used for decryption. |
| Compromised | Flagged for misuse; only decryption allowed. |
| Destroyed | Key material is deleted permanently. |
The KMS supports key switching using FHE, allowing ciphertexts to be securely transferred between keys during rotation. This maintains interoperability across key updates.
In addition to robustness through MPC, the KMS also offers a custodial backup system: