Expand description
§dcap-qvl
Verify Intel SGX and TDX (DCAP — Data Center Attestation Primitives) attestation quotes, in pure Rust. Supports both SGX (Software Guard Extensions) and TDX (Trust Domain Extensions).
§What it does
- Verify SGX and TDX quotes against Intel’s trust chain
- Fetch collateral from a PCCS or Intel PCS, or verify fully offline
- Extract report fields (measurements, report data, TCB status) from a quote
By default the collateral client uses Phala Network’s PCCS
(https://pccs.phala.network).
Native bindings for Python, JavaScript, Go, Kotlin, and Swift are published from the same core — see the project README.
§Example
use dcap_qvl::collateral::CollateralClient;
use dcap_qvl::verify::verify;
use dcap_qvl::PHALA_PCCS_URL;
#[tokio::main]
async fn main() {
let quote = std::fs::read("quote").expect("quote file not found");
// Use default Phala PCCS, or override with custom URL
let pccs_url = std::env::var("PCCS_URL").unwrap_or_else(|_| PHALA_PCCS_URL.to_string());
let collateral = CollateralClient::with_default_http(pccs_url)
.expect("failed to build HTTP client")
.fetch("e)
.await
.expect("failed to get collateral");
let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs();
let report = verify("e, &collateral, now).expect("failed to verify quote");
println!("{report:?}");
}§Crypto backends
Two backends are available: ring (optimized, uses assembly) and
rustcrypto (pure Rust). Both are enabled by default and ring takes
priority. For predictable behavior, call an explicit backend module:
use dcap_qvl::verify::ring::verify; // always ring
use dcap_qvl::verify::rustcrypto::verify; // always rustcryptoThe top-level verify::verify selects the backend from enabled features:
ring wins when both are on, rustcrypto is used when only it is enabled,
and enabling neither is a compile error. Because Cargo features are additive,
any crate in your dependency tree that enables ring makes the top-level
verify() use ring — reach for the explicit modules to avoid surprises.
§Feature flags
# Default: both backends, std, the PCCS collateral client, and x509 parsing.
dcap-qvl = "0.5"
# Minimal verifier for WASM / on-chain (smaller, ring only, no_std-friendly):
dcap-qvl = { version = "0.5", default-features = false, features = ["std", "ring"] }no_std builds are supported by disabling default features. The report
feature pulls in the async PCCS collateral client (reqwest + tokio); drop
it for offline verification on size-constrained targets.
Re-exports§
pub use collateral::PHALA_PCCS_URL;pub use policy::PckCertFlag;pub use policy::PckIdentity;pub use policy::PlatformInfo;pub use policy::Policy;pub use policy::QeInfo;pub use policy::QuoteClaims;pub use policy::QuotePolicy;pub use policy::QuotePolicyConfig;pub use policy::TcbVerdict;pub use qe_identity::QeIdentity;pub use qe_identity::QeTcb;pub use qe_identity::QeTcbLevel;pub use tcb_info::Tcb;pub use tcb_info::TcbComponents;pub use tcb_info::TcbInfo;pub use tcb_info::TcbLevel;pub use tcb_info::TcbStatus;pub use tcb_info::TcbStatusWithAdvisory;
Modules§
- collateral
- config
- Pluggable configuration trait surface for quote verification.
- configs
- Preset
Configbundles built from the audited in-tree backends. - crypto
- Audited
CryptoProviderimplementations. - http
- HTTP client abstraction used by
crate::collateral. - intel
- oids
- policy
- qe_
identity - quote
- signature
- Audited
EcdsaSigEncoderimplementation backed byder. - tcb_
info - verify
- x509
- Audited
X509Codecimplementation backed byx509-cert+der.