fieldseal — Python core
Experimental release: not independently reviewed, not for production data. The cryptographic design this package implements has not been reviewed by anyone outside the project. It is pre-1.0: the stored format may change before 1.0, and data written with it now may have to be re-encrypted if review changes a construction. Writing refuses until you explicitly arm provisional use (spec §4.8). This release is for evaluation and feedback; the terms it is published under are in PRD §8.
The reference Python implementation of the Fieldseal specification, built to
docs/10-core-python.md.
Not for production use, and the library will refuse. Every registered cipher suite is provisional (spec §4.8): its constructions have not been independently reviewed, and Gate 0b of the Phase 0 exit gate (
docs/01-prd.md§8) is still open.encrypt()androtate()raiseSUITE_PROVISIONALunless you explicitly arm provisional use —FIELDSEAL_ARM_PROVISIONAL_SUITES=1in the environment, orarm_provisional_suites=Trueon the constructor. Decryption is deliberately ungated.
Status
| Vector suite | 178/178 pinned results pass on suite 0.7.0-provisional (146 vectors; envelope/ counted in both directions, some blind-index/ vectors also end to end — see harness_notes in the report); no family held out; both §3.5 out-of-band checks pass |
| Gate, parity and totality tests | 131 pass (tests/test_gates.py, tests/test_parity.py) |
| Suites | 0xFF01 (AES-256-GCM). 0xFF02 is registered and refused at construction — it needs an XChaCha backend, blocked on gap G7 |
| Conformance report | tests/run_vectors.py writes the docs/14 §4 JSON to stdout, including pinned_decisions and harness_notes; the TypeScript core's report has the same shape and the same result ids, so the two diff cleanly |
| Milestone | M1 met for the families in the pinned suite. M2 (the independent TypeScript reproduction, docs/18) is what makes these values trustworthy |
Running
py -3 -m venv .venv
.venv/Scripts/python -m pip install -e ".[argon2,dev]"
.venv/Scripts/python -m pytest tests -q
.venv/Scripts/python tests/run_vectors.py > conformance-python.json # report on stdout, prose on stderr
.venv/Scripts/python -m mypy --strict src
What the vectors do not reach, and what this core pins
Spec §9 leaves the precedence among its error codes open (gap G5) and obliges a
Gate 0a implementation to pin an order and declare it. This core follows
docs/09 §3.2 step for step and declares
every pin under pinned_decisions in its report, under the keys docs/14 §4
reserves. The ones an operator will meet:
- Read modes (spec §10.3).
strictraisesNOT_CIPHERTEXTon non-envelope input;permissiveandreadonlyreturn it as-is, warn at construction (FieldsealWarning) and count it inFieldseal.plaintext_reads.readonlyrefusesencrypt()androtate()withMODE_VIOLATIONbefore reading anything.rotate()inpermissivemode is literally decrypt-then-encrypt, so it encrypts unmigrated plaintext (D-13). - Recognition before policy (spec §3.4). An unregistered suite, an
unrecognized version byte or an implausible length is "not one of ours" —
never
SUITE_NOT_ALLOWED. Only a registered suite that the allow-list excludes isSUITE_NOT_ALLOWED. One exception:fmt_ver = 0x02at a plausible length raisesUNKNOWN_FORMAT_VERSIONin every mode (D-03). - Every currently-valid key version is tried (spec §8).
KeyProvider.decryption_keys(header)returns the candidates in preference order; the core verifies each one's commitment constant-time before any AEAD open. No candidate →KEY_UNAVAILABLE; none commits →COMMITMENT_INVALID; an open that fails after a verified commitment →TAG_INVALID.AAD_MISMATCHis never raised: under dual-layer binding a wrong context derives a wrong record key and is indistinguishable from key confusion (G5). - Blind indexes are bytes-in/bytes-out.
nfc-casefold-v1over bytes decodes strict UTF-8 first and refuses invalid input withINVALID_ARGUMENTrather than folding through replacement characters;identityanddigits-only-v1never decode. An unknown IDF or normalizer is aCONFIGURATION_ERROR, never a default. The Unicode version is the interpreter's (unicodedata.unidata_version, reported in the report'senvironment) — CPython 3.14 folds with Unicode 16.0 where the TypeScript core vendors 17.0, which is a real cross-core risk for shared indexes untildocs/09§7 pins a table (D-10).
fieldseal.testing.encrypt_with_materials runs the same API boundary as
encrypt() — mode, arming and length gates included — and replaces only the two
entropy draws (docs/08 §6).
What is deliberately not proven yet
Passing these vectors is weak evidence on its own. The generator that
produced them is not an oracle (docs/08
§7); what makes an expected value trustworthy is two independently written
implementations agreeing on it. This core is one. The TypeScript core, written
from the specification without reading this source, is the other, and that is
M2. The behaviours listed above are not covered by any vector; they are
covered by tests/test_parity.py against this core's own pins, and the
errors/ vector family that would make them a shared check does not exist yet.
This core was written without importing anything from tools/vector-gen/, and
takes HKDF from pyca/cryptography where the generator hand-rolls it from hmac.
That is a deliberate divergence from docs/10 §7, which anticipated the
generator importing fieldseal.testing. Had it done so, M1 would have been
close to tautological — the same code checking itself. The cross-check is
narrower than "independent", though: the two share the canonical_context
layout by construction, so the independence is in HKDF only. See the
divergence note in docs/07 §7.
blind-index/argon2id.json is pinned, and has been since suite 0.6.0-provisional (2026-08-31, docs/07 §7), and this core runs it like any other family. It was held out while the primitive had no external known-answer source: RFC 9106 §5.3's vector supplies a nonzero secret (K) and associated data (X), both forbidden by spec §7.3 and unsuppliable from Python, so passing the project's own vectors would have proved only that two implementations copied one unverified assumption. That is answered — the generator checks argon2-cffi against libsodium's seven published crypto_pwhash answers on every run (libsodium cannot supply K or X either, which makes it the right source for the case §7.3 uses), and the TypeScript core reproduces the same values through node:crypto.
Promoting it also found what the hold-out had been hiding: eight of the family's nineteen vectors declared idf: argon2id with no idf_params, and both cores reject a missing cost as malformed rather than assuming the minimum (docs/08 §4.4). Nothing had run them, so nothing had said so. The #108 review then found that this harness's rejection was an abort with no report where the TypeScript harness's was eight recorded failures; run_blind_index now has the per-vector boundary the other runners had, and a vector it cannot derive — malformed idf_params, or the argon2 extra not installed — is a recorded failure with a reason. The same round added two vectors at a raised cost (t = 4), the only ones that can tell a harness deriving at the declared cost from one deriving at its default (docs/07 §7, 2026-09-01).
Honest limitations
The specification requires every implementation to state these, and
docs/07 §4 requires every shipped artifact to carry them.
- No protection against a compromised application process (spec §2.2 N1). The keys are in that process. Query logs, slow-query logs and replication logs are sensitive artifacts and must be protected like the ciphertext (§2.3).
- Storage overhead is real (§3.3). Every envelope carries 111 bytes of
fixed overhead under
0xFF01: a 9-byte value becomes 120 bytes binary. This core is bytes in, bytes out and never emits base64; a deployment that stores base64 pays a further 33% on every row (about 160 bytes for the same value) and must document it. Across a 20-column, 100M-row table the fixed overhead alone is roughly 220 GB, before index bloat. - The key service is a hard dependency in the read path (§8.1).
EnvelopeKeyProviderunwraps KMS-wrapped DEKs only inwarm(); the value path reads the cache and nothing else, so a miss isKEY_UNAVAILABLE, and a KMS outage meansKEY_UNAVAILABLEfor everything not already cached. Thedegradationargument records the deployment's mode (fail-closed/serve-cached); on the value path both mean the same thing — serve only what the cache can decrypt (docs/09§8.2). No KMS client ships: the provider calls aWrapperyou supply. - The DEK cache is an in-memory plaintext key cache (§5.5). It is
exposed to memory dumps, core files and swap. Entries are held as
bytearrayand overwritten with zeros when evicted — by max-age, max-uses, capacity orDekCache.clear()— which narrows that window and does not close it: CPythonbytesare immutable and freely copied, copies inside dependencies are out of reach, and there is nomlock(docs/10§5). The per-operation record key and the §7.3 Argon2id salt arebytesand are not erased at all.CachePolicy.max_ageandmax_usesare security parameters, not tuning knobs. In a prefork server, construct the client after the fork (gunicornpost_fork): cache contents that survive a fork are DEK copies in every child (docs/09§10). - Two of spec §8's three providers ship.
StaticKeyProvideris test-only, holds key material for the process lifetime, and does not yet emit the outside-test-configuration warning spec §8 asks for.EnvelopeKeyProvideris the production path above.DerivedKeyProvideris not yet ported (docs/10§3). - Error precedence is provisional. Everything under "what this core pins" above may change at Gate 0b; the pins are declared so that a change is visible, not because they are settled.
- Argon2id costs 10–100 ms per query term (spec §7.3). That is wall-clock latency on the requesting thread and a product constraint, not a bug to fix. It is not a process-wide stall: this README previously said the GIL is held for most of it, and that was wrong. Measured 2026-09-09 on argon2-cffi 25.1.0 / argon2-cffi-bindings 26.1.0, CPython 3.14.6 — one hash at the §7.3 parameters takes 36.9 ms and two on separate threads take 40.0 ms, where serialization would cost ~74 ms. A threaded deployment serves other requests through it.
Metadata
Release files for fieldseal 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fieldseal-0.1.1.tar.gz | 70.2 kB | With provenance | Details for fieldseal-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fieldseal-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for fieldseal-0.1.1-py3-none-any.whl |
Total release size: 146.9 kB
Release files / fieldseal-0.1.1.tar.gz
| Download URL | fieldseal-0.1.1.tar.gz |
|---|---|
| Size | 70.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
297832c5dcce8649406aa74e9ea5907b6d422cd6cfaf8cb80370bc2e020bf18f
|
|
BLAKE2b-256 checksum How to use checksums |
c6c19bb0754ceef59e3f473c30722a589772f61e0b1a4bf8a00e7d93cc1fae43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency logRelease files / fieldseal-0.1.1-py3-none-any.whl
| Download URL | fieldseal-0.1.1-py3-none-any.whl |
|---|---|
| Size | 76.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f32923f26527fda4486932893ff58ddfa7c31f1140bd3b948e4125f4c81543df
|
|
BLAKE2b-256 checksum How to use checksums |
0bd80703e6c0cf2cd9e40e0f1bffcaf0e3e8a8faa4d1f77c6170686a2a1d32ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency logSecurity for fieldseal 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for fieldseal-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.