Verify the attestation
GET /v1/attestation returns a fresh proof of the enclave that serves confidential keys, bound to a nonce you choose. Everything in it can be checked against Intel’s root of trust, so you do not have to take Belarel’s word for it. Run this check when you onboard, and periodically or whenever you see a new enclave_key or measurements value on your answers.
You need a confidential key with the inference scope. Belarel checks the key first, as on every call: a key without the inference scope gets 403 scope_denied. A valid key that is not confidential then gets 403 confidential_key_required. A sandbox confidential key works too and gets a real proof. Each request counts against the key’s rate limit.
Step by step
Section titled “Step by step”-
Generate a nonce. Use 32 random bytes, written as 64 lowercase hexadecimal characters. Belarel lowercases the nonce before using it, and the proof binds the lowercase form.
Terminal window NONCE=$(openssl rand -hex 32) -
Request the proof. Pass the nonce as the
noncequery parameter.Terminal window curl "https://api.belarel.com/v1/attestation?nonce=$NONCE" \-H "Authorization: Bearer $BELAREL_API_KEY"The answer contains
object: "attestation", yournonceechoed back,tee: "intel_tdx",verifier: "intel_dcap",verified_at,tcb_status,quote(base64),collateral,event_log(base64, ornull),report_data: "sha512(nonce)",enclave_key,key_possession,measurements,measurements_status,measurements_approvedandintel_token(ornull). First check thatnonceis exactly the value you sent. -
Check that the quote binds your nonce. Decode
quotefrom base64. Its REPORTDATA field (64 bytes) must equal SHA-512 of the nonce’s ASCII bytes: the hash of the 64-character hex string itself, not of the 32 bytes it encodes. While you have the quote open, check that it is a version 4 TDX quote and that the debug attribute is off. Offsets, in the raw quote:Field Bytes Expected Version 0–1, little-endian4TEE type 4–7, little-endian0x81(TDX)TD_ATTRIBUTES, debug bit (bit 0) 1680(not debuggable)MRTD 184–231measurements.mrtdMRCONFIGID 232–279measurements.mrconfigidRTMR0–3 376–567, 48 bytes eachmeasurements.rtmr0…rtmr3REPORTDATA 568–631SHA-512(nonce ASCII)The script below does this step and steps 5 and 6.
-
Verify the quote and its collateral with a DCAP verifier. Give
quoteandcollateralto any Intel DCAP quote verifier.collateralis the Intel-signed collateral Belarel verified the quote with: the PCK certificate chain, the PCK and root CA revocation lists, and the TCB info and QE identity with their signatures and issuer chains. Your verifier must confirm that:- the PCK certificate chain ends at Intel’s root CA, using your own copy of Intel’s root certificate, never one taken from the response;
- the quote’s signature and the quoting enclave’s report verify, so the measurements and REPORTDATA you read in step 3 are the ones Intel’s chain covers;
- the TCB info and QE identity signatures verify, and no certificate is revoked;
- the TCB status it computes matches
tcb_status, which Belarel computed on this same quote with this collateral (with newer collateral from Intel, it may be worse). Belarel serves calls onUpToDateandSWHardeningNeeded, and also on a host behind on Intel’s patches (OutOfDate,ConfigurationNeeded,ConfigurationAndSWHardeningNeeded,OutOfDateConfigurationNeeded), which it is alerted about; onlyRevoked, or any other status, is refused. You can apply a stricter policy; - the TD is not debuggable, if your verifier reports TD attributes.
collateralis a JSON object. The certificate chains (the…_issuer_chainfields andpck_certificate_chain),tcb_infoandqe_identityare strings.root_ca_crl,pck_crl,tcb_info_signatureandqe_identity_signatureare arrays of byte values (numbers from 0 to 255). If your DCAP quote verifier expects bytes, convert those four arrays first: the two revocation lists are DER, and the two signatures are Intel’s raw signature bytes.Collateral has a validity period. If you verify long after the request, or prefer not to use the collateral Belarel returned, let your verifier fetch current collateral from Intel.
-
Check the measurements. The
measurementsin the response must match the quote (step 3). Then readmeasurements_status:approved: Belarel has reviewed and approved this combination.pending: the combination is new — a new deployment of the enclave, or a new host type — and Belarel has not reviewed it yet. The proof is real, and confidential calls are served, unless another recently seen replica runs a revoked combination. Since 2026-10-05, a combination can be approved only from a DCAP-verified quote; combinations approved before keep their status.revoked: Belarel refused this combination. The proof is still returned so you can inspect it, but confidential calls answer503 attestation_unavailablewhile a replica running it has been seen in the last 15 minutes (instances are sampled, not enumerated).
Here
measurements_approvedistrueonly whenmeasurements_statusisapproved: it describes the instance that answered. On an answer’sbelarel.attestationblock, the same field says whether every combination the enclave fleet was seen with in the last 15 minutes is approved. Record the values you accept. Different enclave instances can report different combinations, each reviewed separately, so compare against the set you have seen rather than a single value. Themeasurementson your answers’belarel.attestationblock should belong to that set. -
Check the key that signed your nonce.
key_possession.signatureis an RS256 signature (RSASSA-PKCS1-v1_5 with SHA-256), in base64, over the same input as REPORTDATA: the nonce’s 64 ASCII bytes (key_possession.input: "nonce"). Verify it withenclave_key.public_key_pem. Then compute SHA-256 of that key’s DERSubjectPublicKeyInfo, in lowercase hex: it must equalenclave_key.spki_sha256, the value every confidential call’s TLS connection is pinned to. This shows that the holder ofenclave_keysigned your nonce; it does not, on its own, show that the key lives in the enclave (see below). -
Optional: check
intel_token. When Belarel has Intel Trust Authority configured,intel_tokenis a JWT signed by Intel Trust Authority for the same quote and nonce; otherwise it isnull, which is normal and never a failure. If present, first check that itsissclaim equals Intel Trust Authority’s portal URL,https://portal.trustauthority.intel.com, then verify its signature (PS384orRS256) with the keys you fetch yourself fromhttps://portal.trustauthority.intel.com/certs. Never take keys from ajkuheader or from an issuer the token names itself: ifissis not that URL, or the signature does not verify, reject the token. Then check its claims — undertdxin recent token versions:tdx_report_dataequals the quote’s REPORTDATA,tdx_mrtd,tdx_mrconfigidandtdx_rtmr0–3equalmeasurements,tdx_is_debuggableisfalse, andattester_tcb_statusis acceptable to you.
Complete script
Section titled “Complete script”This script performs steps 1, 2, 3, 5 and 6. Run your DCAP verifier (step 4) on the same quote and collateral.
import base64, hashlib, os, secretsimport requestsfrom cryptography.hazmat.primitives import hashes, serializationfrom cryptography.hazmat.primitives.asymmetric import padding
nonce = secrets.token_hex(32) # 64 lowercase hex charactersr = requests.get( "https://api.belarel.com/v1/attestation", params={"nonce": nonce}, headers={"Authorization": f"Bearer {os.environ['BELAREL_API_KEY']}"}, timeout=30,)r.raise_for_status()proof = r.json()assert proof["nonce"] == nonce
# Step 3 — the quote binds the nonce, is TDX v4, and is not debuggable.quote = base64.b64decode(proof["quote"])assert int.from_bytes(quote[0:2], "little") == 4assert int.from_bytes(quote[4:8], "little") == 0x81assert quote[168] & 1 == 0, "debuggable TD"assert quote[568:632] == hashlib.sha512(nonce.encode("ascii")).digest(), "REPORTDATA"
# Step 5 — the measurements are the quote's; print their review status.offsets = {"mrtd": 184, "mrconfigid": 232, "rtmr0": 376, "rtmr1": 424, "rtmr2": 472, "rtmr3": 520}for name, start in offsets.items(): assert quote[start:start + 48].hex() == proof["measurements"][name], nameprint("measurements_status:", proof["measurements_status"], "approved:", proof["measurements_approved"])
# Step 6 — the TLS key signed the nonce, and is the pinned key.key = serialization.load_pem_public_key(proof["enclave_key"]["public_key_pem"].encode())spki = key.public_bytes(serialization.Encoding.DER, serialization.PublicFormat.SubjectPublicKeyInfo)assert hashlib.sha256(spki).hexdigest() == proof["enclave_key"]["spki_sha256"]key.verify( # raises InvalidSignature on failure base64.b64decode(proof["key_possession"]["signature"]), nonce.encode("ascii"), padding.PKCS1v15(), hashes.SHA256(),)print("OK — now verify quote + collateral with your DCAP verifier")import assert from 'node:assert/strict';import { createHash, createPublicKey, randomBytes, verify } from 'node:crypto';
const nonce = randomBytes(32).toString('hex'); // 64 lowercase hex charactersconst res = await fetch(`https://api.belarel.com/v1/attestation?nonce=${nonce}`, { headers: { Authorization: `Bearer ${process.env.BELAREL_API_KEY}` },});if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);const proof = await res.json();assert.equal(proof.nonce, nonce);
// Step 3 — the quote binds the nonce, is TDX v4, and is not debuggable.const quote = Buffer.from(proof.quote, 'base64');assert.equal(quote.readUInt16LE(0), 4);assert.equal(quote.readUInt32LE(4), 0x81);assert.equal(quote[168] & 1, 0, 'debuggable TD');const expected = createHash('sha512').update(Buffer.from(nonce, 'ascii')).digest();assert.ok(quote.subarray(568, 632).equals(expected), 'REPORTDATA');
// Step 5 — the measurements are the quote's; print their review status.const offsets = { mrtd: 184, mrconfigid: 232, rtmr0: 376, rtmr1: 424, rtmr2: 472, rtmr3: 520 } as const;for (const [name, start] of Object.entries(offsets)) { assert.equal(quote.subarray(start, start + 48).toString('hex'), proof.measurements[name], name);}console.log('measurements_status:', proof.measurements_status, 'approved:', proof.measurements_approved);
// Step 6 — the TLS key signed the nonce, and is the pinned key.const key = createPublicKey(proof.enclave_key.public_key_pem);const spki = key.export({ type: 'spki', format: 'der' });assert.equal(createHash('sha256').update(spki).digest('hex'), proof.enclave_key.spki_sha256);const signed = verify('sha256', Buffer.from(nonce, 'ascii'), key, Buffer.from(proof.key_possession.signature, 'base64'));assert.ok(signed, 'key_possession');console.log('OK — now verify quote + collateral with your DCAP verifier');What the proof shows, and what it does not
Section titled “What the proof shows, and what it does not”- It shows that a genuine Intel TDX enclave with these measurements, not debuggable and at the reported TCB level, produced a quote for your nonce, now; and that the holder of
enclave_keysigned the same nonce. What is attested is the TDX guest that terminates the connection: there is no GPU attestation, and the quote does not show, by itself, that the model runs inside the enclave. - The quote does not contain the key. REPORTDATA carries only the hash of your nonce. What ties
enclave_keyto the enclave is that the quote and the signature arrived over one TLS connection whose certificate carries that key. You can verify each half, but not the link: a relay by someone holding a certificate for the enclave’s domain is not excluded cryptographically. That link rests on the enclave operator. - One proof, one instance. A proof comes from the enclave instance that answered. Before serving calls, Belarel samples several instances, requires the same key on all of them, and refuses as soon as one runs a revoked combination. Every sampled instance goes through the nonce, debug mode, key, DCAP chain and TCB status checks before its measurements are recorded. The optional Intel Trust Authority cross-check (step 7) runs only on the instance that answers a proof — yours, or the first one of each verdict — and only when Belarel has it configured.
How this relates to belarel.attestation
Section titled “How this relates to belarel.attestation”Every answer of a confidential key carries a belarel.attestation block: the verdict Belarel established with its own nonce, reused for up to 10 minutes. It has no quote or nonce, so it cannot be verified on its own. Use it to link your calls to a proof you verified:
enclave_key.spki_sha256must equal the value you verified in step 6.measurementsmust belong to the set you accepted in step 5.tcb_statusthere is the worst status among the instances Belarel sampled for the verdict, so it can be worse than the status of the quote you verified: one instance answers your proof.- If either changes, run this check again before you trust the new values.
Errors
Section titled “Errors”| Code | HTTP | Meaning | What to do |
|---|---|---|---|
invalid_api_key |
401 | The key is missing, unknown, revoked, expired or disabled. | Check the key. |
invalid_request |
400 | nonce is missing or is not 64 hexadecimal characters (param: "nonce"). |
Send 32 random bytes as 64 hex characters. |
confidential_key_required |
403 | The key is not a confidential key. Sent with x-should-retry: false. |
Use a confidential key. |
scope_denied |
403 | The key lacks the inference scope. Checked before the data mode. |
Use a key with inference. |
method_not_allowed |
405 | A method other than GET. |
Use GET. |
rate_limited, too_many_in_flight |
429 | The key’s rate limit or in-flight cap was reached. Sent with Retry-After. |
Wait for Retry-After, then retry with a new nonce. |
attestation_unavailable |
503 | The enclave could not be reached or a check failed on Belarel’s side. Sent with Retry-After: 30. |
Retry after the delay, with a new nonce. |

