Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sovereign, high-performance data protection

API Overview & Security

The Eviden KMS server exposes multiple API interfaces over HTTP/TLS and TCP, including standard KMIP protocols, a native REST cryptographic API, access control endpoints, and enterprise cloud provider integrations.

This page provides an architectural overview of all available API endpoints, the request processing pipeline, and the server-side API security measures enforced across all routes.

Eviden KMS API surface: clients, middleware pipeline, endpoint groups and database


API Endpoints

The KMS server exposes endpoints grouped by function:

InterfaceBase PathProtocol / FormatPurpose
KMIP 2.1 JSON TTLVPOST /kmip/2_1KMIP 2.1 over JSON TTLVPrimary standard KMIP management & cryptographic operations
KMIP 1.4 JSON TTLVPOST /kmip/1_4KMIP 1.4 over JSON TTLVLegacy KMIP 1.4 client compatibility
KMIP Binary SocketPort 5696KMIP TTLV over TLS TCPBinary wire-format KMIP protocol (TLS + mTLS required)
REST Native Crypto/v1/crypto/*REST / JSON (JOSE-aligned)Key generation, encryption, decryption, sign, verify, and MAC
Access Control/access/*REST / JSONObject ownership queries, grant/revoke permissions, Crypto Officer ceremony
System & Diagnostics/health, /version (public); /server-info (auth required)REST / JSONService health checks, version information, and server capabilities
JWKS Public KeysGET /.well-known/jwks.jsonJSON Web Key SetPublic key distribution for active keys tagged with jwks (unauthenticated)
PKI & RevocationGET /public/certificates/{issuer_id}/crl, GET /ocsp/{request}RFC 5280 CRL / RFC 6960 OCSPPublic certificate revocation list distribution and OCSP responder
OpenAPI / SwaggerGET /openapi.yaml, GET /swaggerOpenAPI 3.1 & Swagger UIInteractive documentation and API schema download (publicly served)
Cloud Integrations/aws, /google_cse, /ms_dke, /azureekmVendor-specific REST protocolsExternal Key Store integrations (AWS XKS, Google CSE, MS DKE, Azure EKM)

See KMIP Support for KMIP protocol details and Ownership and access rights for access control endpoints.


Calling the KMIP API

This API is documented in the KMIP section of this manual.

Calling the authorization API

This API is documented in the authorization section of this manual.


Authentication

The Eviden server supports various authentication mechanisms: see the authentication section of this manual for details.

When authenticating using JWT, an HTTP Authorization header must be passed with the JWT token as a bearer token:

Authorization: Bearer <JWT_TOKEN>

Security Architecture & Middleware Pipeline

All HTTP requests pass through an Actix-web middleware pipeline executing in LIFO order (the last middleware added via .wrap() runs first on incoming requests). The pipeline enforces defense-in-depth across two distinct tiers:

  1. Application Level: Applied globally across the entire HTTP server (all scopes and routes).
  2. Scope Level: Applied to specific service scopes (such as the default KMIP and REST scope, or dedicated cloud provider scopes).

Middleware pipeline applied to every request to the KMS


Security Measures

1. Transport Security (TLS & mTLS)

All communication with the KMS server is encrypted using TLS:

  • Protocol Versions: Supports TLS 1.2 and TLS 1.3.
  • Cipher Profiles: Uses Mozilla Intermediate v5 cipher suites by default. The cipher list can be customized using --tls-cipher-suites or the tls_cipher_suites key in kms.toml.
  • Mutual TLS (mTLS): Configured with clients_ca_cert_file. Client certificates presented during TLS negotiation are validated against the specified CA. The client certificate's Subject Common Name (CN) is extracted as the authenticated user identity.
  • KMIP Binary Socket Listener: The binary KMIP socket on port 5696 requires both TLS and a clients_ca_cert_file configured to start. The server refuses to listen without them.

For configuration details, see Enabling TLS and Obtaining TLS Certificates.

2. Rate Limiting (DoS & Brute-Force Mitigation)

The KMS server includes a built-in token bucket rate limiter keyed by client peer IP address, backed by the governor crate.

  • Sustained Limit & Burst: Configured via rate_limit_per_second (CLI: --rate-limit-per-second, env: KMS_RATE_LIMIT_PER_SECOND). When set, the burst capacity is automatically scaled to 3x the sustained rate.
  • HTTP 429 Responses: Requests exceeding the quota receive HTTP 429 Too Many Requests, returning Retry-After and X-RateLimit-After headers indicating the wait time in seconds.
  • Global Coverage: Wrapped at the application level, protecting all endpoints including unauthenticated routes and authentication proxies.
  • Startup Protection Warnings: The server warns at startup if rate limiting is omitted while high-cost endpoints are active (e.g., the unauthenticated /v1/auth/* proxy or the Crypto Officer ceremony endpoint).

Reverse Proxy & Load Balancer Caveat

The rate limiter keys strictly on the TCP connection's peer IP address, not on the X-Forwarded-For header. When deployed behind a reverse proxy or load balancer, all client requests arrive from the proxy's IP address and will share a single rate-limiting bucket. In such deployments, configure rate limiting at the reverse proxy/ingress layer, or size rate_limit_per_second accordingly.

For configuration syntax, see Server configuration file.

3. Authentication Pipeline

The HTTP server validates client identities through a cascading middleware chain. When an authenticator succeeds, it populates an AuthenticatedUser extension on the request.

Supported authentication methods include:

  • TLS Client Certificates (tls_auth): Authenticates via X.509 client certificate CN presented over mTLS.
  • JWT / OIDC Bearer Tokens (jwt_auth): Validates OpenID Connect JWT tokens (including JWT-SVID for SPIFFE workloads) from configured identity providers against remote or local JWKS keys. Sent via Authorization: Bearer <TOKEN>.
  • Cosmian Auth Verifier (AuthVerifier): Validates Bearer tokens against JWKS keys when tokens do not include a kid header.
  • API Tokens (api_token): Validates static pre-shared bearer tokens corresponding to symmetric key objects stored in the KMS database.
  • SPIRE App-Tokens (spire_token): Validates X-Vault-Token headers for HashiCorp Vault-compatible Zero-Trust integrations.
  • AWS SigV4 (Sigv4MWare): Authenticates AWS KMS requests on the /aws scope using AWS Signature Version 4 HMAC signatures.
  • Web UI Sessions (SessionAuth): Uses an HttpOnly, SameSite=Lax cookie (auth_session) sealed with AES-256-GCM (key derived from ui_session_salt, or random per process when it is unset). The 24-hour lifetime is enforced by the server, not only by the browser Max-Age.

Web UI Session Lifetime and Revocation

The server enforces the session lifetime itself, from values sealed inside the cookie:

  • Idle timeout: a session unused for 1 hour is refused. Activity on session-authenticated routes extends it: the cookie is re-issued (same session id, same absolute expiry) when its last activity is 5 minutes old or more.
  • Absolute lifetime: 24 hours from login, never extended.
  • Logout revocation: /ui/logout records the session id in the KMS database, so a copy of the cookie kept elsewhere is refused by every instance sharing that database until its expiry. If the revocation cannot be read, the session is refused; if it cannot be written at logout, the cookie is still dropped from the browser and a warning is logged.
  • Account changes: disabling an account at the identity provider or the Auth Verifier does not end an open KMS UI session before its idle or absolute expiry.
  • Load balancer: every instance must use the same ui_session_salt and the same kms_public_url (the public URL of the load balancer), because both feed the cookie key derivation; without a kms_public_url, the URL is built from each instance's own hostname and port and the instances reject each other's cookies. The /ui/login_as throttle is per instance, so the effective quota grows with the number of instances.

Cookies issued by a previous version carry no session id and are refused: users log in again once after an upgrade.

POST /ui/login_as (Auth Verifier password login) is throttled before any credential is relayed: 10 attempts per minute per client IP and 5 per minute per username (case-insensitive; a username longer than 256 bytes is refused with 400), answered with 429 Too Many Requests and a Retry-After header. A 429 from the Auth Verifier itself is relayed to the browser the same way. The client IP is the TCP peer, or the X-Forwarded-For client when the peer is listed in trusted_proxy_cidrs (--audit-trusted-proxy-cidrs); behind a reverse proxy that is not listed there, the per-IP quota is shared by all users.

Fail-Closed Enforcement (EnsureAuth)

The EnsureAuth middleware runs after all credential extractors:

  • If authentication is enabled and all extractors fail, the request is rejected with 401 Unauthorized.
  • If no authentication methods are configured, the request falls back to the configured default_username (default admin), unless --force-default-username is specified.

See Authenticating users to the server and PKCE Authentication.

4. Object Authorization & Access Rights

Once authenticated, the server evaluates access control rules per cryptographic object:

  • Ownership: Every key or secret object has an assigned creator/owner established at creation (Create, CreateKeyPair, Import).
  • Granular Permissions: Object owners or administrators can grant or revoke granular rights (Read, Modify, Destroy, UseKey, Authorize, etc.) via /access/grant and /access/revoke.
  • Role Management ([roles] crypto_officer_users): Restricts critical administrative privileges and key lifecycle management to designated Crypto Officer identities.
  • Crypto Officer Ceremony: Optional quorum-based dual control requiring multi-party authorization for high-security key operations.

See Ownership and access rights and Role Management and Key Ceremony.

5. HTTP Protocol & Boundary Hardening

  • Security Headers: All HTTP responses include X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none' to block clickjacking and prevent framing in unauthorized web contexts.
  • Payload Size Limits: Strict 64 MB deserialization ceiling prevents memory exhaustion and DoS from maliciously oversized KMIP or JSON bodies.
  • CORS Scope Isolation: The default KMIP and REST scope (/kmip, /v1/crypto, /access) defaults to same-origin. Cross-origin access requires explicit approval in cors_allowed_origins. The cloud provider scopes /aws and /google_cse enable permissive CORS as required by their protocol specifications. The /ms_dke scope (Microsoft Double Key Encryption) denies cross-origin browser requests, like Azure EKM: Office DKE clients are native applications that send no browser Origin.

6. Audit Logging & Non-Repudiation

When enabled, the audit logging middleware records every request of the default scope (/kmip, /access, certificates, …) and of the REST Native Crypto API (/v1/crypto) into a tamper-evident, cryptographically chained JSONL log. The other scopes (Google CSE, Microsoft DKE, AWS XKS, Azure EKM, /tokenize, Vault transit/PKI) are not recorded:

  • Pre-Authentication Recording: In these scopes, the audit middleware wraps outside the authentication layers, capturing both successful operations and failed attempts (401 Unauthorized, 403 Forbidden).
  • REST Native Crypto API events: the operation is the HTTP method and route (e.g. POST /v1/crypto/encrypt, DELETE /v1/crypto/keys/{kid}) and object_uid is the key used, the created key, or, for encrypt with cek_kid, the exported CEK key.
  • Trusted Proxy CIDRs: Client IP addresses are extracted from X-Forwarded-For only when the immediate peer IP matches configured CIDR ranges in audit_trusted_proxy_cidrs.
  • Failure Modes: Configurable via audit_failure_mode to either continue (log failure and proceed) or reject (return HTTP 503 if an event cannot be queued for the writer; a later backend write failure is recorded by an audit:eviction event, not a 503).

See Audit logs and SIEM integration.


REST Native Crypto API

In addition to the KMIP protocol, the server exposes a lightweight JOSE-compatible REST API under /v1/crypto for encrypt, decrypt, sign, verify, and MAC operations. See the REST Native Crypto API page for full documentation.


OpenAPI Specification and Swagger UI

The KMS server exposes its complete API as an OpenAPI 3.1 specification and serves an interactive Swagger UI browser directly from the server binary. Both are publicly accessible at /openapi.yaml and /swagger.

See OpenAPI Specification and Swagger UI for full details on the interactive documentation, downloading the spec, and using external tools.