CodeSampleX

Sample

rustls-webpki 0.103.14

Verified sample for cargo rustls-webpki 0.103.14. The contract ran on rust 1 · linux alpine/x64 · docker and passed: KeyUsage::server_auth returns expected…

sha256:d7c627c82ae950cd68ccf9a9ba8a66bb3a15f3387a404bd521e2e410cf7d6746

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment linux · alpine · musl x64 cargo

Verification-run environments

Environment Contract Stages Run
rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b…
2026-09-19

Case

HOW
Goal
verify pkg:cargo/rustls-webpki@0.103.14
Packages
Created
2026-09-18T12:08:40Z

Contract

  1. KeyUsage::server_auth returns expected OID representation
  2. KeyUsage::client_auth returns expected OID representation
  3. KeyPurposeId wraps raw OID bytes and decodes to numerical components
  4. KeyUsage constructed with custom OID yields decoded values matching source
  5. RevocationOptionsBuilder requires at least one CRL and errors on empty slice
  6. Revocation policy and Error enum variants maintain distinct inequality

Files

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/lib.rs
  • test/contract.rs

Download the source artifact (tar.gz)

Source

Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "cc"
version = "1.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3eb0f42d6c360dc3f8a821f6bf2fdea7f72bfd36b3076eb0e6d1e9e0752fff4"
dependencies = [
 "find-msvc-tools",
 "shlex",
]

[[package]]
name = "cfg-if"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"

[[package]]
name = "find-msvc-tools"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d"

[[package]]
name = "getrandom"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
 "cfg-if",
 "libc",
 "wasi",
]

[[package]]
name = "libc"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"

[[package]]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
 "cc",
 "cfg-if",
 "getrandom",
 "libc",
 "untrusted",
 "windows-sys",
]

[[package]]
name = "rustls-pki-types"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
dependencies = [
 "zeroize",
]

[[package]]
name = "rustls-webpki"
version = "0.103.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0527518605e68109d875e248ea259b6758801cf165e4b2c2733ae3b51f12535a"
dependencies = [
 "ring",
 "rustls-pki-types",
 "untrusted",
]

[[package]]
name = "sample-rustls-webpki"
version = "1.0.0"
dependencies = [
 "rustls-webpki",
]

