Skip to content

docs: ADR-037 revision, versioned envelope and key ring - #111

Merged
ivanball merged 2 commits into
mainfrom
adr-037-key-ring-revision
Aug 15, 2026
Merged

docs: ADR-037 revision, versioned envelope and key ring#111
ivanball merged 2 commits into
mainfrom
adr-037-key-ring-revision

Conversation

@ivanball

Copy link
Copy Markdown
Owner

Revises ADR-037 (field-level encryption at rest) to record the redesigned EncryptedStringConverter, and rebuilds docs/.

What the revision records

  • Versioned storage envelope. Base64 of [key version (1)][nonce (12)][ciphertext][tag (16)]. The previous un-versioned [nonce][ciphertext][tag] layout is gone with no legacy decode path, which is affordable exactly because this ADR has recorded zero adopted columns since 2026-07-06. That window closes at the first adopted column.
  • Key ring. A new constructor over IReadOnlyDictionary<byte, byte[]> plus a nominated current version, validated once (non-null, non-empty, no null entry, every key exactly 32 bytes, current version present) and defensively copied to a FrozenDictionary. The single-key byte[] constructor stays, as sugar for a one-entry ring at version 1.
  • The version byte is authenticated. It travels as AES-GCM associated data on both encrypt and decrypt, so the tag covers it: rewriting it fails decryption even when the substituted version maps to the same key.
  • Rotation story. Add a new key as current while keeping the old registered, deploy, re-encrypt in the background at any pace, retire the old version. The old "no rotation story" and "no key identifier or version in the layout" trade-offs are rewritten to match.
  • Stateless and context-free stance. Version resolution is data-driven from the envelope, never from the DbContext; per-tenant and per-request key selection stay deliberately out of scope for a value converter (that needs a SaveChanges interceptor or application-layer encryption).
  • Per-value overhead moves from 28 bytes to 29 before Base64. Test coverage noted as 11 cases to 21. Every EncryptedStringConverter.cs citation rebased against the branch source. Honest latent posture preserved: still zero production columns.

Source

The code change lands via MMCA.Common PR #247 (ivanball/MMCA.Common#247), unreleased; it ships in the next framework release, and the revision note says so.

Notes

  • docs-src/ edit and the regenerated docs/adr/037-field-level-encryption-at-rest.html, assets/data/search-index.json and sitemap.xml are committed together (freshness gate).
  • The ADR index README.md was left untouched per instructions; its summary cell for 037 still describes the old nonce+ct+tag layout and will need a follow-up.
  • Do not merge without confirmation: a push to main publishes the live site.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KwnaQjfkHbHqoMm4Pec3oE

ivanball and others added 2 commits August 15, 2026 13:12
Records the new storage format for EncryptedStringConverter: Base64 of
[key version (1)][nonce (12)][ciphertext][tag (16)], replacing the
un-versioned layout with no legacy decode path (affordable precisely
because adoption is still zero). Adds the key-ring constructor, the
current-version write / data-driven read model, the version byte
authenticated as AES-GCM associated data, and the stateless,
context-free stance that puts per-tenant key selection out of scope.

Rewrites the "no rotation story", "no key identifier or version" and
28-byte overhead statements (now 29 bytes before Base64), rebases every
line citation against the branch source, and adds a 2026-08-15 revision
note. Documents work landing via MMCA.Common PR #247, unreleased.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KwnaQjfkHbHqoMm4Pec3oE
The index summary still described the un-versioned Base64 nonce+ct+tag
layout and a single 32-byte key. Updated to the versioned envelope and
the key ring, keeping the row's existing style: mechanism first, then
the unadopted posture, which is now also the reason the old format was
free to replace.

Row count and ADR range are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KwnaQjfkHbHqoMm4Pec3oE
@ivanball
ivanball merged commit 3397f89 into main Aug 15, 2026
3 checks passed
@ivanball
ivanball deleted the adr-037-key-ring-revision branch August 15, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant