OElite.PayloadKeyBoundary 5.0.10-develop.22243
OElite.PayloadKeyBoundary
OElite payload-key boundary (v1) — envelope-encryption key-wrap lifecycle library.
What this is: a policy/correctness boundary — uniform API, singular lifecycle authority, scope authorization, fail-closed semantics, and a mandatory audit choke point.
What this is NOT: process isolation. This library runs in the consumer process; the consumer process holds the master secret, transient KEK material, and returned DEKs/plaintext, and a compromised consumer can observe all of them. It is also NOT a KMS/HSM — v1 backing is software-key custody on approved shared infrastructure (K8s-Secret master secret, MongoDB authoritative lifecycle store, Redis deny-only fast path). Authority: helios/core#35 note 119801 (normative v1 contract), Maya RG-2 acceptance 119817, Marcus RG-1 concurrence 119829.
v1 posture
- Consumer allow-list: Orion only (
OElite.PayloadKeyBoundary:ConsumerIdentity). - Capability: deny-all until the authorized capability flip; the boundary itself imposes no capability claim.
- Wrap profile:
PKB-WRAP-1— versioned AES-256-GCM, fresh stored 96-bit CSPRNG nonce per wrap, 128-bit tag, canonical AAD binding{profileId, scope tuple, keyId, keyVersion, wrapOperationId}. Wire format: the GCM tag travels appended toWrappedDek.Ciphertext(last 16 bytes);WrappedDek.Nonceis the fresh 96-bit wrap nonce. - Lifecycle:
PROVISIONING → ACTIVE → SUPERSEDED → RETAINED → REVOKED / DESTROYED, MongoDB CAS transitions, authenticated records sealed under a distinctly-labelled integrity key, append-only hash-chained transition history, dual control (requester ≠ approver, server-enforced) for restore/destroy. - References: register-before-publish reference accounting; release only after confirmed deletion; GC requires an audited zero-reference proof and retention expiry.
- Redis: deny-only acceleration — never grants authorization; every wrap/unwrap re-authorizes against the authoritative MongoDB store; Redis read/write errors fail closed.
- Audit: context-free
IPayloadKeyAuditSink(default: dedicated MongoDB collection), hash-chained tamper evidence, schema rejection on unknown fields, key-material redaction, deny-on-audit-write-failure. Audit chain is verified at startup and on reconcile. - Denials: indistinguishable bounded denials (
PayloadKeyDeniedException) for unknown/ambiguous/revoked/destroyed/unauthorized — a single uniform message for every deny outcome (no existence oracle). The exception has no caller-readable reason,Dataentries, or inner exception; denial reasons are retained only in the boundary audit chain. - Deny/timeout deadlines: all operations are cancellation/deadline-bounded; ambiguity, backend unavailability, master-secret unavailability, or audit-write failure ⇒ deny before mutation or plaintext.
Configuration (environment references only — never values in code)
| Configuration | Meaning |
|---|---|
OElite.PayloadKeyBoundary:MasterSecretEnvVar |
Name of the env var that carries the operator-generated master secret (≥ 256-bit). |
OElite.PayloadKeyBoundary:ConsumerIdentity |
Verified consumer identity; must be on the allow-list. |
OElite.PayloadKeyBoundary:AllowedConsumers |
Consumer allow-list (default: Orion). |
OElite.PayloadKeyBoundary:EnvironmentTier |
Production / NonProduction. |
OElite.PayloadKeyBoundary:MongoDatabase |
Per-project MongoDB database for lifecycle + audit state. |
OElite.PayloadKeyBoundary:StoreId |
Optional stable store identity qualifying Redis deny entries. Unset ⇒ derived deterministically from MongoDatabase so independently initialized stores never observe each other's deny state. |
OElite.PayloadKeyBoundary:RedisDenyKeyPrefix |
Redis key prefix for the deny fast path. |
The master secret is injected as an environment variable from a K8s Secret at process start; in Production the boundary fails fast at startup when it is absent or shorter than 32 bytes. In non-Production it denies every request. The master secret is never persisted by the boundary, never logged, and excluded from backups by policy.
Usage (Orion only)
var boundary = await PayloadKeyBoundary.CreateAsync(options, loggerFactory, ct);
using (boundary)
{
var key = await boundary.ProvisionOrResolveCurrentAsync(scope, ct);
var wrapped = await boundary.WrapAsync(scope, key, dek, ct);
// register the envelope reference BEFORE publishing it
await boundary.RegisterReferenceAsync(scope, key, objectRef, ct);
}
PayloadKeyScope values must come from the consumer's trusted server-derived context; caller-constructed scope DTOs are not authority and must match the verified consumer registration at every operation.
Capability flag
SupportsEncryptionAtRest remains false platform-wide until Olivia's negative evidence and fresh exact-head Marcus + Maya reviews pass. This library does not and cannot flip that flag.
No packages depend on OElite.PayloadKeyBoundary.
.NET 10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- MongoDB.Driver (>= 3.11.1)
- StackExchange.Redis (>= 2.9.17)
| Version | Downloads | Last updated |
|---|---|---|
| 5.0.10-develop.22271 | 0 | 12/02/2026 |
| 5.0.10-develop.22268 | 0 | 12/02/2026 |
| 5.0.10-develop.22267 | 0 | 12/02/2026 |
| 5.0.10-develop.22254 | 0 | 12/02/2026 |
| 5.0.10-develop.22243 | 23 | 12/02/2026 |