Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all articles
Browse latest Browse all 12749

Adventures of an Enclave (SGX / TEEs)

Adventures of an Enclave (SGX /TEEs) So what can SGX and TEEs be used for beyond the obviouscases?

Leland Lee

Adventures of an Enclave (SGX / TEEs)
Treasure Map

Imagine a magical piece of hardware that no one can see inside, even if they break it open, that is the promise of Intel SGX and TEEs (Trusted Execution Environments).

Cryptographers for decades have been pushing the limits of secure computation. This is when the computing party is oblivious to the result and underlying data. Example: did Alice or Bob supply a larger number without revealing the underlying numbers to training machine learning models on encrypted data. Some of these problems have been solved, but often times the solutions are neither generalised nor efficient.

Let’s discuss how trusted hardware works, its standard use cases and some more unique ones, before discussing various blockchain projects that use this technology and the future of TEEs.

Note SGX is a subset of TEEs that is currently the most widely used and I use the terms fairly interchangeably throughout the post.

Why PrivateCompute?

Privacy is often valued greatly in particular instances and brushed away on others, let’s give some examples cases where privacy does matter.

Secure lotteries where no one can cheat or rig the numbers , where the code is public and individuals can attest that the lottery is running that code. How to share images for classification by an algorithm if the images are locked under by HIPPA, GDPR and other data privacy controls. Privacy Implementation

Some of the current cryptographic primitives tools available for secure computation include techniques such as fully homomorphic encryption (FHE), secure multiparty computation (sMPC), and Zero Knowledge Proofs (ZKPs). However these techniques are either too specialised (not generalised), too slow, or too computationally expensive to make them practical in a production environment. Systems like SGX provide similar security guarantees but is much faster, cheaper and practical today.

Adventures of an Enclave (SGX / TEEs)
Figure: High level on how SGX works, which is relatively comparable toTEEs. Technicalities

This is how SGX works on a high level, specific implementation details are passed over here.

Code runs in a hardware protected enclave / area [1] separate from OS, which has a private key associated that is secret Enclave can communicate through special channels to the application Use remote attestation to prove that a specific piece of code ran on a suitable enclave producing a specific result (“quote”), whose integrity is verified[2].

With this, a developer can send open sourced code to an enclave, a user can verify that the code running inside the enclave is equivalent to the open sourced code via remote attestations. Users then can inspect the code for any backdoors or unexpected functionality.

Common UseCases

Let’s start with the common and obvious use cases of this technology.

Most Common Use Cases

These use cases that already have fairly common cryptographic constructions for, but can also be done in TEEs. Determining whether Alice or Bob is wealthier without revealing the actual value( Yao’s Millionaire Problem ). Counting votes without revealing the linkability between vote and caster. Generating a random number . Blind auctions where the individuals running the auction are unable to see the bids and also forced to reveal all bids at the end.

Provable erasure

Regret that moment you shared some photos to a former lover? How can you prove that they deleted the photo, the same applies to GDPR, how can one prove that the data is no longer in the database or in someone’s hands who can access it? If the data was stored inside of an enclave, a user can attest that the data has either been deleted within the enclave or that the associated private key of the data has been deleted and the data can no longer be decrypted. Phew if they didn’t take a photo of the photo….

Key Generation

Shamir’s secret sharing is a cryptographic technique that has similar functionality to a multi sig wallet. Generate m shards and n number are necessary to initiate a transaction. However as a precursor it’s necessary to have a public and private key pair, but how can one prove that the key was destroyed and not copied? Here comes the provable erasure attribute of TEEs, generate the public and private key pair inside the enclave, create the shards, then provable delete and not leak the private key.

Private Searches and Encrypted Databases Let’s say there exists a database of restaurants that I want to search, and I do not want to reveal my searches to the owner. Mostly I’m afraid that the owner would sell the data to the paparazzi. Currently there is no easy way of enabling private searching of data with standard cryptographic techniques. However with SGX and TEEs it is possible to search within a dataset that is encrypted by the enclave , without revealing to the operator what one searched for. A similar technique can be used for web searches[ here ][ here ] Provable Search

Initially we wanted private searches, then why all of a sudden would we want to have provable searches? Don’t traditional databases already provide that in their logs? Yes, but let’s say we gave the NSA some viewing keys to a privacy blockchain. (Viewing keys are used to deanonymize the contents of a private transactions in protocols such as Zcash and Monero ). Can we build a system that logs what subset of the keys that were used, with TEEs it is possible to have tamper proof logs, which no other cryptographic system can provide.

Uncommon UseCases

This is where the fun begins, how can we use TEEs in ways that are non intuitive? Some of these ideas are from academic papers, others were conjured up and verified by researchers in the field.

Heart Beats Heart beats are a technique to signify that someone or som

Viewing all articles
Browse latest Browse all 12749