CLI Utilities & Root Fetch
Relevant source files
The following files were used as context for generating this wiki page:
CLI utilities and root fetching mechanisms in the Tinfoil Verifier project provide the necessary tooling to maintain the chain of trust by retrieving up-to-date cryptographic collateral and reference measurements. These tools ensure that the verifier operates with the latest "ground truth" from hardware vendors (Intel, AMD) and code provenance providers (Sigstore, GitHub).
The primary focus of these utilities is the automated retrieval of Trusted Execution Environment (TEE) collateral, such as Certificate Revocation Lists (CRLs) and TCB (Trusted Computing Base) info, as well as the initial bootstrapping of the Sigstore trust root.
Sources: README.md, rootfetch/main.go:18-29
Root Trust Bootstrapping
The project employs a specialized utility located in rootfetch/ to establish the initial trust anchor for Sigstore-based verification. This utility is often invoked via go:generate directives in other packages to ensure that a trusted_root.json file is present for embedding during compilation.
Sigstore Trust Root Fetcher
The rootfetch package queries the Sigstore infrastructure to retrieve the latest public keys and log configurations. This is critical for verifying code attestations and ensuring that the binaries running in the enclave match the expected source code.
The diagram above shows the lifecycle of the trust root from initial fetch to binary embedding.
Sources: rootfetch/main.go:10-31, wasm/main.go:17-19, examples/client/main.go:3
Hardware Collateral Retrieval
For Intel TDX and AMD SEV-SNP attestation, the verifier requires hardware-specific collateral that is not static. The project provides scripts and Go logic to fetch these items from vendor Provisioning Certification Services (PCS) or Key Delivery Services (KDS).
Intel PCS Collateral Fetcher
A shell script in attestation/collateral/fetch.sh is used to update embedded Intel collateral. It retrieves identity documents and revocation lists necessary for TDX quote validation.
| Component | Target URL / Source | Description |
|---|---|---|
| QE Identity | tdx/certification/v4/qe/identity | Intel Quoting Enclave identity and its issuer chain. |
| Root CA CRL | IntelSGXRootCA.der | Certificate Revocation List for the Intel Root CA. |
| PCK CRL | sgx/certification/v4/pckcrl | Processor and Platform CA revocation lists. |
| TCB Info | tdx/tcb?fmspc=[FMSPC] | TCB level information specific to the platform's FMSPC. |
Sources: attestation/collateral/fetch.sh:11-37, attestation/tdx.go:32-48
AMD KDS Proxying
For SEV-SNP, the project utilizes a proxying mechanism to retrieve Versioned Chip Endorsement Key (VCEK) certificates. While a static Genoa certificate chain is embedded, individual VCEK certificates are often fetched dynamically via a proxy.
The sequence diagram illustrates how the SEV-SNP logic retrieves chip-specific certificates through the Tinfoil proxy.
Sources: attestation/sev.go:30-49
GitHub Provenance Utilities
The github package acts as a CLI-supportive utility for fetching code measurements and attestation bundles directly from GitHub releases. This allows the verifier to compare the measurement of a running enclave with the "source-of-truth" measurement generated during the CI/CD build process.
Key GitHub Fetching Functions
FetchLatestTag: Retrieves the most recent release tag.FetchDigest: Downloads thetinfoil.hashfile containing the expected enclave measurement.FetchAttestationBundle: Retrieves the Sigstore attestation bundle from the GitHub attestation proxy.
Sources: github/github.go:11-64
Verifier CLI Example
The examples/verifier/ directory contains a functional CLI tool that demonstrates the orchestration of all utility components. It performs the following steps in parallel:
- Fetches Sigstore trust roots.
- Retrieves code measurements from GitHub.
- Fetches the runtime attestation report from the enclave.
- Performs the comparison between source-derived measurements and hardware-generated reports.
The flow shows the parallelized data gathering process used by the example verifier CLI.
Sources: examples/verifier/main.go:35-135
Summary
CLI Utilities and Root Fetching mechanisms form the foundation of the Tinfoil Verifier's security model. By providing automated tools to fetch Sigstore roots, Intel PCS collateral, and GitHub-based code provenance, the project ensures that the verification process is grounded in verifiable, up-to-date cryptographic evidence from trusted third parties.