Mobile Integration (iOS/macOS)
Relevant source files
The following files were used as context for generating this wiki page:
The Tinfoil Verifier provides support for mobile and desktop Apple ecosystems (iOS and macOS) primarily through Swift bindings. These bindings are generated using gomobile, allowing the core Go-based attestation logic to be utilized natively within mobile applications. This integration enables mobile clients to verify the integrity of remote enclaves, such as AMD SEV-SNP and Intel TDX, and establish secure, hardware-rooted connections to enclave-backed services.
Sources: README.md:1-20, README.md:14-14
Core Integration Architecture
Mobile integration leverages the project's ability to cross-compile Go code into native libraries. The Swift bindings wrap the primary verification functions, providing a native interface for mobile developers to perform remote attestation.
Data Flow for Remote Attestation
The mobile client follows a specific sequence to verify an enclave before engaging in secure communication. This involves requesting an attestation report, validating the hardware signature chain, and comparing measurements against a trusted reference (Sigstore).
The flow ensures that the mobile client only communicates with verified hardware enclaves.
Sources: README.md:94-105
Supported Platforms and Techniques
The mobile integration supports the same hardware platforms as the core Go library. The following table summarizes the attestation techniques used:
| Platform | Verification Technique | Reference |
|---|---|---|
| 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:86-92, attestation/sev.go:1-10, attestation/tdx.go:1-20
Key Components for Integration
Attestation Verification Logic
The core logic resides in the attestation package, which is exposed to mobile bindings. This includes handling different report formats and verifying them against hardware-specific roots of trust.
Verify(): The primary entry point for checking an attestation document against its trust root.Measurement: A data structure containing the platform type and hardware registers (e.g., MRTD, RTMRs for TDX; Measurement for SEV-SNP).Document: Represents the attestation report fetched from the enclave, containing the format (PredicateType) and the encoded body.
Sources: attestation/attestation.go:34-40, attestation/attestation.go:167-170, attestation/attestation.go:217-225
Hardware-Specific Implementations
The mobile integration uses specialized logic for different hardware providers:
- Intel TDX: Uses
google/go-tdx-guestto validate Quotes and checks against embedded Intel SGX Root CA certificates. Sources: attestation/tdx.go:21-30 - AMD SEV-SNP: Uses
google/go-sev-guestto validate SNP reports against the AMD Genoa certificate chain. Sources: attestation/sev.go:20-22
Networking and Fetching
Mobile clients must retrieve attestation documents from the enclave's well-known endpoint: /.well-known/tinfoil-attestation. The integration handles HTTP communication and supports TLS certificate pinning based on the fingerprint found inside the signed attestation report.
Sources: attestation/attestation.go:31-31, attestation/attestation.go:244-259
Verification Data Model
When a mobile app performs verification, it receives a Verification object (or its Swift equivalent).
| Field | Type | Description |
|---|---|---|
Measurement | *Measurement | The verified hardware measurements/registers. |
TLSPublicKeyFP | string | The SHA-256 fingerprint of the enclave's TLS public key. |
HPKEPublicKey | string | The public key for Encrypted HTTP Body Protocol (EHBP) communication. |
Sources: attestation/attestation.go:72-76, attestation/attestation.go:78-84
Implementation via Gomobile
While the specific .swift wrapper files are generated during the build process, the architecture relies on exporting Go functions that the Swift side can call. The wasm implementation provides a parallel example of how the Go logic is exposed to non-Go environments, using functions like verify() and verifyEnclave() which could be mirrored in mobile bindings.
The diagram shows the layering from the native app logic down to the hardware-specific drivers in Go.
Sources: README.md:14-14, wasm/main.go:127-149
Summary
Mobile Integration for iOS and macOS allows developers to bring hardware-rooted trust to mobile applications. By utilizing Swift bindings for the core Go verifier, mobile apps can perform complex cryptographic validation of AMD SEV-SNP and Intel TDX enclaves, ensuring that sensitive data is only transmitted to genuine, untampered hardware environments.