KMS Training Environment Architecture Architecture

Confidential AI Network Documentation

KMS and Training Environment Architecture

Contract Management System

Document Version: 3.0

Date: December 2024 Author: Contract Management System Team

---

Table of Contents

  • Executive Summary
  • KMS Architecture Overview
  • How KMS Works in Confidential Computing
  • TDC and TDP Encryption Key Management
  • Training Environment Provisioning
  • Automated Training Execution
  • Confidential Computing Infrastructure
  • Security and Compliance
  • Implementation Roadmap
  • ---

    1. Executive Summary

    1.1 Overview

    This document explains how KMS (Key Management Service) actually works in confidential computing environments during AI model training. The system provides end-to-end encryption, secure key management, and automated training execution in encrypted, isolated environments.

    1.2 Key Features

  • KMS Integration: Centralized key management for DID:web, data encryption, and model encryption
  • Data Encryption: Encrypted storage and transmission of datasets and models
  • Automatic Provisioning: Training environments provisioned based on contract specifications
  • Automated Training: Training execution triggered when all parties sign contracts
  • Confidential Computing: Secure processing in encrypted VMs/containers
  • Contract-Driven: Training containers interpret contracts and execute accordingly
  • ---

    2. KMS Architecture Overview

    2.1 KMS Components

    graph TB subgraph "KMS Architecture" KMS_CORE[KMS Core Service] KEY_STORE[Key Store] KEY_ROTATION[Key Rotation Service] KEY_BACKUP[Key Backup Service] AUDIT_KMS[KMS Audit Service] end subgraph "Key Types" DID_KEYS[DID:WEB Keys] DATA_KEYS[Data Encryption Keys] MODEL_KEYS[Model Encryption Keys] SESSION_KEYS[Session Keys] end subgraph "Integration Points" DID_SERVICE[DID Service] ENCRYPTION_SERVICE[Encryption Service] TRAINING_SERVICE[Training Service] CONTRACT_SERVICE[Contract Service] end KMS_CORE --> KEY_STORE KMS_CORE --> KEY_ROTATION KMS_CORE --> KEY_BACKUP KMS_CORE --> AUDIT_KMS DID_KEYS --> KMS_CORE DATA_KEYS --> KMS_CORE MODEL_KEYS --> KMS_CORE SESSION_KEYS --> KMS_CORE DID_SERVICE --> DID_KEYS ENCRYPTION_SERVICE --> DATA_KEYS ENCRYPTION_SERVICE --> MODEL_KEYS TRAINING_SERVICE --> SESSION_KEYS CONTRACT_SERVICE --> KMS_CORE

    ---

    3. How KMS Works in Confidential Computing

    3.1 The Complete Training Flow

    This is how KMS actually works during training in confidential computing environments:

    #### Phase 1: Contract Signing & Key Distribution
  • Contract Creation: TDC creates contract specifying training requirements
  • Key Generation: KMS generates unique encryption keys for this training session
  • Key Distribution: Keys are distributed to all parties (TDP, TDC, CCRP) via secure channels
  • Contract Signing: All parties sign the contract using their DID:web keys
  • #### Phase 2: Environment Provisioning
  • CCRP Provisioning: CCRP provisions encrypted Azure Container Instances
  • Key Injection: Training container receives session keys via secure key injection
  • Environment Isolation: Container runs in encrypted, isolated environment
  • Access Control: Only authorized training processes can access the keys
  • #### Phase 3: Training Execution
  • Data Decryption: Training container decrypts datasets using KMS-provided keys
  • Model Loading: AI model is loaded and decrypted in memory
  • Secure Training: Training runs in encrypted memory space
  • Result Encryption: Training results are encrypted before storage/transmission
  • 3.2 KMS Key Management During Training

    sequenceDiagram participant TDC as Training Data Consumer participant KMS as Key Management Service participant CCRP as CCRP Provider participant Container as Training Container participant Azure as Azure Cloud TDC->>KMS: Request training session keys KMS->>KMS: Generate session-specific keys KMS->>TDC: Return encrypted session keys TDC->>CCRP: Provision training environment CCRP->>Azure: Create encrypted container CCRP->>Container: Inject session keys securely Container->>KMS: Request data decryption keys KMS->>Container: Provide decryption keys Container->>Container: Decrypt and train Container->>KMS: Encrypt training results Container->>TDC: Return encrypted results

    3.3 Key Types and Their Roles

    #### Session Keys (Training-Specific)
  • Purpose: Unique keys for each training session
  • Lifecycle: Generated when contract is signed, destroyed after training
  • Usage: Encrypt/decrypt data during training execution
  • Storage: Stored in Azure Key Vault, injected into training containers
  • #### Data Encryption Keys
  • Purpose: Encrypt datasets uploaded by TDPs
  • Lifecycle: Long-lived, rotated periodically
  • Usage: Decrypt datasets when training begins
  • Storage: Stored in KMS, never exposed to training containers
  • #### Model Encryption Keys
  • Purpose: Encrypt AI models provided by TDCs
  • Lifecycle: Generated per model, stored securely
  • Usage: Decrypt models when loading into training environment
  • Storage: Stored in KMS, accessed via secure API calls
  • #### DID:WEB Keys
  • Purpose: Identity verification and contract signing
  • Lifecycle: Long-lived, stored in user wallets
  • Usage: Sign contracts, verify identity
  • Storage: Stored in user's DID wallet, never in KMS
  • ---

    4. TDC and TDP Encryption Key Management

    4.1 TDP (Training Data Provider) - Dataset Encryption

    #### Key Generation & Management:
  • TDP generates their own encryption keys for datasets before upload
  • Keys are NOT stored in the central KMS - they remain under TDP control
  • Datasets are encrypted locally by TDP before transmission
  • Only encrypted datasets are uploaded to the system
  • #### Security Model:
    graph LR subgraph "TDP Environment" TDP[Training Data Provider] LocalKeys[Local Encryption Keys] RawData[Raw Datasets] EncryptedData[Encrypted Datasets] end subgraph "Contract Management System" KMS[KMS Service] SessionKeys[Training Session Keys] TrainingContainer[Training Container] end TDP -->|Generates| LocalKeys LocalKeys -->|Encrypts| RawData RawData -->|Becomes| EncryptedData EncryptedData -->|Uploads| ContractSystem KMS -->|Provides| SessionKeys SessionKeys -->|Decrypts| EncryptedData
    #### TDP Workflow:
  • Local Encryption: TDP encrypts datasets with their own keys
  • Secure Upload: Only encrypted data is transmitted
  • Key Sharing: TDP shares decryption keys via secure channels when training begins
  • Training Access: Training container receives keys to decrypt datasets
  • Key Destruction: Session keys destroyed after training completion
  • 4.2 TDC (Training Data Consumer) - Model Encryption

    #### Key Generation & Management:
  • TDC generates encryption keys for their AI models
  • Models are encrypted locally before upload
  • Keys remain under TDC control until training session
  • Only encrypted models are stored in the system
  • #### Security Model:
    graph LR subgraph "TDC Environment" TDC[Training Data Consumer] ModelKeys[Model Encryption Keys] RawModel[Raw AI Model] EncryptedModel[Encrypted Model] end subgraph "Training Environment" KMS[KMS Service] SessionKeys[Training Session Keys] TrainingContainer[Training Container] end TDC -->|Generates| ModelKeys ModelKeys -->|Encrypts| RawModel RawModel -->|Becomes| EncryptedModel EncryptedModel -->|Uploads| TrainingSystem KMS -->|Provides| SessionKeys SessionKeys -->|Decrypts| EncryptedModel
    #### TDC Workflow:
  • Local Encryption: TDC encrypts AI models with their own keys
  • Secure Storage: Only encrypted models are stored
  • Key Provisioning: Keys provided to training environment when needed
  • Training Execution: Model decrypted in secure memory during training
  • Secure Cleanup: All decrypted data erased after training
  • 4.3 Key Distribution During Training

    #### Multi-Key Architecture:
    sequenceDiagram participant TDP as Training Data Provider participant TDC as Training Data Consumer participant KMS as Key Management Service participant Container as Training Container Note over TDP,TDC: Pre-Training: Data/Model Encryption TDP->>TDP: Encrypt datasets with local keys TDC->>TDC: Encrypt models with local keys Note over TDP,TDC: Training Session: Key Distribution TDP->>KMS: Provide dataset decryption keys TDC->>KMS: Provide model decryption keys KMS->>KMS: Generate session-specific keys KMS->>Container: Inject all required keys Note over Container: Training Execution Container->>Container: Decrypt datasets using TDP keys Container->>Container: Decrypt models using TDC keys Container->>Container: Execute training in encrypted memory Note over Container: Post-Training: Cleanup Container->>Container: Destroy all session keys Container->>Container: Erase decrypted data from memory

    4.4 Security Benefits of This Approach

    #### Data Privacy:
  • TDPs maintain control over their dataset encryption keys
  • TDCs maintain control over their model encryption keys
  • No single point of failure for key management
  • Data remains encrypted until explicitly needed for training
  • #### Access Control:
  • Keys only shared when training contracts are signed
  • Temporary access during training sessions only
  • Automatic key rotation for each training session
  • Audit trail of all key access and usage
  • #### Compliance:
  • GDPR compliance through data encryption at rest
  • Data residency maintained by TDP/TDC control
  • Audit logging of all encryption/decryption operations
  • Secure key transmission via encrypted channels
  • 4.5 Technical Implementation

    #### Key Storage Architecture:
    graph TB subgraph "TDP Environment" TDPKeys[TDP Encryption Keys] TDPData[TDP Encrypted Datasets] end subgraph "TDC Environment" TDCKeys[TDC Encryption Keys] TDCModel[TDC Encrypted Models] end subgraph "Contract System" KMS[KMS Service] SessionKeys[Session Keys] ContractDB[Contract Database] end subgraph "Training Environment" TrainingContainer[Training Container] SecureMemory[Encrypted Memory] end TDPKeys -.->|Secure Channel| KMS TDCKeys -.->|Secure Channel| KMS KMS --> SessionKeys SessionKeys --> TrainingContainer TrainingContainer --> SecureMemory

    ---

    5. Training Environment Provisioning

    5.1 Azure Container Instance Setup

    graph LR subgraph "Azure Cloud" subgraph "Confidential Computing" Container[Training Container] Enclave[Secure Enclave] Memory[Encrypted Memory] end subgraph "Azure Services" KeyVault[Azure Key Vault] ContainerRegistry[Container Registry] Monitor[Azure Monitor] end end Container --> Enclave Enclave --> Memory Container --> KeyVault Container --> ContainerRegistry Container --> Monitor

    5.2 Container Security Features

    #### Runtime Protection
  • Process Isolation: Training processes isolated from host system
  • Memory Encryption: All memory encrypted using CPU instructions
  • Secure Boot: Container images verified before execution
  • Network Isolation: Limited network access to required services only
  • #### Key Injection Process
  • Secure Channel: Keys transmitted via Azure Key Vault
  • Memory Protection: Keys stored in encrypted memory only
  • Access Control: Only authorized training code can access keys
  • Audit Trail: All key access logged for compliance
  • ---

    6. Automated Training Execution

    6.1 Training Trigger Flow

    graph TD A[Contract Signed] --> B[KMS Generates Session Keys] B --> C[CCRP Provisions Environment] C --> D[Keys Injected into Container] D --> E[Training Container Starts] E --> F[Data Decryption] F --> G[Model Loading] G --> H[Training Execution] H --> I[Result Encryption] I --> J[Results Returned] J --> K[Session Keys Destroyed]

    6.2 Training Container Operations

    #### Startup Sequence
  • Environment Validation: Verify secure environment
  • Key Retrieval: Get session keys from Azure Key Vault
  • Contract Loading: Load and validate training contract
  • Resource Allocation: Allocate encrypted memory and storage
  • Training Initiation: Begin training process
  • #### Training Process
  • Data Processing: Decrypt and process training datasets
  • Model Training: Execute AI model training algorithms
  • Progress Monitoring: Track training progress and metrics
  • Result Generation: Generate and encrypt training results
  • Cleanup: Securely erase all sensitive data
  • ---

    7. Confidential Computing Infrastructure

    7.1 Azure Confidential Computing Features

    #### Hardware Security
  • Intel SGX: Secure Guard Extensions for memory encryption
  • AMD SEV: Secure Encrypted Virtualization
  • ARM TrustZone: Hardware-based security isolation
  • #### Container Security
  • Encrypted Containers: All container data encrypted
  • Secure Attestation: Verify container integrity before execution
  • Runtime Protection: Continuous security monitoring
  • 7.2 Security Layers

    graph TB subgraph "Application Layer" Training[Training Code] Contract[Contract Logic] API[API Interface] end subgraph "Security Layer" Encryption[Memory Encryption] Isolation[Process Isolation] Monitoring[Security Monitoring] end subgraph "Infrastructure Layer" Azure[Azure Cloud] Enclave[Secure Enclave] Hardware[Hardware Security] end Training --> Encryption Contract --> Isolation API --> Monitoring Encryption --> Enclave Isolation --> Hardware Monitoring --> Azure

    ---

    8. Security and Compliance

    8.1 Compliance Standards

    #### Data Protection
  • GDPR Compliance: Data residency and privacy protection
  • SOC 2 Type II: Security and availability controls
  • ISO 27001: Information security management
  • HIPAA: Healthcare data protection (if applicable)
  • #### Audit and Monitoring
  • Key Access Logging: All KMS operations logged
  • Training Monitoring: Real-time training environment monitoring
  • Compliance Reporting: Automated compliance reports
  • Incident Response: Security incident detection and response
  • 8.2 Security Best Practices

    #### Key Management
  • Key Rotation: Automatic key rotation based on policy
  • Access Control: Role-based access to KMS functions
  • Backup and Recovery: Secure key backup and recovery procedures
  • Multi-Factor Authentication: MFA for all KMS access
  • ---

    9. Implementation Roadmap

    9.1 Phase 1: Foundation (Months 1-3)

  • [ ] KMS core service implementation
  • [ ] Azure Key Vault integration
  • [ ] Basic encryption/decryption services
  • [ ] DID:web key management
  • 9.2 Phase 2: Training Environment (Months 4-6)

  • [ ] Azure Container Instance setup
  • [ ] Confidential computing configuration
  • [ ] Key injection mechanisms
  • [ ] Basic training container
  • 9.3 Phase 3: Automation (Months 7-9)

  • [ ] Contract-driven provisioning
  • [ ] Automated training execution
  • [ ] Result encryption and delivery
  • [ ] Monitoring and alerting
  • 9.4 Phase 4: Production (Months 10-12)

  • [ ] Security audit and penetration testing
  • [ ] Compliance certification
  • [ ] Production deployment
  • [ ] Ongoing monitoring and maintenance
  • ---

    Summary

    KMS in confidential computing works by:

  • Generating unique session keys for each training session
  • Securely distributing keys to all authorized parties
  • Provisioning encrypted training environments in Azure
  • Injecting keys securely into training containers
  • Running training in encrypted memory with continuous monitoring
  • Destroying session keys after training completion
  • Key Management Summary:

    #### TDP Responsibilities:
  • ✅ Generate encryption keys for datasets
  • ✅ Encrypt datasets locally before upload
  • ✅ Provide decryption keys when training begins
  • ✅ Maintain key security throughout the process
  • #### TDC Responsibilities:
  • ✅ Generate encryption keys for AI models
  • ✅ Encrypt models locally before upload
  • ✅ Provide decryption keys when training begins
  • ✅ Maintain key security throughout the process
  • #### KMS Responsibilities:
  • ✅ Generate session keys for training sessions
  • ✅ Coordinate key distribution to training containers
  • ✅ Manage key lifecycle during training
  • ✅ Ensure secure key destruction after training
  • #### System Benefits:
  • 🔒 End-to-end encryption from data source to training completion
  • 🎯 Granular access control based on training contracts
  • 📊 Audit trail of all encryption/decryption operations
  • 🚀 Scalable architecture supporting multiple TDPs and TDCs

The key insight is that KMS doesn't just store keys - it actively manages the entire lifecycle of encryption keys during training, ensuring that sensitive data and models are never exposed in plain text, even during processing. TDPs and TDCs maintain full control over their encryption keys while enabling secure, contract-driven training in confidential computing environments.

This architecture provides enterprise-grade security for AI training while maintaining the flexibility and automation needed for production use.