MATIH Platform is in active MVP development. Documentation reflects current implementation status.
7. Tenant Lifecycle
Privacy & Compliance
Encryption Key Management

Encryption Key Management

The MATIH platform provides comprehensive encryption for tenant data at rest and in transit. Each tenant can manage their own encryption keys through the Tenant Service, supporting both platform-managed keys and customer-managed keys (BYOK) for compliance requirements.


Encryption Architecture

Tenant Data
    |
    v
+------------------+
| Application      |  AES-256-GCM encryption
| Encryption Layer |  Per-tenant Data Encryption Key (DEK)
+------------------+
    |
    v
+------------------+
| Key Encryption   |  RSA-4096 or AES-256
| Key (KEK)        |  Wraps the DEK
+------------------+
    |
    v
+------------------+
| Key Management   |  Azure Key Vault / AWS KMS / GCP KMS
| Service          |  Master key never leaves HSM
+------------------+

Key Hierarchy

Key TypePurposeRotationStorage
Master Key (MK)Root of trust per cloud providerAnnualHSM (never exported)
Key Encryption Key (KEK)Wraps tenant DEKs90 daysKey Vault / KMS
Data Encryption Key (DEK)Encrypts tenant data30 daysEncrypted in database
Transport Key (TLS)Encrypts data in transit90 dayscert-manager

Encryption at Rest

All tenant data is encrypted at rest using AES-256-GCM:

Data StoreEncryption Method
PostgreSQLTransparent Data Encryption (TDE) + application-level column encryption
RedisTLS + encrypted RDB snapshots
KafkaTopic-level encryption via interceptor
Object Storage (S3/Blob)SSE-KMS with tenant-specific key
ElasticsearchNode-level encryption + field-level encryption for PII

API Endpoints

GET    /api/v1/tenants/:tenantId/encryption/keys           # List encryption keys
POST   /api/v1/tenants/:tenantId/encryption/keys           # Create new key
GET    /api/v1/tenants/:tenantId/encryption/keys/:keyId    # Get key metadata
POST   /api/v1/tenants/:tenantId/encryption/keys/:keyId/rotate   # Rotate key
DELETE /api/v1/tenants/:tenantId/encryption/keys/:keyId    # Revoke key
GET    /api/v1/tenants/:tenantId/encryption/status          # Encryption status

Key Rotation

Key rotation is automatic and zero-downtime:

  1. New DEK is generated
  2. New data is encrypted with new DEK
  3. Background process re-encrypts existing data
  4. Old DEK is marked for deletion after grace period
  5. Old DEK is purged after all data is re-encrypted

Customer-Managed Keys (BYOK)

Enterprise tenants can bring their own keys:

FeaturePlatform-ManagedCustomer-Managed (BYOK)
Key generationPlatformCustomer's KMS
Key storagePlatform Key VaultCustomer's Key Vault
Key rotationAutomaticCustomer-triggered
Key revocationPlatform-controlledCustomer-controlled
AvailabilityStandardEnterprise plan

Encryption in Transit

All inter-service communication uses mTLS:

ConnectionProtocolCertificate
External trafficTLS 1.3Let's Encrypt via cert-manager
Inter-servicemTLSInternal CA via cert-manager
Database connectionsTLS 1.2+PostgreSQL server certificate
Kafka connectionsSASL/TLSStrimzi-managed certificates