dcap-qvl
Verify Intel SGX and TDX attestation quotes. dcap-qvl is a small, pure-Rust
library that verifies DCAP (Data Center Attestation Primitives) quotes, with
native bindings for Python, Go, Kotlin, and Swift — plus a standalone
pure-JavaScript implementation for the web.
What it does
- Verifies SGX and TDX quotes against Intel's trust chain.
- Gets collateral for you from a PCCS or Intel PCS — or verifies fully offline with collateral you already have.
- Extracts report fields from a quote: measurements, report data, TCB status, and advisory IDs.
- Runs everywhere. The pure-Rust core works on servers, mobile,
WebAssembly, and on-chain (
no_std).
By default it uses Phala Network's PCCS (https://pccs.phala.network) for
better availability and lower rate limits.
Languages
| Language | Package | Install | Guide |
|---|---|---|---|
| Rust | dcap-qvl |
cargo add dcap-qvl |
docs.rs |
| Python | dcap-qvl |
pip install dcap-qvl |
python-bindings/ |
| JavaScript (pure JS) | @phala/dcap-qvl |
npm i @phala/dcap-qvl |
dcap-qvl-js/ |
| Go | github.com/Phala-Network/dcap-qvl/golang-bindings |
go get github.com/Phala-Network/dcap-qvl/golang-bindings |
golang-bindings/ |
| Android (Kotlin/Java) | com.phala:dcap-qvl-android |
Gradle | dcap-qvl-mobile/android/ |
| Swift (iOS/macOS) | dcap-qvl-swift |
SwiftPM | dcap-qvl-mobile/ios/ |
The JavaScript package is a standalone pure-JS port that runs in Node and the
browser with no native dependencies. WebAssembly builds of the Rust core are
also published as @phala/dcap-qvl-web
and @phala/dcap-qvl-node.
There's also a command-line tool, dcap-qvl-cli (cargo install dcap-qvl-cli).
How verification works
To verify a quote you need three things:
- the quote bytes,
- the collateral for it — the certificates, CRLs, and TCB info that prove the quote against Intel's trust chain, served by a PCCS, and
- the current time, to check the collateral hasn't expired.
verify() checks the signature chain and TCB status and returns the report plus
a status string. If you don't already have collateral, the library can fetch it
from a PCCS for you in one step.
Quick start
Rust
use CollateralClient;
use verify;
use PHALA_PCCS_URL;
let quote = read?;
let collateral = with_default_http?
.fetch
.await?;
let now = now
.duration_since?
.as_secs;
let report = verify?;
println!;
See the docs.rs page for crypto-backend selection,
feature flags, no_std, and offline verification.
Python
=
= await # defaults to Phala PCCS
JavaScript
import from '@phala/dcap-qvl';
const result = await ; // defaults to Phala PCCS
console.log;
Android (Kotlin)
import com.phala.dcapqvl.*
// collateralJson is the raw PCCS response body — fetch it with OkHttp / Ktor.
val report = verify(rawQuote, collateralJson, nowSecs)
println(report.status)
Swift
import DcapQvl
let report = try verify(rawQuote: rawQuote, collateralJson: collateralJson, nowSecs: nowSecs)
print(report.status)
Go
import dcap "github.com/Phala-Network/dcap-qvl/golang-bindings"
report, _ := dcap.GetCollateralAndVerify(rawQuote, dcap.PhalaPCCSURL)
fmt.Println(report.Status)
Each binding's directory (linked in the table above) has full documentation and runnable examples.
Detailed claims and optional policy validation
Applications can request detailed serializable claims and optionally apply the built-in policy:
use ;
let policy = strict
.allow_status
.reject_advisory;
let claims = new_prod
.verify_with_policy?;
For downstream appraisal, use QuotePolicy::claims_only(now). It skips local business-policy checks while verification still uses the explicit now argument. Applications can serialize those claims and feed them to a
shared downstream policy engine that also handles other TEE platforms. See
docs/policy.md for the claims schema and QuotePolicy.
Existing one-shot verify() entry points remain available.
Building and testing
Common tasks are in the Makefile:
Releasing
A single v<X.Y.Z> tag publishes every ecosystem at one version — crates.io,
PyPI, npm, Maven Central, and the Swift Package Index. See
dcap-qvl-mobile/RELEASING.md.
License
MIT — see LICENSE.