EKM System Design for Writer Inc.

Interactive visualization of Enterprise Key Management approaches, third-party solutions, and architecture patterns for a multi-cloud LLM platform

Categories

Edge Types

Uses
Wraps / Encrypts
Integrates
Competes
Provisions
Extends
Click on a concept to see details

1. What Is EKM and Why It Matters

Enterprise Key Management (EKM) gives each customer control over the encryption keys that protect their data inside a SaaS product. Slack popularised the model: the customer creates a CMK (Customer Master Key) in their own AWS account; Slack uses that key -- via cross-account IAM grants -- to wrap and unwrap per-tenant Data Encryption Keys (DEKs) at rest. If the customer revokes the IAM role, Slack loses the ability to decrypt and data becomes inaccessible within the DEK cache TTL.

For Writer Inc., a 100-person company building enterprise LLMs, the same semantics apply to prompts, completions, fine-tuning datasets, model artifacts, and conversation history.

2. EKM Design Options (A - D)

Option A: EKM-Lite (BYOK Wrapper)

Build estimate: 2 - 4 weeks

Customer provides a CMK ARN or resource-ID. Writer uses it for envelope encryption. Simplest path -- no revoke semantics, key stays in cloud KMS.

  • Fastest to ship
  • SOC 2 checkbox satisfied
  • No instant revoke -- customer must request key disable

Option B: Slack-Style EKM Recommended

Build estimate: 6 - 10 weeks

Customer creates CMK in their own AWS/GCP account. Writer calls customer KMS via cross-account IAM to wrap/unwrap DEKs. Customer revokes IAM role to cut access instantly.

  • True customer control with instant revoke
  • Full audit trail in customer's CloudTrail / Cloud Audit Logs
  • Requires DEK cache (TTL 5 - 15 min) + circuit-breaker
  • Customer onboarding: Terraform/CloudFormation template for IAM role + CMK policy

Option C: HYOK / XKS / HSM

Build estimate: 12 - 16 weeks

Customer hosts keys entirely outside the cloud. Uses AWS XKS proxy or GCP EKM endpoint. Keys never leave customer premises.

  • Maximum possible control -- meets defence/intelligence bar
  • Latency-sensitive (every unwrap is an external call)
  • Customer must operate XKS proxy or CloudHSM (~$1,100/mo per HSM)

Option D: Vendor Control Plane (Baseline)

Already built (default)

Writer manages all keys internally. Standard cloud encryption with Writer-owned KMS keys. No customer key control.

  • Zero customer effort
  • Cannot market as EKM / BYOK
  • Suitable for SMB / self-serve plans

The recommended Slack-style EKM architecture consists of these components:


┌──────────────────────────────────────────────────────────────┐
│  Customer AWS / GCP Account                                  │
│  ┌────────────┐   IAM role / service-account grant           │
│  │  CMK (KMS) │ ◄──── Writer Crypto Service calls            │
│  └────────────┘       GenerateDataKey / Decrypt              │
│  CloudTrail / Cloud Audit Logs                               │
└──────────────────────────────────────────────────────────────┘
                          │
           wrap/unwrap DEK│
                          ▼
┌──────────────────────────────────────────────────────────────┐
│  Writer Infrastructure                                       │
│                                                              │
│  ┌─────────────────┐    ┌───────────────────────────┐        │
│  │  Writer App      │──► │  Crypto Service            │       │
│  │  (LLM Platform)  │    │  • envelope encrypt/decrypt│       │
│  └─────────────────┘    │  • DEK cache (TTL 5-15 min)│       │
│                          │  • circuit breaker          │       │
│                          │  • audit log                │       │
│                          └───────────┬───────────────┘        │
│                                      │                        │
│                          ┌───────────▼───────────────┐        │
│                          │  Global Key Registry       │       │
│                          │  tenant → cloud, key_arn,  │       │
│                          │  status, rotation_schedule │       │
│                          └───────────┬───────────────┘        │
│                                      │                        │
│                          ┌───────────▼───────────────┐        │
│                          │  Encrypted Tenant Data     │       │
│                          │  S3/GCS, RDS/CloudSQL,     │       │
│                          │  prompts, completions,     │       │
│                          │  fine-tuning data          │       │
│                          └───────────────────────────┘        │
└──────────────────────────────────────────────────────────────┘
            

