Pārlūkot izejas kodu

Accept Azure confidential VM TDX evidence in remote-attest-01

The guest of an Azure confidential VM with Intel TDX cannot get a TDX
quote itself: there is no /dev/tdx_guest and configfs-tsm has no
provider. Its paravisor produces a TD report whose report data is
SHA-256 of a runtime claims document, zero-padded, and Azure's instance
metadata service turns that report into an Intel-signed quote. The
guest controls 64 bytes of user data in the runtime claims.

The new azure-tdx format verifies the quote with the existing TDX
verifier, checks that its report data commits to the runtime data sent
with it, and returns the claims' user data as the binding and the
relying party's nonce. The quote's MRTD measures the paravisor, not the
guest, so the format is accepted only when listed, and the runtime
claims (the vTPM's HCLAkPub key and the VM configuration) are passed to
webhooks and templates for policy.

A real quote and runtime claims captured on a deleted Standard_DC2es_v6
VM test the path against Intel's root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FfGsdwrq6AroSzEU654oya
Ted Malone 3 nedēļas atpakaļ
vecāks
revīzija
2dfe97fb79

+ 9 - 0
CHANGELOG.md

@@ -49,6 +49,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
   account and the EAB key it was created with, is sent to webhooks as
   `attestation` and given to templates as `.Attestation`. The challenge can be
   configured in `ca.json` only for now.
+- An `azure-tdx` format for `remote-attest-01`, for Azure confidential VMs with
+  Intel TDX, whose guests cannot get a TDX quote themselves. The evidence
+  (`application/vnd.smallstep.azure-tdx+json`) is the quote of the paravisor's
+  TD report and the runtime claims document its report data commits to; the
+  binding and the relying party's nonce are the 64 bytes of `user-data` in
+  those claims. The quote's MRTD measures Azure's paravisor, so the format is
+  accepted only when listed in `formats`, and the runtime claims (the vTPM's
+  `HCLAkPub` key and the VM configuration) are given to webhooks and templates
+  as `.Attestation.azureRuntime`.
 - The `attestation` package and its subpackages, which verify TDX quotes,
   SEV-SNP reports and Confidential Space tokens, and parse CMW records and
   configfs-tsm reports. The `device-attest-01` formats' verifiers (`apple`,

+ 21 - 2
attestation/attestation.go

@@ -27,12 +27,16 @@ const (
 	// FormatConfidentialSpace is a Google Cloud Attestation token for a
 	// Confidential Space workload.
 	FormatConfidentialSpace Format = "confidential-space"
+	// FormatAzureTDX is an Intel TDX quote from an Azure confidential VM
+	// whose paravisor reports for the guest, with the runtime claims the
+	// quote commits to.
+	FormatAzureTDX Format = "azure-tdx"
 )
 
 // Validate returns an error if the format is not supported.
 func (f Format) Validate() error {
 	switch f {
-	case FormatTDX, FormatSEVSNP, FormatConfidentialSpace:
+	case FormatTDX, FormatSEVSNP, FormatConfidentialSpace, FormatAzureTDX:
 		return nil
 	default:
 		return fmt.Errorf("attestation format %q is not supported", f)
@@ -40,7 +44,8 @@ func (f Format) Validate() error {
 }
 
 // Result is verified attestation evidence. Binary values are hex encoded.
-// Exactly one of TDX, SEVSNP and ConfidentialSpace is set, as Format says.
+// Exactly one of TDX, SEVSNP and ConfidentialSpace is set, as Format says;
+// for FormatAzureTDX, TDX and AzureRuntime are both set.
 type Result struct {
 	// Format is the format of the evidence.
 	Format Format `json:"format"`
@@ -52,6 +57,20 @@ type Result struct {
 	TDX               *TDX               `json:"tdx,omitempty"`
 	SEVSNP            *SEVSNP            `json:"sevSnp,omitempty"`
 	ConfidentialSpace *ConfidentialSpace `json:"confidentialSpace,omitempty"`
+	AzureRuntime      *AzureRuntime      `json:"azureRuntime,omitempty"`
+}
+
+// AzureRuntime holds the runtime claims of an Azure confidential VM, which the
+// report data of its paravisor's TDX quote commits to. On these VMs the quote's
+// MRTD measures the paravisor and its RTMRs are zero: the guest is measured in
+// the vTPM's PCRs, and HCLAkPub signs quotes of them.
+type AzureRuntime struct {
+	// Keys are the vTPM's keys as JWKs, identified by kid: HCLAkPub, its
+	// attestation key, and HCLEkPub.
+	Keys []map[string]any `json:"keys"`
+	// VMConfiguration is the VM's configuration, for example secure-boot,
+	// console-enabled and vmUniqueId.
+	VMConfiguration map[string]any `json:"vmConfiguration"`
 }
 
 // TDX holds the measurements and attributes of a verified Intel TDX quote.

+ 100 - 0
attestation/tdx/azure.go

@@ -0,0 +1,100 @@
+package tdx
+
+import (
+	"bytes"
+	"crypto/sha256"
+	"crypto/subtle"
+	"encoding/hex"
+	"encoding/json"
+	"mime"
+
+	"github.com/smallstep/certificates/attestation"
+)
+
+// AzureMediaType is the media type of the evidence of an Azure confidential VM
+// with Intel TDX: a JSON object of the paravisor's TDX quote and the runtime
+// claims it commits to.
+const AzureMediaType = "application/vnd.smallstep.azure-tdx+json"
+
+// AzureUserDataSize is the size of the user data in an Azure confidential VM's
+// runtime claims, which the guest writes to the vTPM before the paravisor
+// produces its report.
+const AzureUserDataSize = 64
+
+// IsAzureMediaType reports whether mediaType is AzureMediaType, with or without
+// parameters.
+func IsAzureMediaType(mediaType string) bool {
+	mt, _, err := mime.ParseMediaType(mediaType)
+	return err == nil && mt == AzureMediaType
+}
+
+// AzureEvidence is the evidence of an Azure confidential VM with Intel TDX.
+//
+// The guest of such a VM cannot get a TDX quote itself: there is no
+// /dev/tdx_guest and configfs-tsm has no provider. Its paravisor produces a TD
+// report whose report data is SHA-256 of a JSON document of runtime claims,
+// zero-padded to 64 bytes. The runtime claims carry the vTPM's keys, the VM's
+// configuration and 64 bytes of user data the guest chose. Azure's instance
+// metadata service turns the TD report into a quote signed by Intel's quoting
+// enclave.
+type AzureEvidence struct {
+	// Quote is the TDX quote of the paravisor's TD report.
+	Quote []byte `json:"quote"`
+	// RuntimeData is the runtime claims document, exactly as the paravisor
+	// hashed it.
+	RuntimeData []byte `json:"runtimeData"`
+}
+
+// ParseAzureEvidence parses the evidence of an Azure confidential VM. Its
+// errors match attestation.ErrInvalidEvidence.
+func ParseAzureEvidence(value []byte) (*AzureEvidence, error) {
+	var e AzureEvidence
+	dec := json.NewDecoder(bytes.NewReader(value))
+	dec.DisallowUnknownFields()
+	if err := dec.Decode(&e); err != nil {
+		return nil, attestation.Invalidf("error parsing azure tdx evidence: %w", err)
+	}
+	if dec.More() {
+		return nil, attestation.Invalidf("azure tdx evidence has trailing data")
+	}
+	if len(e.Quote) == 0 || len(e.RuntimeData) == 0 {
+		return nil, attestation.Invalidf("azure tdx evidence needs a quote and runtime data")
+	}
+	return &e, nil
+}
+
+// azureRuntimeClaims is the runtime claims document of an Azure confidential
+// VM.
+type azureRuntimeClaims struct {
+	Keys            []map[string]any `json:"keys"`
+	VMConfiguration map[string]any   `json:"vm-configuration"`
+	UserData        string           `json:"user-data"`
+}
+
+// Claims checks that the report data of the evidence's verified quote commits
+// to its runtime data, and returns the runtime claims and the user data they
+// carry. Its errors match attestation.ErrInvalidEvidence.
+func (e *AzureEvidence) Claims(reportData []byte) (*attestation.AzureRuntime, []byte, error) {
+	if len(reportData) != ReportDataSize {
+		return nil, nil, attestation.Invalidf("tdx quote report data has %d bytes, not %d", len(reportData), ReportDataSize)
+	}
+	want := make([]byte, ReportDataSize)
+	sum := sha256.Sum256(e.RuntimeData)
+	copy(want, sum[:])
+	if subtle.ConstantTimeCompare(reportData, want) != 1 {
+		return nil, nil, attestation.Invalidf("tdx quote report data does not commit to the azure runtime data")
+	}
+
+	var claims azureRuntimeClaims
+	if err := json.Unmarshal(e.RuntimeData, &claims); err != nil {
+		return nil, nil, attestation.Invalidf("error parsing azure runtime claims: %w", err)
+	}
+	userData, err := hex.DecodeString(claims.UserData)
+	if err != nil || len(userData) != AzureUserDataSize {
+		return nil, nil, attestation.Invalidf("azure runtime claims user-data is not the hex encoding of %d bytes", AzureUserDataSize)
+	}
+	return &attestation.AzureRuntime{
+		Keys:            claims.Keys,
+		VMConfiguration: claims.VMConfiguration,
+	}, userData, nil
+}

+ 130 - 0
attestation/tdx/azure_test.go

@@ -0,0 +1,130 @@
+package tdx
+
+import (
+	"context"
+	"crypto/sha256"
+	"encoding/hex"
+	"errors"
+	"os"
+	"strings"
+	"testing"
+	"time"
+
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
+	"github.com/smallstep/certificates/attestation"
+)
+
+// azureTestTime is shortly after testdata/azure-dcesv6.json was captured on an
+// Azure Standard_DC2es_v6 confidential VM, which has since been deleted.
+var azureTestTime = time.Date(2026, time.September, 1, 2, 0, 0, 0, time.UTC)
+
+// azureUserData is the user data the guest wrote before that capture.
+const azureUserData = "ff094709cc1749f0f41c874e557a2fda67fda8a01d1d35c18333161cdd50a10e" +
+	"3a078b959e9c31cbb23fe75ec1b9cb4ff431086984784bd5bc2734d19985631c"
+
+func readAzureEvidence(t *testing.T) *AzureEvidence {
+	t.Helper()
+	b, err := os.ReadFile("testdata/azure-dcesv6.json")
+	require.NoError(t, err)
+	e, err := ParseAzureEvidence(b)
+	require.NoError(t, err)
+	return e
+}
+
+// commit returns the report data that commits to runtime data.
+func commit(runtimeData []byte) []byte {
+	reportData := make([]byte, ReportDataSize)
+	sum := sha256.Sum256(runtimeData)
+	copy(reportData, sum[:])
+	return reportData
+}
+
+func TestAzureEvidence(t *testing.T) {
+	t.Run("ok", func(t *testing.T) {
+		// A real quote from Azure's paravisor: its signature, its quoting
+		// enclave's report and its PCK chain to Intel's root are verified.
+		e := readAzureEvidence(t)
+		res, reportData, err := newVerifier(t, false, azureTestTime).Verify(context.Background(), e.Quote)
+		require.NoError(t, err)
+		// MRTD measures the paravisor, and the RTMRs are not used.
+		assert.True(t, strings.HasPrefix(res.MRTD, "a2e61f13"))
+		for _, rtmr := range res.RTMRs {
+			assert.Equal(t, strings.Repeat("0", 96), rtmr)
+		}
+		assert.Equal(t, "0000001000000000", res.TDAttributes)
+
+		runtime, userData, err := e.Claims(reportData)
+		require.NoError(t, err)
+		assert.Equal(t, azureUserData, hex.EncodeToString(userData))
+		require.Len(t, runtime.Keys, 2)
+		assert.Equal(t, "HCLAkPub", runtime.Keys[0]["kid"])
+		assert.Equal(t, true, runtime.VMConfiguration["secure-boot"])
+	})
+
+	t.Run("fail runtime data changed", func(t *testing.T) {
+		e := readAzureEvidence(t)
+		_, reportData, err := newVerifier(t, false, azureTestTime).Verify(context.Background(), e.Quote)
+		require.NoError(t, err)
+		e.RuntimeData = []byte(strings.Replace(string(e.RuntimeData), `"secure-boot":true`, `"secure-boot":false`, 1))
+		_, _, err = e.Claims(reportData)
+		assert.ErrorContains(t, err, "does not commit to the azure runtime data")
+		assert.True(t, errors.Is(err, attestation.ErrInvalidEvidence))
+	})
+
+	padded := []byte(`{"user-data":"` + azureUserData + `"}`)
+	nonZeroPadding := commit(padded)
+	nonZeroPadding[ReportDataSize-1] = 1
+	short := []byte(`{"user-data":"0011"}`)
+	notHex := []byte(`{"user-data":"zz"}`)
+	notJSON := []byte(`not json`)
+	tests := []struct {
+		name        string
+		runtimeData []byte
+		reportData  []byte
+		wantErr     string
+	}{
+		{"fail report data size", padded, commit(padded)[:32], "report data has 32 bytes"},
+		{"fail non-zero padding", padded, nonZeroPadding, "does not commit"},
+		{"fail user-data size", short, commit(short), "not the hex encoding of 64 bytes"},
+		{"fail user-data hex", notHex, commit(notHex), "not the hex encoding of 64 bytes"},
+		{"fail runtime claims json", notJSON, commit(notJSON), "error parsing azure runtime claims"},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			e := &AzureEvidence{Quote: []byte{1}, RuntimeData: tt.runtimeData}
+			_, _, err := e.Claims(tt.reportData)
+			assert.ErrorContains(t, err, tt.wantErr)
+			assert.True(t, errors.Is(err, attestation.ErrInvalidEvidence))
+		})
+	}
+}
+
+func TestParseAzureEvidence(t *testing.T) {
+	tests := []struct {
+		name    string
+		value   string
+		wantErr string
+	}{
+		{"fail not json", `quote`, "error parsing azure tdx evidence"},
+		{"fail unknown field", `{"quote":"AQ==","runtimeData":"AQ==","nonce":"AQ=="}`, "unknown field"},
+		{"fail trailing data", `{"quote":"AQ==","runtimeData":"AQ=="}{}`, "trailing data"},
+		{"fail no quote", `{"runtimeData":"AQ=="}`, "needs a quote and runtime data"},
+		{"fail no runtime data", `{"quote":"AQ=="}`, "needs a quote and runtime data"},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			_, err := ParseAzureEvidence([]byte(tt.value))
+			assert.ErrorContains(t, err, tt.wantErr)
+			assert.True(t, errors.Is(err, attestation.ErrInvalidEvidence))
+		})
+	}
+}
+
+func TestIsAzureMediaType(t *testing.T) {
+	assert.True(t, IsAzureMediaType(AzureMediaType))
+	assert.True(t, IsAzureMediaType(AzureMediaType+"; charset=utf-8"))
+	assert.False(t, IsAzureMediaType("application/vnd.veraison.tsm-report+json"))
+	assert.False(t, IsAzureMediaType("not a media type;"))
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
attestation/tdx/testdata/azure-dcesv6.json


+ 41 - 5
authority/provisioner/acme_remote_attestation.go

@@ -43,9 +43,10 @@ type ACMERemoteAttestation struct {
 	// Require adds a remote-attestation identifier to every order that does
 	// not have one, so that every certificate needs attestation.
 	Require bool `json:"require,omitempty"`
-	// Formats are the evidence formats accepted: tdx, sev-snp and
-	// confidential-space. It defaults to tdx and sev-snp, and to
-	// confidential-space too if ConfidentialSpace is set.
+	// Formats are the evidence formats accepted: tdx, sev-snp,
+	// confidential-space and azure-tdx. It defaults to tdx and sev-snp, and
+	// to confidential-space too if ConfidentialSpace is set. azure-tdx is
+	// only accepted when listed.
 	Formats []attestation.Format `json:"formats,omitempty"`
 	// ClaimsHint is sent to clients as the challenge's attestClaimsHint.
 	ClaimsHint []string `json:"claimsHint,omitempty"`
@@ -148,8 +149,11 @@ func (p *ACME) initializeRemoteAttestation() error {
 		}
 		var err error
 		switch f {
-		case attestation.FormatTDX:
-			v.tdx, err = tdx.New(o.TDXRoots, collateral.TDX{Getter: getter})
+		case attestation.FormatTDX, attestation.FormatAzureTDX:
+			// Both formats verify a TDX quote, and share one verifier.
+			if v.tdx == nil {
+				v.tdx, err = tdx.New(o.TDXRoots, collateral.TDX{Getter: getter})
+			}
 		case attestation.FormatSEVSNP:
 			v.sevsnp, err = sevsnp.New(o.SEVSNPRoots, collateral.SEVSNP{Getter: getter})
 		case attestation.FormatConfidentialSpace:
@@ -208,6 +212,9 @@ func (p *ACME) IsEABRequired() bool {
 //   - For a TDX quote or an SEV-SNP report, sent as a configfs-tsm report
 //     (application/vnd.veraison.tsm-report+json or +cbor), its 64 bytes of
 //     report data.
+//   - For the evidence of an Azure confidential VM with Intel TDX
+//     (application/vnd.smallstep.azure-tdx+json), the 64 bytes of user data
+//     in the runtime claims its paravisor's quote commits to.
 //   - For a Confidential Space token (application/eat+jwt or application/jwt),
 //     its first eat_nonce value, the base64url encoding, without padding, of 32
 //     bytes. Its other nonces are the relying party's and stay in the claims.
@@ -234,6 +241,9 @@ func (p *ACME) VerifyRemoteAttestation(ctx context.Context, r *cmw.Record, defau
 	case tsm.IsMediaType(r.MediaType):
 		res, bound, err = v.verifyTSMReport(ctx, r)
 		size = RemoteAttestationBindingSize + RemoteAttestationClaimNonceSize
+	case tdx.IsAzureMediaType(r.MediaType):
+		res, bound, err = v.verifyAzureTDX(ctx, r)
+		size = RemoteAttestationBindingSize + RemoteAttestationClaimNonceSize
 	case isJWTMediaType(r.MediaType):
 		res, bound, err = v.verifyConfidentialSpace(r, defaultAudience)
 		size = RemoteAttestationBindingSize
@@ -294,6 +304,32 @@ func (v *remoteAttestationVerifier) verifyTSMReport(ctx context.Context, r *cmw.
 	}
 }
 
+// verifyAzureTDX verifies the evidence of an Azure confidential VM with Intel
+// TDX. Its guest cannot get a TDX quote itself, so it writes the binding and
+// the relying party's nonce as the user data of the runtime claims its
+// paravisor's quote commits to.
+func (v *remoteAttestationVerifier) verifyAzureTDX(ctx context.Context, r *cmw.Record) (*attestation.Result, []byte, error) {
+	if err := v.enabled(attestation.FormatAzureTDX); err != nil {
+		return nil, nil, err
+	}
+	if r.Indicator != 0 && !r.Indicator.Has(cmw.Evidence) {
+		return nil, nil, attestation.Invalidf("azure tdx evidence must be indicated as evidence")
+	}
+	e, err := tdx.ParseAzureEvidence(r.Value)
+	if err != nil {
+		return nil, nil, err
+	}
+	res, reportData, err := v.tdx.Verify(ctx, e.Quote)
+	if err != nil {
+		return nil, nil, err
+	}
+	runtime, userData, err := e.Claims(reportData)
+	if err != nil {
+		return nil, nil, err
+	}
+	return &attestation.Result{Format: attestation.FormatAzureTDX, TDX: res, AzureRuntime: runtime}, userData, nil
+}
+
 func (v *remoteAttestationVerifier) verifyConfidentialSpace(r *cmw.Record, defaultAudience string) (*attestation.Result, []byte, error) {
 	if err := v.enabled(attestation.FormatConfidentialSpace); err != nil {
 		return nil, nil, err

+ 84 - 0
authority/provisioner/acme_remote_attestation_test.go

@@ -5,6 +5,8 @@ import (
 	"context"
 	"crypto/sha256"
 	"encoding/base64"
+	"encoding/hex"
+	"encoding/json"
 	"errors"
 	"io"
 	"net/http"
@@ -19,6 +21,7 @@ import (
 	"github.com/smallstep/certificates/attestation/cmw"
 	"github.com/smallstep/certificates/attestation/confidentialspace"
 	cstest "github.com/smallstep/certificates/attestation/confidentialspace/confidentialspacetest"
+	"github.com/smallstep/certificates/attestation/tdx"
 	"github.com/smallstep/certificates/authority/policy"
 	"github.com/smallstep/certificates/webhook"
 )
@@ -100,6 +103,12 @@ func TestACME_Init_remoteAttestation(t *testing.T) {
 			&ACMERemoteAttestation{ClaimsHint: []string{"hwmodel", ""}}, nil, "claimsHint cannot contain empty values"},
 		{"fail tdx roots", []ACMEChallenge{REMOTE_ATTEST_01},
 			&ACMERemoteAttestation{TDXRoots: []byte("not pem")}, nil, "error initializing the tdx format"},
+		{"ok azure-tdx", []ACMEChallenge{REMOTE_ATTEST_01},
+			&ACMERemoteAttestation{Formats: []attestation.Format{attestation.FormatAzureTDX}},
+			[]attestation.Format{attestation.FormatAzureTDX}, ""},
+		{"fail azure-tdx roots", []ACMEChallenge{REMOTE_ATTEST_01},
+			&ACMERemoteAttestation{Formats: []attestation.Format{attestation.FormatAzureTDX}, TDXRoots: []byte("not pem")}, nil,
+			"error initializing the azure-tdx format"},
 		{"fail sev-snp roots", []ACMEChallenge{REMOTE_ATTEST_01},
 			&ACMERemoteAttestation{SEVSNPRoots: pki.RootPEM()}, nil, "error initializing the sev-snp format"},
 		// Google's root is pinned, so the format needs no configuration.
@@ -384,3 +393,78 @@ func TestACME_VerifyRemoteAttestation_tdx(t *testing.T) {
 		})
 	}
 }
+
+// azureEvidence returns the evidence of an Azure confidential VM whose runtime
+// claims carry userData, and the report data that commits to them.
+func azureEvidence(t *testing.T, userData []byte) ([]byte, []byte) {
+	t.Helper()
+	runtime := []byte(`{"keys":[{"kid":"HCLAkPub","kty":"RSA"}],"vm-configuration":{"secure-boot":true},"user-data":"` +
+		hex.EncodeToString(userData) + `"}`)
+	value, err := json.Marshal(map[string][]byte{"quote": {0, 1, 2}, "runtimeData": runtime})
+	require.NoError(t, err)
+	reportData := make([]byte, 64)
+	sum := sha256.Sum256(runtime)
+	copy(reportData, sum[:])
+	return value, reportData
+}
+
+func TestACME_VerifyRemoteAttestation_azureTDX(t *testing.T) {
+	bound := testBound()
+	value, reportData := azureEvidence(t, bound)
+	azure := &ACMERemoteAttestation{Formats: []attestation.Format{attestation.FormatAzureTDX}}
+
+	t.Run("ok", func(t *testing.T) {
+		p := newRemoteAttestationACME(t, azure, staticHTTPClient{})
+		fake := &fakeTDXVerifier{result: &attestation.TDX{MRTD: "aa", TCBStatus: "UpToDate"}, bound: reportData}
+		p.remoteAttestation.tdx = fake
+		got, gotBound, err := p.VerifyRemoteAttestation(context.Background(), jsonCMW(tdx.AzureMediaType, value, cmw.Evidence), "")
+		require.NoError(t, err)
+		assert.Equal(t, []byte{0, 1, 2}, fake.quote)
+		// The binding and the claim nonce come from the runtime claims'
+		// user data, not from the quote's report data.
+		assert.Equal(t, bound, gotBound)
+		assert.Equal(t, attestation.FormatAzureTDX, got.Format)
+		assert.Equal(t, fake.result, got.TDX)
+		require.NotNil(t, got.AzureRuntime)
+		assert.Equal(t, "HCLAkPub", got.AzureRuntime.Keys[0]["kid"])
+		assert.Equal(t, true, got.AzureRuntime.VMConfiguration["secure-boot"])
+		assert.Equal(t, value, got.Evidence)
+	})
+
+	otherReportData := append([]byte(nil), reportData...)
+	otherReportData[0] ^= 1
+	tests := []struct {
+		name        string
+		o           *ACMERemoteAttestation
+		fake        *fakeTDXVerifier
+		record      *cmw.Record
+		wantErr     string
+		wantInvalid bool
+	}{
+		// Like configfs-tsm reports, an Azure quote is evidence only when
+		// listed, since its MRTD measures Azure's paravisor, not the guest.
+		{"fail not enabled", nil, &fakeTDXVerifier{result: &attestation.TDX{}, bound: reportData},
+			jsonCMW(tdx.AzureMediaType, value, 0), "attestation format azure-tdx is not enabled", true},
+		{"fail indicator", azure, &fakeTDXVerifier{result: &attestation.TDX{}, bound: reportData},
+			jsonCMW(tdx.AzureMediaType, value, cmw.AttestationResults), "must be indicated as evidence", true},
+		{"fail evidence", azure, &fakeTDXVerifier{result: &attestation.TDX{}, bound: reportData},
+			jsonCMW(tdx.AzureMediaType, []byte(`{}`), 0), "needs a quote and runtime data", true},
+		{"fail invalid quote", azure, &fakeTDXVerifier{err: attestation.Invalidf("tdx quote is from a debug trust domain")},
+			jsonCMW(tdx.AzureMediaType, value, 0), "debug trust domain", true},
+		{"fail collateral", azure, &fakeTDXVerifier{err: errors.New("error fetching tdx collateral")},
+			jsonCMW(tdx.AzureMediaType, value, 0), "error fetching tdx collateral", false},
+		{"fail report data", azure, &fakeTDXVerifier{result: &attestation.TDX{}, bound: otherReportData},
+			jsonCMW(tdx.AzureMediaType, value, 0), "does not commit to the azure runtime data", true},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			p := newRemoteAttestationACME(t, tt.o, staticHTTPClient{})
+			if p.remoteAttestation.tdx != nil {
+				p.remoteAttestation.tdx = tt.fake
+			}
+			_, _, err := p.VerifyRemoteAttestation(context.Background(), tt.record, "")
+			assert.ErrorContains(t, err, tt.wantErr)
+			assert.Equal(t, tt.wantInvalid, errors.Is(err, attestation.ErrInvalidEvidence))
+		})
+	}
+}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels