Skip to main content

Security Architecture

Qpher is built from the ground up as a security product. Every layer of the platform enforces strict boundaries around your cryptographic keys and data. This page explains the key architectural decisions that keep your keys safe.

Core Guarantee

Your private keys never leave our secure enclave. All cryptographic operations happen server-side, inside the KMS-Orchestrator boundary.

Service Diagram​

Qpher uses a microservices architecture. Each service has a single responsibility, and communication between services is authenticated with service tokens.

The KMS-Orchestrator is the only service that can access private key material. The KEM Service and Signature Service send operation requests to the KMS-Orchestrator and receive results (ciphertexts, signatures) back. They never see the underlying keys.

Gateway Auth Pipeline​

Every API request passes through a 7-stage authentication and authorization pipeline before reaching any backend service.

StageWhat HappensOn Failure
1. Skip checkHealth and metrics endpoints bypass auth--
2. Extract API keyRead the x-api-key header401 Missing API key
3. Resolve tenantHash the key and look up the tenant401 Invalid API key
4. Inject contextAttach X-Tenant-ID and X-Request-ID headers--
5. Rate limitCheck per-tenant rate limits via Redis429 Rate limit exceeded
6. Policy checkEvaluate access rules in the Policy Engine403 Access denied
7. RouteForward the request to the appropriate service--

No request reaches a backend service without passing all seven stages.

Private Keys Stay in the KMS-Orchestrator​

The most important security boundary in Qpher is the KMS-Orchestrator enclave:

  • Private keys are generated inside the KMS-Orchestrator and never leave it.
  • Keys are encrypted at rest using AES-256-GCM before being written to disk.
  • The database stores a handle (a reference path), not the key bytes themselves.
  • There is no API endpoint to export or download a private key.

When you call /kem/encrypt or /signature/sign, the KEM Service or Signature Service forwards your request to the KMS-Orchestrator. The KMS-Orchestrator loads the private key, performs the operation, and returns only the result.

Tenant Isolation​

Qpher is a multi-tenant platform. Every tenant's data is strictly separated through four layers of isolation:

  1. Repository layer -- Every database query includes a tenant_id filter. There is no way to query data across tenants.
  2. Database constraints -- Unique indexes are scoped to (tenant_id, ...), preventing data collisions between tenants.
  3. Context propagation -- The gateway injects X-Tenant-ID into every downstream request. Services never derive the tenant ID from user input.
  4. Gateway enforcement -- The API key lookup determines the tenant. A tenant can only access resources associated with their own API key.
No Cross-Tenant Access

Even if a bug existed in a service, database constraints and repository-level filtering prevent one tenant from accessing another tenant's keys or data.

Fail-Closed Design​

Qpher follows a fail-closed philosophy: when something goes wrong, the system denies access rather than allowing it.

ScenarioBehavior
Policy Engine is unavailableAll requests are denied (503)
Tenant lookup failsRequest is rejected (401)
Rate limit service is downRequests are denied, not allowed through
Missing configuration at startupService refuses to start
PQC cryptographic operation failsError is returned, never falls back to weaker crypto

This approach means brief outages may temporarily block requests, but it guarantees that a failure condition never silently weakens your security posture.

What's Next​