Envelope Encryption Flow

  1. Write path: Crypto Service calls customer KMS GenerateDataKey → receives plaintext DEK + wrapped DEK. Encrypt data with plaintext DEK (AES-256-GCM). Store wrapped DEK alongside ciphertext. Wipe plaintext DEK from memory.
  2. Read path: Check DEK cache. On miss, call customer KMS Decrypt with wrapped DEK → get plaintext DEK. Decrypt data. Cache plaintext DEK (TTL 5 - 15 min).
  3. Revoke path: Customer removes IAM role → next cache miss fails → data inaccessible within cache TTL.

Implementation Milestones

WeekMilestone
1 - 2Crypto Service scaffold, envelope encrypt/decrypt, unit tests
3 - 4Cross-account IAM integration (AWS), customer onboarding Terraform module
5 - 6DEK cache + circuit breaker, GCP Cloud KMS integration, key registry
7 - 8Key rotation automation, revoke testing, audit log pipeline
9 - 10Admin dashboard, customer onboarding wizard, load testing, security review

4. Multi-Cloud Strategy (AWS + GCP)

When Writer has tenant deployments in both GCP and AWS, EKM becomes a multi-cloud CMK problem. Three viable designs exist:

1. Per-Cloud EKM Recommended

AWS KMS for AWS tenants, GCP Cloud KMS for GCP tenants. A global key registry maps each tenant to cloud + key ARN/resource-ID. No cross-cloud key transport.

Requires: two onboarding packs (Terraform + gcloud), two audit integrations.

2. One External Root Key (HYOK)

Customer holds a single root key in an external HSM or Fortanix/Thales. Both clouds call out to the external key store for wrap/unwrap. Unified control but highest latency and complexity.

3. Canonical-Cloud Encryption

Pick one cloud as the encryption authority (e.g. AWS KMS for all). GCP workloads call out to AWS for key ops. Adds cross-cloud latency and a hard dependency. Generally avoid.

Product Changes for Multi-Cloud

  • Global Key Registry -- central DB table: tenant_id, cloud_provider, key_arn_or_resource_id, status, rotation_schedule, created_at
  • Unified Envelope Format -- ciphertext header includes cloud_provider field so any service can route to the correct KMS
  • Two Onboarding Packs -- Terraform module for AWS customers, gcloud / Terraform module for GCP customers

Pricing Reference (Multi-Cloud)

ServiceKey CostAPI CallsNotes
AWS KMS$1 / key / month$0.03 per 10kCustomer-managed CMK; free tier: 20k requests/mo
GCP Cloud KMS$0.06 / key-version / month$0.03 per 10k opsCloud EKM pricing may differ for external keys
AWS CloudHSM~$1,100 / month per HSMIncludedFIPS 140-2 Level 3; minimum 2 for HA

5. Top Third-Party Systems

Two third-party platforms stand out for providing multi-cloud EKM / HYOK posture without building everything in-house:

Fortanix Data Security Manager (DSM)

$3 - 5k / month base + per-key fees • SOC 2, FIPS 140-2 Level 3 (SGX)

Cloud-native, multi-cloud KMS backed by Intel SGX confidential computing. Provides a unified REST API for envelope encryption across AWS, GCP, and Azure. Supports BYOK import, external key store, and automated key rotation.

System Design with Fortanix:

  1. Customer creates an account + group in Fortanix DSM SaaS
  2. Customer generates or imports root key into Fortanix (SGX enclave)
  3. Writer Crypto Service calls Fortanix REST API for wrap/unwrap
  4. Fortanix syncs wrapped material to AWS KMS / GCP Cloud KMS if needed
  5. Customer disables key or removes Writer app → instant revoke
Pros: Multi-cloud native, SGX-backed, REST API, fast integration (~4 weeks)
Cons: SaaS dependency, vendor lock-in risk, less enterprise pedigree than Thales

Thales CipherTrust Manager / CCKM

$50 - 100k / year enterprise license • FIPS 140-2 Level 3 (Luna HSM)

Enterprise-grade key lifecycle management with the strongest compliance pedigree in the HSM market. CipherTrust Cloud Key Manager (CCKM) syncs customer root keys into AWS/GCP KMS. Available as on-prem appliance or SaaS.

System Design with Thales:

  1. Customer deploys CipherTrust Manager (on-prem or SaaS)
  2. Root key generated inside Luna HSM, never exported
  3. CCKM syncs wrapped CMK material into customer's AWS KMS / GCP KMS
  4. Writer uses standard cloud KMS APIs -- no direct Thales integration needed
  5. Customer rotates or revokes via CipherTrust console → KMS key disabled
Pros: Strongest compliance pedigree, HSM-backed, supports HYOK natively, on-prem option
Cons: Higher cost, complex deployment, heavier integration, slower to get started

