From 53c09da96584549bcc14760eb131aad42dad2c90 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere <9342524+samlaf@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:50:00 -0500 Subject: [PATCH] feat(attestation): export the compiled-in Azure vTPM root CAs A verdict on Azure evidence rests on two root CAs compiled into this crate. Everything else it rests on is either in the evidence or fetched and handed back in EndorsementSnapshot, but the roots never leave the crate. Export them as `azure::AZURE_ROOT_CA_PEMS`, (asset file stem, PEM text) pairs in anchor order, so a caller can archive them alongside the evidence and collateral (#93) and recheck a verification deterministically later without depending on the exact version of this crate that ran it. The anchor list is now built from the same slice, so the two cannot drift. A slice rather than an array, so adding a root does not change the type. --- .../attestation/src/azure/ak_certificate.rs | 21 ++++++++++++------- crates/attestation/src/azure/mod.rs | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/crates/attestation/src/azure/ak_certificate.rs b/crates/attestation/src/azure/ak_certificate.rs index a2fefe16..a9d8fdb3 100644 --- a/crates/attestation/src/azure/ak_certificate.rs +++ b/crates/attestation/src/azure/ak_certificate.rs @@ -20,15 +20,20 @@ const MICROSOFT_RSA_DEVICES_ROOT_2021: &str = pub(super) const AZURE_VIRTUAL_TPM_ROOT_2023: &str = include_str!("../../assets/azure-virtual-tpm-root-2023.pem"); +/// The root CAs AK certificate chains are verified against, as (asset file +/// stem, PEM text) pairs in anchor order +/// +/// Exported so callers can archive them alongside the evidence and +/// collateral, letting a verification be rechecked deterministically later +/// without depending on the exact version of this crate that ran it. +pub const AZURE_ROOT_CA_PEMS: &[(&str, &str)] = &[ + ("microsoft-rsa-devices-root-ca-2021", MICROSOFT_RSA_DEVICES_ROOT_2021), + ("azure-virtual-tpm-root-2023", AZURE_VIRTUAL_TPM_ROOT_2023), +]; + /// The root anchors for azure -static AZURE_ROOT_ANCHORS: Lazy>> = Lazy::new(|| { - vec![ - // Microsoft RSA Devices Root CA 2021 (older VMs) - pem_to_trust_anchor(MICROSOFT_RSA_DEVICES_ROOT_2021), - // Azure Virtual TPM Root CA 2023 (TDX + newer trusted launch) - pem_to_trust_anchor(AZURE_VIRTUAL_TPM_ROOT_2023), - ] -}); +static AZURE_ROOT_ANCHORS: Lazy>> = + Lazy::new(|| AZURE_ROOT_CA_PEMS.iter().map(|(_, pem)| pem_to_trust_anchor(pem)).collect()); /// Verify an AK certificate against pinned Azure root CAs. /// diff --git a/crates/attestation/src/azure/mod.rs b/crates/attestation/src/azure/mod.rs index 0a530292..0a294712 100644 --- a/crates/attestation/src/azure/mod.rs +++ b/crates/attestation/src/azure/mod.rs @@ -6,6 +6,7 @@ mod tpm_quote; mod tpms_attest; mod verify; +pub use ak_certificate::AZURE_ROOT_CA_PEMS; #[cfg(azure_attester_x86_64_linux)] pub use attester::{create_azure_attestation, detect_azure_cvm}; use az_cvm_vtpm::hcl;