Cryptographic Verification Tools for RedPill TEE-Protected AI
Python tools for validating RedPill attestation reports and response signatures. These verifiers provide cryptographic proof that your AI requests are processed in genuine Trusted Execution Environments (TEE) with hardware-enforced privacy.
- π TEE Attestation Verification - Cryptographic proof of genuine hardware
- π‘οΈ GPU TEE Verification - NVIDIA H100/H200 attestation via NRAS
- β Intel TDX Quote Validation - Verify CPU TEE measurements
- π ECDSA Signature Verification - Validate signed AI responses
- π¦ Sigstore Provenance - Container supply chain verification
- π Multi-Server Support - Load balancer attestation aggregation
- Python 3.10+
requests,eth-account- RedPill API key from redpill.ai (for signature verifier only)
git clone https://github.com/redpill-ai/redpill-verifier.git
cd redpill-verifier
# Install dependencies
pip install requests eth-accountpython3 attestation_verifier.py --model phala/deepseek-chat-v3-0324export API_KEY=sk-your-api-key-here
python3 signature_verifier.py --model phala/deepseek-chat-v3-0324Generates a fresh nonce, requests a new attestation, and verifies:
- GPU attestation: Submits GPU evidence payload to NVIDIA NRAS and verifies the nonce matches
- TDX report data: Validates that report data binds the signing key (ECDSA or Ed25519) and nonce
- Intel TDX quote: Verifies TDX quote via RedPill's verification service
- Compose manifest: Displays Docker compose manifest and verifies it matches the mr_config measurement
python3 attestation_verifier.py [--model MODEL_NAME]Default model: phala/deepseek-chat-v3-0324
No API key required. The verifier fetches attestations from the public /v1/attestation/report endpoint.
Signing address: 0x1234...
Request nonce: abc123...
π TDX report data
Signing algorithm: ecdsa
Report data binds signing address: True
Report data embeds request nonce: True
π GPU attestation
GPU payload nonce matches request_nonce: True
NVIDIA attestation verdict: PASS
π Intel TDX quote
Intel TDX quote verified: True
Docker compose manifest attested by the enclave:
version: '3.8'
services:
model:
image: phala/deepseek@sha256:77fbe5f...
...
Compose sha256: abc123...
mr_config (from verified quote): 0x01abc123...
mr_config matches compose hash: True
π Sigstore provenance
Checking Sigstore accessibility for container images...
β https://search.sigstore.dev/?hash=sha256:77fbe5f... (HTTP 200)
β GPU TEE Measurements - Proves genuine NVIDIA H100/H200 TEE β Model Hash - Verifies exact model version β Code Hash - Confirms inference code integrity β Nonce Freshness - Prevents replay attacks β Cryptographic Binding - Signing key bound to hardware β Container Provenance - Verifies build supply chain
Fetches chat completions (streaming and non-streaming), verifies ECDSA signatures, and validates attestations:
- Sends chat completion request to
/v1/chat/completions - Fetches signature from
/v1/signature/{chat_id}endpoint - Verifies request hash and response hash match the signed hashes
- Recovers ECDSA signing address from signature
- Fetches fresh attestation with user-supplied nonce for the recovered signing address
- Validates attestation using the same checks as attestation verifier
Note: The verifier supplies a fresh nonce when fetching attestation (step 5), which ensures attestation freshness but means the nonce/report_data won't match the original signing context. This is expected behavior - the verifier proves the signing key is bound to valid hardware, not that a specific attestation was used for signing.
Set your API key as an environment variable:
export API_KEY=sk-your-api-key-hereOr create a .env file:
API_KEY=sk-your-api-key-hereThen run:
python3 signature_verifier.py [--model MODEL_NAME]Default model: phala/deepseek-chat-v3-0324
β Request Body Hash - Matches server-computed hash β Response Text Hash - Matches server-computed hash β ECDSA Signature - Valid and recovers to claimed signing address β Signing Address Binding - Bound to hardware via TDX report data β GPU Attestation - Passes NVIDIA verification β Intel TDX Quote - Valid CPU TEE measurements
Both scripts automatically extract all container image digests from the Docker compose manifest (matching @sha256:xxx patterns) and verify Sigstore accessibility for each image. This allows you to:
- Verify the container images were built from the expected source repository
- Review the GitHub Actions workflow that built the images
- Audit the build provenance and supply chain metadata
The verifiers check each Sigstore link with an HTTP HEAD request to ensure provenance data is available (not 404).
π Sigstore provenance
Checking Sigstore accessibility for container images...
β https://search.sigstore.dev/?hash=sha256:77fbe5f... (HTTP 200)
β https://search.sigstore.dev/?hash=sha256:abc123... (HTTP 200)
If a link returns β, the provenance data may not be available in Sigstore (either the image wasn't signed or the digest is incorrect).
In production deployments with multiple backend servers behind a load balancer:
- Each server has its own unique signing key/address
- Attestation requests with
signing_addressparameter return 404 if the address doesn't match - Response includes
all_attestations: [attestation](single-element array with this server's attestation)
When /v1/attestation/report?signing_address={addr}&nonce={nonce}:
- Broadcast the request to all backend servers
- Collect non-404 responses from servers matching the signing_address
- Merge
all_attestationsarrays from all responses - Return combined response with all servers' attestations
- Get signature β extract
signing_address - Request attestation with
signing_addressparameter - LB broadcasts β collect attestations from all servers
- Verifier finds matching attestation by comparing
signing_addressinall_attestations
{
"signing_address": "0xServer1...",
"intel_quote": "...",
"all_attestations": [
{"signing_address": "0xServer1...", "intel_quote": "...", ...},
{"signing_address": "0xServer2...", "intel_quote": "...", ...}
]
}The verifier filters all_attestations to find the entry matching the signature's signing_address.
Layer 1: TEE-Protected Gateway (All Models)
- Request processing in TEE (Intel TDX)
- Response handling in TEE
- Applies to all 250+ models
- Verified via attestation reports
Layer 2: TEE-Protected Inference (Phala Models)
- Model weights in GPU TEE (NVIDIA H100/H200)
- Inference computation in GPU secure enclaves
- Complete end-to-end protection
- Verified via GPU attestation + signature verification
- β NVIDIA GPU vendor (H100/H200 TEE correctness)
- β Intel CPU vendor (TDX implementation)
- β Phala Network (model deployment integrity)
- β Open source code (auditable on GitHub)
- β RedPill operators
- β Cloud provider (AWS, GCP, Azure)
- β System administrators
- β Other users on same hardware
β Hardware-Enforced Privacy - Data never leaves TEE in plaintext β Verifiable Execution - Cryptographic proof of code integrity β Tamper-Proof - Cannot be modified by operators or admins β Auditable - Full attestation reports for every request
# Verify default Phala confidential model
python3 attestation_verifier.py
# Verify specific model
python3 attestation_verifier.py --model phala/qwen-2.5-7b-instructexport API_KEY=sk-your-api-key-here
python3 signature_verifier.py --model phala/deepseek-chat-v3-0324from attestation_verifier import fetch_report, check_tdx_quote, check_gpu, check_report_data
import secrets
# Generate fresh nonce
nonce = secrets.token_hex(32)
# Fetch attestation
attestation = fetch_report("phala/deepseek-chat-v3-0324", nonce)
# Verify all components
intel_result = check_tdx_quote(attestation)
check_report_data(attestation, nonce, intel_result)
check_gpu(attestation, nonce)These verifiers work with RedPill Gateway attestation endpoints:
GET /v1/attestation/report- Get TEE attestationGET /v1/signature/{chat_id}- Get response signature
RedPill Chat uses these verification methods to display TEE status in the UI.
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test with both verifiers
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE for details.
Built with:
- NVIDIA NRAS - GPU TEE attestation service
- Intel TDX - CPU TEE technology
- Sigstore - Container supply chain verification
Powered by RedPill Gateway and Phala Network TEE infrastructure.
- Website: https://redpill.ai
- Documentation: https://docs.redpill.ai
- Gateway: https://github.com/redpill-ai/redpill-gateway
- Chat: https://github.com/redpill-ai/redpill-chat
- Support: support@redpill.ai
- RedPill Attestation Guide
- RedPill Verification Guide
- TEE-Protected Gateway Architecture
- NVIDIA Confidential Computing
- Intel TDX Documentation
Built with π by the RedPill team β’ Verifying AI privacy, one attestation at a time.