Skip to main content

Add your description here

Project description

dcap-qvl

This crate implements the quote verification logic for DCAP (Data Center Attestation Primitives) in pure Rust. It supports both SGX (Software Guard Extensions) and TDX (Trust Domain Extensions) quotes.

Features

  • Verify SGX and TDX quotes
  • Get collateral from PCCS
  • Extract information from quotes

Usage

Add the following dependency to your Cargo.toml file to use this crate:

[dependencies]
dcap-qvl = "0.1.0"

Examples

Get Collateral from PCCS_URL and Verify Quote

To get collateral from a PCCS_URL and verify a quote, you can use the following example code:

use dcap_qvl::collateral::get_collateral;
use dcap_qvl::verify::verify;

#[tokio::main]
async fn main() {
    // Get PCCS_URL from environment variable. The URL is like "https://localhost:8081/sgx/certification/v4/".
    let pccs_url = std::env::var("PCCS_URL").expect("PCCS_URL is not set");
    let quote = std::fs::read("tdx_quote").expect("tdx_quote is not found");
    let collateral = get_collateral(&pccs_url, &quote, std::time::Duration::from_secs(10)).await.expect("failed to get collateral");
    let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs();
    let tcb = verify(&quote, &collateral, now).expect("failed to verify quote");
    println!("{:?}", tcb);
}

Get Collateral from Intel PCS and Verify Quote

use dcap_qvl::collateral::get_collateral_from_pcs;
use dcap_qvl::verify::verify;

#[tokio::main]
async fn main() {
    let quote = std::fs::read("tdx_quote").expect("tdx_quote is not found");
    let collateral = get_collateral_from_pcs(&quote, std::time::Duration::from_secs(10)).await.expect("failed to get collateral");
    let now = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs();
    let tcb = verify(&quote, &collateral, now).expect("failed to verify quote");
    println!("{:?}", tcb);
}

License

This crate is licensed under the MIT license. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dcap_qvl_x86-0.0.1.tar.gz (78.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dcap_qvl_x86-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file dcap_qvl_x86-0.0.1.tar.gz.

File metadata

  • Download URL: dcap_qvl_x86-0.0.1.tar.gz
  • Upload date:
  • Size: 78.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for dcap_qvl_x86-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f1f560b5f8f4402c4f9b72479e577f3d5602cfff22fb697633ec4dc675fe4a3a
MD5 e5cdf7348d48b810a0f363f23138402e
BLAKE2b-256 3243348788ec3a998e524956637b0dddafbb69cc58e14614286f702213aa3a47

See more details on using hashes here.

File details

Details for the file dcap_qvl_x86-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for dcap_qvl_x86-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f84b6161a4e4d9aa8eff76502ff9f4e2bc6094ada2f297e653d2931b250ee1e1
MD5 abfb21ec71ebe3cd1a4d408e2c1d77b8
BLAKE2b-256 b20dbecae737cbdc26b624840a47411a5e1ff561709833944229380e7456ff17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page