[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"

[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"

[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"

[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
 "windows-targets",
]

[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
 "windows_aarch64_gnullvm",
 "windows_aarch64_msvc",
 "windows_i686_gnu",
 "windows_i686_gnullvm",
 "windows_i686_msvc",
 "windows_x86_64_gnu",
 "windows_x86_64_gnullvm",
 "windows_x86_64_msvc",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"

[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"

[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"

[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"

[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"

[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

[[package]]
name = "zeroize"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
Cargo.toml
[package]
name = "sample-rustls-webpki"
version = "1.0.0"
edition = "2021"
publish = false

[dependencies]
rustls-webpki = "=0.103.14"

[[bin]]
name = "contract"
path = "test/contract.rs"
PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify pkg:cargo/rustls-webpki@0.103.14
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/rustls-webpki@0.103.14

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:fee7fdb33d629668bc48bbfedca5526ff11a76e10830a3e54a296bcb269df53b","contract":["KeyUsage::server_auth returns expected OID representation","KeyUsage::client_auth returns expected OID representation","KeyPurposeId wraps raw OID bytes and decodes to numerical components","KeyUsage constructed with custom OID yields decoded values matching source","RevocationOptionsBuilder requires at least one CRL and errors on empty slice","Revocation policy and Error enum variants maintain distinct inequality"],"goal":"verify pkg:cargo/rustls-webpki@0.103.14","kind":"HOW","packages":["pkg:cargo/rustls-webpki@0.103.14"],"schemaVersion":1},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/rustls-webpki@0.103.14"],"schemaVersion":1,"subject":"pkg:cargo/rustls-webpki@0.103.14","verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:cargo/rustls-webpki@0.103.14",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/rustls-webpki@0.103.14"
  ]
}
src/lib.rs
//! Clean-room verification sample for rustls-webpki.

pub use webpki::*;
test/contract.rs
use webpki::{
    ExpirationPolicy, KeyPurposeId, KeyUsage, RevocationCheckDepth,
    RevocationOptionsBuilder, RevocationReason, UnknownStatusPolicy, Error,
};

fn main() {
    // 1. KeyUsage::server_auth returns expected OID representation
    let server_usage = KeyUsage::server_auth();
    let server_oids: Vec<usize> = server_usage.oid_values().collect();
    assert_eq!(server_oids, vec![1, 3, 6, 1, 5, 5, 7, 3, 1]);
    assert_eq!(KeyUsage::SERVER_AUTH_REPR, &[1, 3, 6, 1, 5, 5, 7, 3, 1]);

    // 2. KeyUsage::client_auth returns expected OID representation
    let client_usage = KeyUsage::client_auth();
    let client_oids: Vec<usize> = client_usage.oid_values().collect();
    assert_eq!(client_oids, vec![1, 3, 6, 1, 5, 5, 7, 3, 2]);
    assert_eq!(KeyUsage::CLIENT_AUTH_REPR, &[1, 3, 6, 1, 5, 5, 7, 3, 2]);

    // 3. KeyPurposeId wraps raw OID bytes and decodes to numerical components
    let code_signing_oid_bytes: &[u8] = &[0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03];
    let kpid = KeyPurposeId::new(code_signing_oid_bytes);
    assert_eq!(kpid.to_decoded_oid(), vec![1, 3, 6, 1, 5, 5, 7, 3, 3]);
    let kpid_clone = kpid;
    assert_eq!(kpid, kpid_clone);
    assert_eq!(format!("{kpid:?}"), "KeyPurposeId(1.3.6.1.5.5.7.3.3)");

    // 4. KeyUsage constructed with custom OID yields decoded values matching source
    let custom_usage = KeyUsage::required(code_signing_oid_bytes);
    let custom_oids: Vec<usize> = custom_usage.oid_values().collect();
    assert_eq!(custom_oids, vec![1, 3, 6, 1, 5, 5, 7, 3, 3]);

    let req_if_present = KeyUsage::required_if_present(code_signing_oid_bytes);
    let req_oids: Vec<usize> = req_if_present.oid_values().collect();
    assert_eq!(req_oids, vec![1, 3, 6, 1, 5, 5, 7, 3, 3]);

    // 5. RevocationOptionsBuilder requires at least one CRL and errors on empty slice
    let empty_crl_result = RevocationOptionsBuilder::new(&[]);
    assert!(empty_crl_result.is_err());

    // 6. Revocation policy and Error enum variants maintain distinct inequality
    assert_eq!(RevocationCheckDepth::Chain, RevocationCheckDepth::Chain);
    assert_ne!(RevocationCheckDepth::Chain, RevocationCheckDepth::EndEntity);
    assert_eq!(UnknownStatusPolicy::Deny, UnknownStatusPolicy::Deny);
    assert_ne!(UnknownStatusPolicy::Deny, UnknownStatusPolicy::Allow);
    assert_eq!(ExpirationPolicy::Ignore, ExpirationPolicy::Ignore);
    assert_ne!(ExpirationPolicy::Ignore, ExpirationPolicy::Enforce);

    assert_eq!(RevocationReason::KeyCompromise, RevocationReason::KeyCompromise);
    assert_ne!(RevocationReason::KeyCompromise, RevocationReason::CaCompromise);

    assert_eq!(Error::BadDer, Error::BadDer);
    assert_ne!(Error::BadDer, Error::BadDerTime);
    assert_ne!(Error::BadDer, Error::CaUsedAsEndEntity);

    println!("All rustls-webpki contract tests passed.");
}

Origin Seeder

anonymous