6. Full Comparison: All Approaches

Beyond the two top third-party systems, several other approaches and tools were evaluated:

ApproachTypeBuild TimeMulti-CloudCustomer RevokeCost SignalBest For
Native Per-Cloud KMS EKMBuild6 - 10 wkYes (per-cloud)Instant (IAM revoke)$1/key/mo KMSRecommended default
Fortanix DSMVendor~4 wkYes (unified API)Instant (key disable)$3-5k/moSpeed + multi-cloud
Thales CipherTrustVendor~8 wkYes (CCKM sync)Via CipherTrust console$50-100k/yrStrictest compliance
WorkOS VaultSDKDaysYesVia WorkOS dashboardUsage-basedFastest integration
Acra (DB Proxy)Proxy4 - 6 wkLimited (SQL only)Via KMIP/Vault keyOpen-source + supportField-level SQL encryption
Homegrown DB-ProxyBuild3 - 6 moCustomCustomEng cost onlyUnique requirements
HashiCorp Vault TransitSelf-host4 - 8 wkYesVia Vault policyOpen-source / EnterpriseExisting Vault users

WorkOS Vault -- System Design

WorkOS Vault is a managed BYOK/EKM abstraction layer. Writer integrates via SDK; WorkOS stores wrapped DEKs; the customer CMK stays in their own AWS/GCP KMS.

  1. Customer configures CMK in WorkOS dashboard (points to their AWS/GCP key)
  2. Writer calls workos.vault.encrypt(tenant_id, plaintext)
  3. WorkOS generates DEK, wraps with customer CMK, returns ciphertext + wrapped DEK
  4. On read: workos.vault.decrypt(tenant_id, ciphertext)
  5. Customer disables key in WorkOS → decrypt calls fail

Trade-off: fastest path to market (days of integration), but less battle-tested than native KMS and adds a SaaS dependency in the hot path.

Acra -- System Design

Acra is a transparent database proxy (by Cossack Labs) that encrypts/decrypts at the column or field level. It sits between the application and PostgreSQL/MySQL. Customer CMK plugs in via KMIP or HashiCorp Vault.

  1. Deploy AcraServer as a sidecar or separate service
  2. Point Writer app DB connection to AcraServer (transparent proxy)
  3. Configure per-tenant encryption keys via KMIP or Vault
  4. Writes: AcraServer encrypts designated columns before INSERT
  5. Reads: AcraServer decrypts on SELECT transparently
  6. Revoke: remove key from KMIP/Vault → reads return encrypted blobs

Trade-off: transparent to app code, but limited to SQL, encrypted columns lose queryability, and adds ~1-2ms latency per query. Best for PII field encryption rather than full-platform EKM.

7. Decision Guidance for Writer

Recommendation

  1. Default tier (self-serve / SMB): Writer-managed keys (Option D). No customer effort.
  2. Enterprise tier: Slack-style EKM (Option B) with per-cloud native KMS. 6 - 10 week build. Offer as a paid add-on.
  3. If time-to-market is critical: Start with WorkOS Vault (days of integration) while building native EKM in parallel.
  4. If a customer demands HYOK: Evaluate Fortanix DSM as the fastest path, or Thales CipherTrust for the strongest compliance story.
  5. Avoid homegrown DB-proxy and canonical-cloud encryption patterns.

Packaging Suggestions

PlanEncryptionKey ControlRevoke
Free / ProWriter-managed (AES-256)NoneN/A
EnterpriseSlack-style EKMCustomer CMK in their accountInstant (IAM revoke)
Enterprise+HYOK via Fortanix / ThalesCustomer HSM / external KMSInstant (key disable)

8. Operational Considerations

  • Key Rotation: Automate annual CMK rotation. DEKs re-wrapped with new CMK version; data re-encryption is not needed (envelope model).
  • Availability: DEK cache (TTL 5 - 15 min) ensures continued operation during brief KMS outages. Circuit breaker prevents cascading failures.
  • Audit: Every wrap/unwrap call logged in customer's CloudTrail / Cloud Audit Logs. Writer maintains internal audit log for compliance reporting.
  • Onboarding: Provide IaC templates (Terraform / CloudFormation) that create IAM role + CMK policy. Target: customer completes setup in < 30 minutes.
  • Incident Response: If customer revokes access, Writer surfaces a clear “data unavailable -- contact your admin” message. No data loss; re-grant IAM role restores access.
  • Performance: Expect ~2-5ms overhead for KMS calls on cache miss. With 5 - 15 min TTL, 99%+ of operations served from cache.