Skip to content

automata-network/automata-dcap-qpl

Repository files navigation

Automata DCAP QPL

Automata DCAP QPL

About

We present a Web3 implementation of the Intel SGX DCAP V3 attestation using on-chain capabilities, available at on-chain Intel SGX DCAP v3 attestation repo. This implementation aims to transition the DCAP attestation verification process from an off-chain entity to a decentralized on-chain environment. However, a notable drawback is its reliance on the contract owner to periodically upload verification collaterals to fulfill the attestation requirements. Additionally, the manually uploaded collaterals lack Trusted Computing Base (TCB) signature verification, rendering them insecure. Any compromise of the contract owner jeopardizes all verification processes.

To address this vulnerability, we introduce an on-chain implementation of the Intel SGX DCAP attestation Provisioning Certification Caching Service (PCCS) here. This service enables both the quote generator and verifier to conveniently fetch and upload collaterals through smart contracts. To enhance security, we incorporate read/write validation for all uploaded collaterals before inserting them to the on-chain PCCS. Simultaneously, we are releasing the Automata DCAP Attestation as the next iteration of the Automata DCAP V3 attestation, as mentioned in the previous paragraph, to streamline the verification process while providing enhanced security and availability guarantees.

Within this repository, two key components are featured:

  • Automata DCAP QPL LIB: The customized platform quote provider library when generating and verifying the Intel SGX / TDX DCAP attestation quote. It will try to fetch the necessary collaterals from on-chain PCCS, and if cache miss, it will try to use cloud provider PCCS as the fallback option, and use Intel PCS as the final fallback choice.
  • Automata DCAP QPL TOOL: This tool facilitates interaction with the on-chain registry, enabling quote generators to upload necessary collaterals for use in both quote generation and verification processes.

Usage

Take Automata SGX Scaffold repo as the example to demonstrate how to use this lib and tool.

Automata DCAP QPL LIB

  1. Build the lib with the following commands, you can find the lib at automata-dcap-qpl/automata-dcap-qpl-lib/target/release path.
$ git clone [email protected]:automata-network/automata-dcap-qpl.git
$ cd automata-dcap-qpl-lib
$ cargo build --release
  1. Move the lib to override the default platform quote provider library, please make sure you already follow the Automata SGX Scaffold tutorial to setup the environment.
$ for f in /usr/lib/x86_64-linux-gnu/libdcap_quoteprov.so*; do sudo mv "$f" "$f.bak"; done
$ cd automata-dcap-qpl/automata-dcap-qpl-lib/target/release
$ sudo cp libautomata_dcap_qpl.so /usr/lib/x86_64-linux-gnu/libdcap_quoteprov.so
  1. Build and run the SGX Scaffold, find more details at Automata SGX Scaffold repo.
$ cd sgx-scaffold
$ cargo sgx build
$ cargo sgx run

Available environment variables:

variables description default value
AUTOMATA_DCAP_COLLATERAL_VERSION The API version of the collateral and quote "v3"
INTEL_PCS_SUBSCRIPTION_KEY The subscription key to be used when fallback to Intel PCS API empty

Automata DCAP QPL TOOL

Build the tool and upload the necessary collaterals on chain to satisfy the quote generation and verification requirements, you need to prepare a wallet with enough balance in Automata Testnet for the transactions.

Use ./automata-dcap-qpl-tool -h to see the details, or edit the code to set the necessary inputs.

Example: Use the quote to check whether there is any missing collateral on-chain, and the tool will help you to fetch and upsert it before you perform the on-chain verification.

cd automata-dcap-qpl-tool
source env/automata_testnet
./target/release/automata-dcap-qpl-tool --quote_hex <quote hex string> -p <wallet_private_key> --chain_id=$CHAIN_ID --rpc_url=$RPC_URL

See C.1. section in Intel SGX ECDSA Quote Lib Reference DCAP API.

Upsert transaction samples

Available environment variables:

variables description default value
INTEL_PCS_SUBSCRIPTION_KEY The subscription key to be used when fallback to Intel PCS API empty

Fallback logics

  • Use Azure PCCS as the fallback option when the collaterals are not available in on-chain PCCS, make sure you're executing the enclave in Azure VM and install the Azure DCAP client.
  • Use Intel PCS as the final fallback option, you should specify your Ocp-Apim-Subscription-Key to INTEL_PCS_SUBSCRIPTION_KEY environment variable before using it.

Automata On-chain PCCS resources

Find latest PCCS contracts in Automata On Chain PCCS repo.

See also

Contributing

Before You Contribute:

  • Raise an Issue: If you find a bug or wish to suggest a feature, please open an issue first to discuss it. Detail the bug or feature so we understand your intention.
  • Pull Requests (PR): Before submitting a PR, ensure:
    • Your contribution successfully builds.
    • It includes tests, if applicable.

License

Apache License

About

Automata DCAP Quote Provider Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages