A DER (X.690) encoding/decoding core in Rust under formal verification, with re-runnable evidence and an explicit claim-by-claim assurance map.
Status: pre-1.0 (0.3.0). The acceptance 0.4.0 manifest has 876 requirement claims: 3 A4 and 53 A3 (56 contract rows), and 52 weighted. It also records 190 probe and 81 test-only claims (271 evidenced A0), 25 gaps, 305 excluded requirements, and 219 not-applicable requirements. A requirement row is graded contract only when its cited evidence decides the whole clause for inputs of any size. That means a Lean theorem over the shipped source, a Kani proof over the complete input domain, or a proof whose fixed window is shown by a quoted early-return line. Every module the requirement lists must also be covered. This release re-graded the ledger: 197 rows were contract before and 56 are now. Two limits remain. Some contract rows cite a length-bounded Kani harness under prove because a review found an early-return line that makes the bound sufficient; no gate checks that argument. Mutation controls recorded before 2026-11-10 carry no claim list, so they can raise the band of every row that cites the same proof, including rows whose rule the mutation does not change (for example X690-8.12.1). Counts are inventory, not a coverage percentage. The API is unstable. Evaluate this crate as a building block with bounded and uneven evidence. In the generated band legend, A3's word "bounded" is the acceptance format's band wording; every A3 row here is decided for inputs of any size, by a complete-domain Kani proof, a Lean theorem or a reviewed early-return argument (not machine-checked).
The proof-floor declaration identifies the recorded full run, results and raw-log digest. Recorder-generated memory fields state when they were not measured. Full logs are available on request.
- L3 — Kani: 302 proof harnesses over 33 modules establish default safety checks on their bounded domains; functional claims vary by harness and are listed in the proof manifest.
- L4/L5 — Aeneas → Lean 4: selected properties of six codecs (
length,big_integer,oid,tag,tlv,sequence) hold for any input length;sequencealso covers any child count. The lids aresorry-free;tagcanonicality rejection remains Kani-bounded at 7 bytes. - Tests: 710 unit and regression tests plus 34 doc-tests cover concrete vectors. Counts are inventory, not coverage.
Read PROOF_MANIFEST.md for the exact properties, bounds, stubs and non-goals;
ASSUMPTIONS.md for the trusted base; and generated
acceptance.toml for every claim's evidence, grade and weight. The
manifest and records ship in the crate; the
crate README explains what remains repository-only. The manifest follows
acceptance format 0.4.0 with the Rust verification profile; its generated header names the exact
validator-closure commit.
These are recorded acceptance snapshots. New snapshots are prepared explicitly for releases. Ordinary CI validates their integrity and reports current-source applicability; it does not regenerate them. CHANGED or UNKNOWN means the record must not be read as acceptance of current source. See the release workflow.
- Core codecs: tag, definite length, TLV framing, primitive content codecs,
SEQUENCE, andSET OFmember ordering. Read “primitive” strictly: properties and bounds differ by codec. - Structural containers:
x509_*and the signature/private-key containers compose the core. Their evidence is bounded framing, not algorithm, key, signature, or certificate semantics. - Profile: four value-level RFC 5280 cross-field rules are covered; this is not full profile or path validation.
- Out of scope: cryptographic verification, trust/path validation, remaining RFC 5280 profile
rules, and general
SET(§10.3). SeeDECISIONS.md,PROOF_MANIFEST.md§6, and the module docs.
Two composition bounds are especially important: Kani checks x509_certificate for panic-freedom only
through 12 bytes versus a roughly 170-byte fixture, and rsa_private_key only through 20 bytes
versus a roughly 317-byte fixture. Beyond those bounds, confidence rests on an un-machine-checked
compositional argument plus concrete witnesses, not a symbolic proof over real-size inputs. See
PROOF_MANIFEST.md §6.2.
Framing is not validity.
tlv::decode_tlv, its strict sibling, and thesequencechild walk accept structurally framed values without deciding whether the identifier is legal for DER; this includes constructed encodings of primitive-only universal types and reserved EOC. Typed TLV parsers (octet_string,pkcs8, thex509_*modules) check their own identifiers; content-level codecs never see one.identifier_formadds opt-in form-checking, but it is not wired into the base TLV or sequence APIs. SeePROOF_MANIFEST.md§6.3.
This generated summary reads one claim per requirement. Band, grade and weight are separate fields. Use
COVERAGE.md when the question is whether a particular DER or RFC 5280 rule is
decided. The summary also lists declared limits and planned work.
56 of 876 claims reach A3 or better; 820 do not. The total includes excluded, gap and not-applicable requirements.
This is the recorded acceptance snapshot, not a claim that current source is accepted. Run python3 gates/release_evidence.py status for current applicability.
The acceptance axis is one claim per requirement. Counts are inventory, not a coverage percentage.
| Status | Band | Grade | Weight | Claims |
|---|---|---|---|---|
| evidenced | A0 | probe | unweighted | 190 |
| evidenced | A0 | test-only | unweighted | 81 |
| evidenced | A3 | contract | unweighted | 4 |
| evidenced | A3 | contract | weighted | 49 |
| evidenced | A4 | contract | weighted | 3 |
| gap | A0 | not-covered | unweighted | 25 |
| gap | A0 | out-of-scope | unweighted | 305 |
| not-applicable | not-applicable | ungraded | unweighted | 219 |
Weighted claims: 52.
Band meanings:
- A4 unbounded functional proof, kernel-checked, red mutation control — 3 claim(s)
- A3 bounded functional contract, red mutation control — 53 claim(s)
- A2 memory safety on the unsafe surface, with a control — 0 claim(s)
- A1 non-vacuous but not state-exhaustive, and no functional control — 0 claim(s)
- A0 ran or asserted, with NO control watched to fail — the claim is not done — 601 claim(s)
Source inventory only; these module names carry no aggregate assurance band:
big_integer, bit_string, boolean, context_tag, ec_private_key, ecdsa_sig_value, encrypted_private_key_info, enumerated, generalized_time, identifier_form, integer, length, null, octet_string, oid, pkcs8, profile, restricted_string, rsa_private_key, rsa_public_key, sequence, set_of, tag, tlv, utc_time, utf8_string, x509_algorithm_identifier, x509_certificate, x509_extension, x509_name, x509_spki, x509_tbs_certificate, x509_validity.
Lean-lid source modules: big_integer, length, oid, sequence, tag, tlv.
Read der-verified/acceptance.toml for each requirement. Subject commit 3c43afb; generated 2026-11-10T07:47:01Z. A band above A1 needs a mutation control naming the claim that was watched to fail; without one a claim stops at A1 (and an ungraded claim at A0).
Declared limits and planned work:
- Name constraints (RFC 5280 §4.2.1.10) (planned; source:
TODO.md §Scope and API decisions). - Key usage (RFC 5280 §4.2.1.3) (planned; source:
TODO.md §Scope and API decisions). - Basic constraints (RFC 5280 §4.2.1.9) (planned; source:
TODO.md §Scope and API decisions). - Validity-against-clock (RFC 5280 §4.1.2.5) (planned; source:
TODO.md §Scope and API decisions). - X.509 structural-module Lean lid (L4) (planned; source:
TODO.md §Proofs and tests). - Signature / crypto verification (out-of-scope; source:
README.md §Scope). - Certificate-path / trust validation (out-of-scope; source:
README.md §Scope). - General SET (X.690 §10.3) (out-of-scope; source:
README.md §Scope).
Top-level strict entry points reject trailing bytes. tlv::decode_tlv_strict and
sequence::decode_sequence_tlv_strict require exactly one value; composable variants leave a suffix
only so containers can parse children. Kani checks strict rejection on its bounded domain, while the
TLV consumption/no-over-read property also has an unbounded Lean lid. This does not turn the base
framing APIs into DER-validity checks; the identifier-form residual above still applies.
cargo add der-verifieduse der_verified::length::decode_length;
use der_verified::x509_certificate::parse_certificate;
let (length_value, consumed) = decode_length(&bytes)?; // canonical length field
let cert = parse_certificate(der_bytes)?; // strict structural framing; no cryptoThe crate has zero runtime dependencies, is #![forbid(unsafe_code)], and is allocation-free on the
decode paths. It is not #![no_std] today.
- Bounded means bounded. A Kani result covers only its harness's buffer and unwind domain; the selected Lean properties and the reviewed early-return frames are the stated exceptions. Deep nesting and resource exhaustion are not proven away, and the crate imposes no recursion-depth or total-work limit of its own. Bound untrusted input size and nesting depth; a Rust stack overflow aborts the process.
- No cryptography or trust decision. A structurally parsed object is not thereby a valid certificate, key, or signature.
- The trusted base is real. Claims depend on Kani/CBMC/SAT, the Lean kernel, pinned toolchains,
and Aeneas extraction fidelity: the lids prove a model of the Rust. Their 13 declared axioms
specify upstream
coreprimitives, not crate code. The proof manifest also names three known-unsatisfiable covers and their separate witnesses. SeeASSUMPTIONS.md.
For vulnerability reporting, see SECURITY.md.
The evidence is re-runnable. From a fresh clone:
./replay.sh
./replay.sh --with-leanThe default replays tests, the acceptance gate, one Kani harness, and negative controls; it validates
recorded Lean evidence but does not run Lean. --with-lean re-extracts and checks the lids, but is
accept-only — it confirms the lids hold; the recorded Lean mutation controls are validated as
records, not re-run. Neither mode runs the full Kani floor or establishes X.509 correctness; read
REPLAY.md.
cargo test # 710 tests + 34 doc-tests
cargo install --locked kani-verifier --version 0.67.0
cargo kani setup
cargo kani -Z stubbing # 302 proof harnesses, needs a large machine./check_fast.sh # docs/manifests + tests
./check.sh # full Kani floor; Lean runs only when its pinned toolchain is present-Z stubbing is required for the 29 modular harnesses in the generated inventory.
Their stub obligations are listed in PROOF_MANIFEST.md §8.4. The profile totality and precedence
proofs remain conditional on has_repeated_leading_oid being total. Its totality is not discharged;
its comparison results have unit-test evidence only. The Lean step re-extracts the shipped Rust, fails on drift or
sorry, and requires the exact Aeneas/Charon/Lean pins below.
| Tool | Version | Source of truth |
|---|---|---|
| rustc | floating stable channel |
rust-toolchain.toml |
| Kani | 0.67.0 (pinned in CI; bundles CBMC) |
.github/workflows/ci.yml |
| Lean 4 | v4.30.0-rc2 |
lean/lean-toolchain |
| Aeneas / Charon | pinned commits | lean/check_lean.sh |
GitHub Actions runs the local fast checks, package validation,
tests, clippy and MSRV checks on every run. It runs the memory-tractable 225 of 302 Kani harnesses
on every main push and on PRs with changes outside the documented prose allowlist.
A documentation-only PR explicitly reports that Kani was not run. See CI selection and limits.
The remaining heavy modules are a local milestone via
./check.sh; the full floor needs roughly 24 GB available (largest harness peaks ~20 GB). Indicative shard timings and
memory measurements live in docs/verification-cost.md.
The x509_name proof's split from a monolithic >100 GB attempt into discharged modular proofs is
explained in docs/why-verified.md.
TODO.md— the active backlog and deferred proposals.docs/archive/README.md— historical status, outside the current reading path.docs/why-verified.md— why a verified DER decoder, the two-layer (Kani + Aeneas→Lean) approach, the honesty envelope, and the modular-proof war story.COVERAGE.md— the per-rule coverage ledger: one row per X.690 / RFC 5280 rule, its evidence strength, and a self-verify command per row. Start here if your question is "is this rule verified?" rather than "does this module have harnesses?".PROOF_MANIFEST.md— what is proven, bounds, assumptions, stubs, and non-goals.DECISIONS.md— the contestable-decisions ledger: every scope narrowing and design fork, with its rationale and review outcome.SECURITY.md— private vulnerability disclosure.DOCS-SYNC.md— which documents to update when code or proofs change.
Dual-licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.