Privacy in Litentry II: Trusted Execution Environment Explained

Mel Zhou
5 min readDec 28, 2022

*Part I: Privacy’s Implications and Design.

Trusted Execution Environment (TEE) is a secure area, also known as an “Enclave,” on the CPU that is isolated from the main operating system (OS). It is designed to protect data and ensure that it is stored, processed, and kept secure.

TEE is secured by an isolated, cryptographic electronic structure that is resistant to malicious attacks and unauthorized access. The hardware manufacturer guarantees that no one — not even the system administrator or the operating system — has access to the keys or can read the memory stored within the TEE. This makes it a great choice for executing confidential tasks, such as private token transfer, private smart contracts, and private state channels.

You can think of TEE as a blackbox in a CPU that is isolated from the rest of the system. Just like a black box, the data within the TEE is invisible from the outside, and is protected and only the people with the right key can access it.

What makes a TEE safe?

1. Computation within a TEE is totally invisible from the outside

A TEE manages its own cryptographic keys, and the hardware manufacturer guarantees by design that no one — not even the system administrator or the operating system — has access to those keys or can read its memory. This allows us to execute any state update without having to share our data with the blockchain validator or other users. Private token transfer, private smart contracts, and private state channels can thus be achieved with minimal computational effort. These characteristics enable completely confidential and tamper-proof execution of software.

2. Every TEE has a remote attestation to ensure the code is running on a genuine and secure TEE

After the hardware manufacturer verifies a TEE report, they sign it with their well-known certificate. This attestation confirms:

  • The enclave is a genuine TEE of the hardware manufacturer. Intel SGX hardware manufacturing can generate unique key pairs to identify the CPU. The CPU will use its private key to sign the enclave certificate, confirming that the certificate was issued by the CPU. This verifies that the enclave is running on Intel SGX hardware.
  • The CPU microcode version indicates the security level of the hardware. Keeping the version up-to-date ensures patches for the latest known security vulnerabilities. This version also helps us gauge the security level of a CPU.
  • The specific software running and data stored in the enclave are verified to ensure the code is unmodified and the initial state is determined. Additionally, each program run in a TEE has a hash of the public key in the ISV certificate, which guarantees the program is issued by the Independent Software Vendor (ISV).

3. Encrypted computation input and output

Users will set up a Shielding Key and use the key to encrypt messages/data that are to be sent to a TEE. TEE has a public shielding key that can decrypt the message/data from the user. Shielding key allows a user’s communication with TEE or the blockchain stays confidential.

Why Intel SGX?

TEE technology is highly hardware-dependent, so it is essential to select hardware that has a higher security level. When it comes to SGX services, Intel SGX is an outstanding choice due to its dependable remote attestation service.

Intel SGX was first proposed back in 2015, which makes it one of the earliest TEEs. Additionally, compared to other TEEs such as AMD SEV or ARM CCA, Intel SGX has more robust toolchains and support materials, which makes it a much better choice. Furthermore, Intel SGX also provides its users with greater security guarantees and more reliable performance. Therefore, when it comes to TEE technology, Intel SGX is certainly a great option to consider.

Why IntergriTEE?

TEEs are invisible from the outside, and although this presents a major advantage in terms of security, it also has a downside: if the hardware is ever compromised, all data stored in the TEE is completely lost and unrecoverable. To provide a solution to this issue, IntergriTEE has developed a Layer 2 TEE sidechain and oracle.

This sidechain enables computations to be executed in parallel across multiple TEE workers, allowing for the synchronization and computation of information in multiple TEEs. This ensures that if one of the TEEs is ever compromised, it will not have any negative effects on the functioning of the sidechain. Furthermore, because the computations are divided between multiple TEEs, the data stored within the sidechain is far more secure than it would be if it was stored in a single TEE.

Why TEE, not zero-knowledge proof?

Zero-knowledge Proof (ZKP) is a technology that has been gaining traction in recent years, as it allows for the secure transmission or interaction of information without revealing the underlying data. However, TEE is ultimately a better solution for us than ZKP, after considering the design complexity, scalability, and maturity of the two technologies.

  • ZKP only manages the transmission or interaction of information but does not provide protection for information extraction/query, storage, or computation. In contrast, TEE offers a more comprehensive protection across the data workflow.
  • The design sophistication of a ZKP system is far more complex than that of a TEE system, which necessitates a more specialized profession, such as polynomial commitment design, from developers. This means that the developers must have a greater level of expertise when working with a ZKP system, as compared to a TEE system.
  • ZKP is not scalable enough to handle a wide range of problems, and is usually only developed for one or two common problems. In contrast, TEE allows you to specify any business logic to be executed inside, and is a mature solution with Intel SGX having been in use for around seven years. It will take a long time for ZKP to become performant enough for many business cases.

In conclusion, TEEs provide a secure, reliable way to store and process data, with Intel SGX being the most mature and advanced implementation of the technology. We are using IntergriTEE’s sidechain technology, which an extra layer of security by allowing computations to be run across multiple TEE nodes, ensuring that a single TEE failure does not lead to data loss. Finally, while Zero-Knowledge Proofs provide a way to transmit information securely, they are not suitable for all use cases, as they are complex to design and not as scalable or mature as a TEE system.

If you are interested in knowing more, here is the third part of the article: Implementation of TEE Sidechain.

Special thanks to Adegoke Yusuff, Eric Zhang, Minqi Wang, and Kailai Wang for contributing their knowledge to this piece.

Here are links to read the other publications to better understand the novel solution we are building at Litentry:

--

--