Credential Encryption (PMEK)
For: Platform engineers and security teams evaluating the data-at-rest security model for inline AI provider credentials.
Security Overview | mTLS | Bundle Signing | Credential Encryption
Axemere uses PMEK (Platform-Managed Encryption Keys) to encrypt AI provider API keys before they are stored in the database. A database backup, stolen snapshot, or SQL injection attack yields only ciphertext; the encryption key is never stored alongside the data.
Table of Contents
- What Is Encrypted
- How Envelope Encryption Works
- Encryption Flow
- Decryption Flow
- Credential Modes and Encryption Scope
- Threat Model
- See Also
What Is Encrypted
| Credential mode | What is stored in DB | Encrypted? |
|---|---|---|
inline | Actual AI provider API key | Yes — AES-256-GCM |
alias | Name of an environment variable (e.g. OPENAI_API_KEY) | No — not a secret |
byok | Empty: caller supplies the key at request time | N/A |
Only inline mode stores a real secret in the database. alias and byok modes do not need encryption because no secret is persisted.
How Envelope Encryption Works
Axemere uses AES-256-GCM (NIST SP 800-38D, authenticated encryption) with a platform key supplied via environment variable. The ciphertext is self-contained: it includes the nonce and authentication tag alongside the encrypted value.
Encryption Flow
When an inline credential is registered via the admin API or console:
- The CP server reads the
api_keyvalue from the request. - It calls
SecretBackend.Encrypt(orgID, plaintext). - A random 12-byte nonce is generated.
- AES-256-GCM encrypts the value:
ciphertext = Encrypt(platformKey, nonce, plaintext). - The result is base64-encoded and prefixed with
pmek1:to mark the version. - The ciphertext string is stored in
credentials.secret_ref; no plaintext ever reaches the DB.
Decryption Flow
When a gateway requests its credential set via the ListNodeCredentials gRPC call:
- The CP server reads the ciphertext from
credentials.secret_ref. - It detects the
pmek1:prefix and routes to the PMEK backend. - It calls
SecretBackend.Decrypt(orgID, ciphertext). - The nonce is extracted and AES-256-GCM decrypts the value.
- The plaintext API key is returned to the gateway over mTLS; it is never stored or logged by the CP.
Credential Modes and Encryption Scope
Threat Model
| Threat | Mitigated by PMEK? | Notes |
|---|---|---|
| Database backup / dump theft | Yes | Only ciphertext in DB; key not stored there |
| Misconfigured DB IAM | Yes | Same — ciphertext only |
| SQL injection on CP DB | Yes | Only ciphertext reachable |
| Compromised CP process memory | No | Plaintext in memory during request lifecycle |
| Compromised gateway process memory | No | Gateway receives plaintext over mTLS for use in outbound requests |
| mTLS interception | No | Separate concern: see mTLS guide |
| Insider with access to CP infra AND platform key | No | Mitigated by future CMEK (per-org keys in customer-managed KMS) |
PMEK protects the database at rest. It does not protect in-flight data or process memory. That is the correct and intended scope.