LPsLux Proposals
Precompiles
LP-7330

Key Management Service

Final

Every infrastructure secret lives in an HSM-backed key service and reaches workloads through a sync controller, never through an env file; on-chain, key operations become transactions against tenant-scoped lanes, so a cross-tenant read is structurally impossible rather than policy-forbidden

Category
Core
Created
2025-11-01

Abstract

Every secret — signing keys, API tokens, database credentials, TLS certificates — is stored in the key management service, backed by FIPS 140-3 Level 3 HSMs. Secrets reach Kubernetes through a sync controller. No secret is ever stored in an environment file, in source, or in plaintext configuration.

On-chain, key operations become Quasar transactions executed by the GPU adapter, with key material held in tenant-scoped lanes and access enforced by a precompile that consults the P-Chain identity root. That is what makes cross-tenant access structurally impossible rather than policy-forbidden.

Specification

Architecture

KMS (kms.hanzo.ai)
  |-- HSM backend (FIPS 140-3 Level 3)
  |-- API (authenticated via IAM, LP-7120)
  |-- KMSSecret controller (syncs to k8s Secrets, LP-7326)

The HSM provider matrix and the validator-side integration are LP-7325; the KMSSecret CRD contract is LP-7326.

Key types

TypeAlgorithmUse case
SigningEd25519, secp256k1, ML-DSATransaction signing, MPC shares
EncryptionAES-256-GCMData-at-rest encryption
TLSRSA-4096, ECDSA P-384Service TLS certificates
HMACHMAC-SHA256Webhook signing, API authentication

Operations

  • Create — POST /v1/keys generates a new key inside the HSM and returns a key ID.
  • Sign — POST /v1/keys/{id}/sign signs data without exporting the key.
  • Encrypt / Decrypt — POST /v1/keys/{id}/encrypt|decrypt performs envelope encryption.
  • Rotate — POST /v1/keys/{id}/rotate creates a new version; the old version remains available for decryption.
  • Export — not supported for HSM-backed keys. Software keys support wrapped export.

Kubernetes integration

A KMSSecret names a KMS scope and a target Secret; the controller pulls the values and writes them into the Kubernetes Secret:

apiVersion: kms.hanzo.ai/v1
kind: KMSSecret
metadata:
  name: luxd-staking
spec:
  secretRef: luxd/staking/mainnet
  target:
    name: staking-keys
    namespace: lux-mainnet

The controller polls KMS every 60 seconds and updates the Secret. Pods mount the Secret as a volume.

Lane model

The key service composes with the Quasar app stack (LP-5623) through a precompile plus lane-scoped key material. Key operations become Quasar transactions executed by the GPU adapter; key material is held in tenant-scoped lanes; access is enforced by a precompile that consults the P-Chain identity root in QuasarRoundDescriptor.pchain_validator_root.

Operation to transaction mapping

OperationQuasar transaction shapeLane impact
kms_keygenmints a key into H("kms", tenant_id, key_id)new lane created
kms_rotatebumps the version on the key laneMVCC version increment
kms_deriveread-only txno version bump
kms_signcalls the KMS precompile and emits a cert-lane artifactsign event recorded
kms_revokeflips the status bit on the key lanetombstone recorded

Lane scoping

key_lane = H("kms", tenant_id, key_id)

Tenant boundaries map to the IAM owner claim (LP-7120). Cross-tenant access is structurally impossible: a precompile call against a lane the caller's tenant does not own returns ACCESS_DENIED without consulting any external policy store. There is no policy to misconfigure.

Threshold keys reuse the MPC cert lanes

Where the key itself is held as t-of-n shares across validators rather than inside a single HSM, the operation reuses the M-Chain cert lanes:

Threshold use caseCert lane
Threshold ECDSA sign-as-keyMChainCGGMP21 (lane 5)
Threshold Schnorr / EdDSA sign-as-keyMChainFROST (lane 6)
Post-quantum threshold signMChainCoronaGen (lane 7)
TFHE key-share storageM-Chain ceremony → F-Chain key arena

This makes threshold key management a thin wrapper over the existing MPC ceremony infrastructure: the "key" is exactly the group public key produced by an M-Chain DKG, and "sign" is a SignRequestTx against that key's lane.

Replay-proof binding

Every sign request that emits a cert artifact MUST bind the certificate_subject from the active QuasarRoundDescriptor. A signature for round R cannot be replayed in round R+1 because the upstream chain roots differ — the binding is structural, not policy-enforced. See LP-0122.

Precompile address

Access control and sign dispatch run at a reserved EVM precompile address. The precompile reads the identity root from QuasarRoundDescriptor.pchain_validator_root and the key lane from H("kms", tenant_id, key_id). Concrete address allocation lives in the precompile registry (LP-1210), not here.

Security Considerations

  1. HSM-backed keys never leave the HSM boundary. Sign operations happen inside the HSM.
  2. Access is authenticated through IAM. Each service has a scoped service account.
  3. Key rotation does not invalidate old ciphertext — old key versions decrypt, the new version encrypts.
  4. The audit log records every key operation with timestamp, caller identity, and result.
  5. Chain-side key material lives in tenant-scoped lanes; cross-tenant reads are rejected by the precompile, not by a policy layer.
  6. Threshold sign artifacts bind certificate_subject and are therefore non-replayable across rounds.
  7. The service plane and the on-chain precompile are independently auditable: every chain-side operation has a corresponding KMS audit record, and any divergence is detectable.

Reference

ResourceLocation
KMS servicehttps://kms.hanzo.ai
KMS implementationgithub.com/hanzoai/kms
KMSSecret CRDgithub.com/hanzoai/kms/crds/
HSM provider matrixLP-7325
Secret sync contractLP-7326
Validator key lifecycleLP-7320

Copyright and related rights waived via CC0.