feat(tokenize): Chameleon pseudonyms + key-evolving re-keying + FPE (reference engine)#24
Merged
Merged
Conversation
…reference engine)
Implements the masking-layer desensitisation primitives (the one piece not yet on
main after the gate + sealing PRs landed). Algebraic pseudonym is homomorphic under
re-keying, so domain re-tokenisation and key rotation never touch cleartext:
token = H(value)^2 ^ k(domain,epoch) mod P; retoken tweak = k2 * k1^-1 mod Q
scripts/exodus_tokenize.py
- chameleon_token / domain_tweak / retokenize (domain-scoped, cross-domain
unlinkable, key-evolving epochs).
- hmac_pseudonym + build_reid_lookup (governed re-identification dictionary).
- fpe_encrypt/decrypt (reference balanced Feistel, even-length digits).
- one_way_hash / redact / generalize / suppress.
- apply_profile() dispatches by tokenization-profile.v1 scheme.
- stdlib-only; BLAKE3 opportunistic like exodus_seal.py.
scripts/test_exodus_tokenize.py (8 tests, plain-assert idiom)
- verifies the 256-bit reference group is a safe prime; determinism;
cross-domain unlinkability; homomorphic re-tokenisation == native token;
epoch-rotation consistency; FPE round-trip + format; re-id lookup; dispatch.
Reference impl: production needs >=2048-bit MODP/EC group, constant-time bigint,
HSM-held scalars, and NIST FF1 FPE (documented in the module).
mdheller
added a commit
that referenced
this pull request
Jul 6, 2026
…#25) * feat(tokenize): Chameleon pseudonyms + key-evolving re-keying + FPE (reference engine) Implements the masking-layer desensitisation primitives (the one piece not yet on main after the gate + sealing PRs landed). Algebraic pseudonym is homomorphic under re-keying, so domain re-tokenisation and key rotation never touch cleartext: token = H(value)^2 ^ k(domain,epoch) mod P; retoken tweak = k2 * k1^-1 mod Q scripts/exodus_tokenize.py - chameleon_token / domain_tweak / retokenize (domain-scoped, cross-domain unlinkable, key-evolving epochs). - hmac_pseudonym + build_reid_lookup (governed re-identification dictionary). - fpe_encrypt/decrypt (reference balanced Feistel, even-length digits). - one_way_hash / redact / generalize / suppress. - apply_profile() dispatches by tokenization-profile.v1 scheme. - stdlib-only; BLAKE3 opportunistic like exodus_seal.py. scripts/test_exodus_tokenize.py (8 tests, plain-assert idiom) - verifies the 256-bit reference group is a safe prime; determinism; cross-domain unlinkability; homomorphic re-tokenisation == native token; epoch-rotation consistency; FPE round-trip + format; re-id lookup; dispatch. Reference impl: production needs >=2048-bit MODP/EC group, constant-time bigint, HSM-held scalars, and NIST FF1 FPE (documented in the module). * feat(mask): masking PDP — policy veto + tokenize + BEACON_COMMIT seal -> masking-decision Composes the shipped pieces into one enforcement step (P1 #5), evaluated at read/export/activate/re-identify time: policy veto (forbidden identity mixtures, e.g. no_health_adtech) + exodus_tokenize (per-field Chameleon/FPE/hash/redact) + exodus_seal (BEACON_COMMIT receipt over the decision) -> a masking-decision.v1 record (the decision is itself verifiable evidence) scripts/exodus_mask.py - evaluate_masking(record, requesting_realm, audience, profiles, policy, ...): verdict allow / allow_masked / deny / review_required; applies field transforms; re-identification is reason-gated + profile-attr gated; emits masking-decision.v1 with a policy-decision ref + (signed) BEACON_COMMIT receipt. - unlinkable-identifier / side-channel mitigations recorded on every decision. scripts/test_exodus_mask.py (5 tests) - no_health_adtech veto (deny, no record returned); allow_masked tokenizes the field; re-identify requires reason + authz; signed receipt verifies via exodus_seal.verify_receipt; masking-decision.v1 shape. Depends on exodus_tokenize (PR #24). Gateway HTTP wiring (prophet-platform) is the remaining P1 #6 integration; this is the reusable PDP engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the masking-layer desensitisation primitives — the one piece not yet on
mainafter the gate (#22) and forensic-sealing (#20) PRs landed.What
scripts/exodus_tokenize.py(stdlib-only, reference engine):token = H(value)^2 ^ k(domain,epoch) mod P; re-tokenise/rotate via a tweakk2·k1⁻¹ mod Qwith no cleartext.hmac_pseudonym+build_reid_lookup(governed re-identification dictionary).one_way_hash/redact/generalize/suppress.apply_profile()dispatches bytokenization-profile.v1scheme.exodus_seal.py.Tests
scripts/test_exodus_tokenize.py— 8 dependency-free tests (python3 scripts/test_exodus_tokenize.py), including the homomorphic identity (retokenize(t1, tweak) == native token in domain2), epoch-rotation consistency, FPE round-trip + format preservation, re-id lookup, and a safe-prime check on the reference group.Scope / honesty
Reference implementation. Production needs a ≥2048-bit MODP/EC group, constant-time bigint, HSM-held scalars (KMIP/PKCS#11), and NIST FF1 FPE — documented in the module. Consistent with the shipped
CANON-v0.1 = json-canonical; does not introduce CBOR.Next: wire this behind the masking PDP → Catalog Gateway (emits
masking-decision+ BEACON_COMMIT viaexodus_seal).🤖 Generated with Claude Code