Hanzo KBS (Key Broker Service)
A comprehensive Key Broker Service for Hanzo Node that manages cryptographic key lifecycle with TEE (Trusted Execution Environment) attestation and privacy tiers.
Architecture Overview
The Hanzo auth stack consists of three integrated components:
1. KMS (Key Management System) - Infisical
- External service for centralized key management
- Provides enterprise-grade secret storage
- Handles encryption, rotation, and access control
- Located at:
/Users/z/work/hanzo/kms(Infisical deployment)
2. KBS (Key Broker Service) - This Module
- Attestation-based key release
- Privacy tier enforcement (0-4)
- TEE integration (SEV-SNP, TDX, NVIDIA H100/Blackwell)
- Web2/Web3 authentication support
3. IAM (Identity & Access Management)
- Integrated with both Web2 (OAuth, SAML) and Web3 (DIDs, wallets)
- Role-based access control (RBAC)
- Capability-based security tokens
- Cross-chain identity verification
Privacy Tiers
The KBS implements a 5-tier privacy model with graceful degradation:
| Tier | Name | Description | TEE Support | Use Cases |
|---|---|---|---|---|
| 0 | Open | No encryption, public data | None | Public APIs, open datasets |
| 1 | Encrypted | Basic encryption at rest/transit | None | Standard web services |
| 2 | Secure | Hardware security module support | HSM/TPM | Enterprise applications |
| 3 | GPU CC | GPU Confidential Computing | NVIDIA H100 | AI model training/inference |
| 4 | GPU TEE-I/O | Full I/O isolation | NVIDIA Blackwell | Maximum security workloads |
Graceful Degradation
The system automatically degrades to lower tiers when higher tier hardware is unavailable:
// Tier 4 (Blackwell) → Tier 3 (H100) → Tier 2 (HSM) → Tier 1 (Software)
let vault = create_with_fallback?;
Web2/Web3 Compatibility
Web2 Authentication
- OAuth 2.0 / OIDC providers
- SAML integration
- API keys with HMAC
- Session-based auth
Web3 Authentication
- Ethereum wallet signatures
- DIDs (Decentralized Identifiers)
- Chain-based attestation
- Zero-knowledge proofs
Integration with Infisical KMS
The KBS integrates with Infisical for enterprise key management:
// Configure Infisical connection
let kms_config = KmsConfig ;
// Create KBS with Infisical backend
let kbs = new?;
TEE Support
NVIDIA GPU TEE Integration
H100 Confidential Computing (Tier 3)
// Automatic detection of H100 CC mode
let vault = new;
if vault.is_cc_enabled?
Blackwell TEE-I/O (Tier 4)
// Maximum security with I/O isolation
let vault = new;
// All I/O is encrypted and authenticated
vault.use_key_with_io_protection?;
CPU TEE Support
- AMD SEV-SNP: Secure Encrypted Virtualization
- Intel TDX: Trust Domain Extensions
- ARM CCA: Confidential Compute Architecture
API Usage
Basic Key Operations
use ;
// Initialize KBS
let kbs = new.await?;
// Request key with attestation
let attestation = generate_attestation.await?;
let key = kbs.request_key.await?;
// Use key with automatic cleanup
kbs.use_key?;
Capability Tokens
// Create capability token for agent
let token = kbs.create_capability_token?;
// Verify and use token
let authorized = kbs.verify_capability?;
Deployment
Docker Compose
version: '3.8'
services:
infisical-kms:
image: infisical/infisical:latest
environment:
- ENCRYPTION_KEY=${ENCRYPTION_KEY}
- AUTH_SECRET=${AUTH_SECRET}
ports:
- "8080:8080"
hanzo-node:
image: hanzo/node:latest
environment:
- KMS_ENDPOINT=http://infisical-kms:8080
- ENABLE_TEE=true
- PRIVACY_TIER=3
depends_on:
- infisical-kms
Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: hanzo-kbs-config
data:
kms_endpoint: "https://kms.hanzo.ai"
default_privacy_tier: "2"
enable_tee_attestation: "true"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hanzo-node
spec:
template:
spec:
containers:
- name: hanzo-node
image: hanzo/node:latest
envFrom:
- configMapRef:
name: hanzo-kbs-config
Security Considerations
Key Protection Hierarchy
- Master Keys: Never leave TEE, hardware-bound
- KEKs (Key Encryption Keys): Wrapped by master keys
- DEKs (Data Encryption Keys): Wrapped by KEKs
- Session Keys: Ephemeral, time-bound
Attestation Chain
Hardware Root of Trust
↓
Platform Firmware (PSP/ME)
↓
TEE Attestation (SEV/TDX/GPU)
↓
KBS Verification
↓
Key Release
Zero Trust Architecture
- No implicit trust between components
- Every request requires attestation
- Continuous verification
- Least privilege access
Performance Optimization
Caching Strategy
- Session key caching (5 min default)
- Attestation result caching (1 min)
- Capability token caching
Connection Pooling
- KMS connection pool (10 connections)
- Database connection pool (R2D2)
- HTTP/2 multiplexing for API calls
Monitoring & Observability
Metrics (Prometheus)
- Key request latency
- Attestation success rate
- TEE availability
- Vault operations/sec
Logging
- Audit logs for all key operations
- Attestation verification logs
- Security events
- Performance metrics
Testing
# Run unit tests
# Run integration tests (requires TEE simulator)
# Run with TEE hardware
TEE_MODE=hardware
# Benchmark performance
Migration from Other Systems
From HashiCorp Vault
// Compatible API for easy migration
let vault_compat = new;
vault_compat.read?;
From AWS KMS
// AWS KMS compatibility layer
let aws_compat = new;
aws_compat.decrypt?;
Contributing
See CONTRIBUTING.md for development guidelines.
License
Apache 2.0 - See LICENSE for details.
Support
- Documentation: https://docs.hanzo.ai/kbs
- Issues: https://github.com/hanzoai/hanzo-node/issues
- Discord: https://discord.gg/hanzo