High-Level Architecture
Relevant source files
The following files were used as context for generating this wiki page:
Tinfoil Verifier is a portable remote-attestation library and secure HTTP client designed to verify the integrity of enclave-backed services. It establishes trust by verifying hardware-rooted reports from AMD SEV-SNP and Intel TDX platforms and binding these verifications to TLS connections through certificate pinning.
The system is designed to be self-contained, requiring no external attestation service for primary verification. It supports multiple environments, including native Go applications and web browsers via WebAssembly (WASM).
Sources: README.md:3-15, attestation/attestation.go:19-24
Core Components
The architecture consists of several specialized modules handling platform-specific attestation, signature verification, and secure communication.
Attestation Engine
The attestation engine is responsible for parsing and validating hardware reports. It supports AMD SEV-SNP (using VCEK certificates) and Intel TDX (using TDX quotes). The engine extracts measurements (registers) and public keys from these reports to form a Verification object.
Sources: attestation/attestation.go:167-175, attestation/sev.go:145-159, attestation/tdx.go:189-200
Measurement and Identity Verification
This component compares runtime measurements obtained from the enclave against "ground truth" source measurements. Source measurements are often retrieved via Sigstore/Rekor integration to verify code provenance.
Sources: README.md:104-108, attestation/attestation.go:76-150
Client Wrapper
The client package provides a high-level SecureClient that transparently performs attestation during the first request and subsequently pins the enclave-generated TLS certificate fingerprint for the remainder of the session.
Sources: README.md:46-52, wasm/main.go:119-140
Data Flow and Interaction
The verification process involves multiple actors: the Client, the Enclave, and Root of Trust providers (AMD/Intel and Sigstore).
General Verification Flow
This diagram illustrates the sequence of operations performed when a client connects to an enclave.
Platform-Specific Logic
The system distinguishes between different hardware platforms using PredicateType identifiers.
| Platform | Technique | Implementation File |
|---|---|---|
| AMD SEV-SNP | VCEK certificates & SNP report validation | attestation/sev.go |
| Intel TDX | TDX quote validation & TD report checks | attestation/tdx.go |
Sources: README.md:78-83, attestation/attestation.go:21-25
Data Structures
Attestation Documentation
The primary unit of exchange is the Document, which wraps the platform-specific report.
type Document struct {
Format PredicateType `json:"format"`
Body string `json:"body"`
}
Sources: attestation/attestation.go:153-156
Verification Results
After a document is verified, the system produces a Verification object containing the extracted hardware state and associated cryptographic keys.
| Field | Type | Description |
|---|---|---|
Measurement | *Measurement | Hardware registers (MRTD, RTMRs, or SNP measurement) |
TLSPublicKeyFP | string | SHA-256 fingerprint of the enclave's TLS public key |
HPKEPublicKey | string | Public key used for Encrypted HTTP Body Protocol (EHBP) |
Sources: attestation/attestation.go:64-68, attestation/attestation.go:70-74
Platform Architectures
Intel TDX Verification
Intel TDX verification utilizes embedded collateral (QE Identity, TCB Info, and CRLs) to validate reports without constant external API calls.
AMD SEV-SNP Verification
AMD verification involves fetching or using pre-provided VCEK certificates and validating the SNP report against AMD's Genoa certificate chain.
Sources: attestation/sev.go:49-130
WASM Integration
The verifier is compiled to WebAssembly to allow native Go verification logic to run in browser environments. It exports functions like verifyEnclave, verifyCode, and verify to the JavaScript global scope.
verifyEnclave(hostname): Fetches and verifies a hardware report from a specific host.verifyCode(repo, digest): Verifies code measurements using Sigstore bundles retrieved via a proxy.verify(hostname, repo): Performs a complete end-to-end verification of both hardware and code.
Sources: wasm/main.go:142-147, wasm/index.html:268-285
Conclusion
The Tinfoil Verifier architecture provides a unified interface for complex hardware-level attestation. By modularizing platform-specific logic and providing high-level clients for Go and WASM, it enables secure, verified communication with confidential enclaves while abstracting the underlying complexity of signature chains and measurement comparisons.