Welcome back to the Confidential Computing Chronicles.
In Part 3, we learned how to optimize our code to fit inside the tiny memory limits of an Enclave. Now, we face a bigger problem: Trust.
Imagine I tell you: "Hey, send me your credit card number. I promise I'm running your payment code inside a secure Intel SGX Enclave. Nobody can see it."
You would be an idiot to believe me.
How do you know I'm not just running a printf() script on a hacked laptop in a basement? How do you know I didn't modify the code to email me your CC number before processing it?
This is the classic "On the Internet, nobody knows you're a dog" problem.
Remote Attestation is how we solve it. It is the cryptographic proof that I am not a dog.
The Problem: The Evil Twin
Let's say you compiled your secure Enclave. It has a specific binary hash (we call this the Measurement).
-
Good Enclave: Hash
0xABC...(Does honest math) -
Evil Enclave: Hash
0x666...(Steals your data)
On the server, they look identical. They are both just binaries running in memory. The Operating System can't be trusted to tell you the truth, because the OS might be the attacker.
We need a way for the CPU itself to speak up and say: "I certify that the code running in this protected region has the hash 0xABC...."
The Solution: The "Quote"
Remote Attestation relies on a special digital signature called a Quote.
Think of the CPU as a Notary Public.
- Measurement: When your Enclave starts, the CPU records a cryptographic hash of the initial code and data. This is called MRENCLAVE (The Enclave Identity).
- The Challenge: The User (Client) sends a random challenge (nonce) to the Server.
- The Report: The Enclave creates a "Report" containing:
- Its Measurement (
MRENCLAVE). - The User's challenge (to prevent replay attacks).
- Custom data (like a public key generated inside the Enclave).
- Its Measurement (
- The Signature: The Enclave asks a special architectural enclave (the Quoting Enclave) to sign this report using a hardware-fused private key that only Intel possesses.
This signed document is the Quote.
Interpreting the ID Card
So, the server sends you this "Quote". What do you do with it?
You (the Client) look at it and verify three things:
- The Signature is Valid: This proves the code is running on genuine Intel SGX hardware (not a simulator, not an AMD chip).
- The Measurement Matches: The hash inside the Quote matches the hash of the source code you audit and trust. This proves the code hasn't been tampered with.
- The Data is Fresh: The nonce matches the one you sent.
If all three pass, you have established a Secure Channel. You can now encrypt your secrets with the Enclave's public key (embedded in the Quote) and send them over.
Congratulations. You have just established a root of trust that bypasses the Cloud Provider entirely. AWS, Azure, or Google Cloud physically cannot see your data, and you have mathematical proof of it.
The Two Flavors: EPID vs. DCAP
If you start Googling this, you will see two acronyms fighting each other.
-
EPID (Enhanced Privacy ID): The "Old School" way. You send the Quote to Intel's Attestation Service (IAS) to verify it.
- Pros: Easier to set up initially.
- Cons: Depends on Intel's servers being online. Slow.
-
DCAP (Data Center Attestation Primitives): The "Modern" way. You verify the Quote locally using a caching service (PCCS).
- Pros: Fast, works offline (mostly), scalable for data centers.
- Cons: Setup is a nightmare of configuration files.
For modern production systems, DCAP is the standard. But be warned: setting up the PCCS (Provisioning Certificate Caching Service) is a rite of passage for SGX developers. It involves API keys, confusing docs, and lots of caffeine.
Why This Matters for Web3 & AI
Why should you care?
- Secret Network / Oasis Network: These blockchains use Attestation to prove that the nodes aren't peaking at private transaction data.
- Confidential AI: When you use ChatGPT, you trust OpenAI. But if you want to run a model on sensitive medical data in the cloud, you need Attestation to prove the model is running in an Enclave and won't leak the patient info.
Up Next
Now we have a secure Enclave (Part 2), we know how to manage its memory (Part 3), and we have proved to the world that it's genuine (Part 4).
But what happens when the power goes out? RAM is volatile. When the Enclave dies, your data dies.
We need a way to save secrets to the disk without the OS reading them.
Part 5: Sealing Secrets & Data Persistence is coming next.
Leave a Comment ๐
Quiz time: If I change one single character in my C++ source code and recompile, does the MRENCLAVE hash change?
(Hint: Yes/No?)
Also, has anyone actually managed to set up a local PCCS without throwing their keyboard out the window? Let me know in the comments. I need emotional support.

Top comments (1)
If you add a single whitespace, a comment, or change a variable name... the binary changes, the hash changes, and Remote Attestation fails.
Basically, SGX is that one friend who cancels dinner plans because you were 30 seconds late. ๐