TLSNotary: make your private data portable with TLS-MPC

ETHCC 7 · 11 Jul 2024 · 37:02

Hendrik Eeckhaut of the TLSNotary team, a Privacy and Scaling Explorations project, shows how to make private web data portable with TLS-MPC. He explains why TLS protects Alice's connection to a website but cannot prove her data to Bob, and why alternatives that need website cooperation or a proxy fall short. In TLSNotary, Alice and Bob jointly run the TLS session with multi-party computation, with no website changes, and Alice can redact fields. A Star Wars API demo hides a home world field. Use cases include KYC, finance and oracles; bandwidth is the main limit.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

Welcome everybody. Get yourselves ready to learn about TLS Notree, and I'll show you how you can make your private data portable with TLS MPC. So this might be magic words for now, but I'll try to explain everything as good as I can. So my name is Henrik Ikhot. I'm uh a local Belgian. Um I'm with the TLS Notary team, which is a research project by the Privacy and Scaling Explorations Group, which is part of the Ethereum Foundation. So I have a very cryptic overview today.

I'll uh just means that I'll try to first say why we go through the trouble of uh developing TLS Notry, what it is, how to use it, how it works, and where and who, and I'll also have uh some demos to prove to you that uh it really works. Um first the motivation. So when I say portable data, what does that mean? It's just like Alice has data on some web server somewhere, and the question is how can Alice share that data with Bob. It's uh we're mainly focusing on private data, so that's data that uh Bob not can get access to very easily.

So it's protected by the website for Alice, and that could be all kinds of information. So it could be government servers with identity information, tax information, it could be health information, uh, banking information, uh social media things, gaming information. So this is uh more or less the the web 2 realm. And then why would Bob need Alice's information? There's like also plenty of uh applications for that. It could be like a KYC provider that needs proof that somebody is a citizen of the EU, for example, it could be a creditor, it could also be just other applications like a data archive that needs something, or uh also blockchain oracles could need access to uh to private information.

So I used HTTPS in the previous slide, so the S in HTTPS actually stands for TLS, so that's the secure part that's the transport layer security, and that's actually a security protocol that is using encryption to make sure that when Alice connects to the website, the data Alice gets is actually authentic and originates from uh from that website. So, what TLS provides is authenticity, so through certificates, Alice can check that the web server is actually uh the source that uh Alice thinks she's connecting to, so she can verify that. Also, it provides integrity, so nobody know none of the network nodes in between Alice and the website can tamper with the data.

So if anything would go wrong there, Alice would notice it. And TLS also provides privacy. So all nodes in between Alice and the website do not only see encrypted information. So that's a system that works really well, it has served us, but unfortunately, um, because of the way TLS works, it does not help us to get data from Alice to Bob because that's just the trust me broke protocol there. So if the data gets to Alice's computer, she could do whatever with that data before she passes it on to Bob.

So and that's already in a nutshell where TLS NoteRe steps in. So we have a solution with shared keys, but I'll explain all of this later. But so the uh I'll give you a sneak peek of what's coming. So what TLS NoteRe brings is portability. So uh Alice and Bob will work together, so they don't have to trust each other, they can check what's happening, and also the website does not need any changes for uh the system to work. And the uh the end result of this is that all uh data, all our private data that we have all over the web becomes accessible and comes becomes composable in new ways.

Uh and that's like uh an enabler for a lot of new uh use cases. So um, first, maybe a step back. So with TLS, uh, why can't Bob just trust the data Alice uh gives her? So TLS works with uh symmetric encryption for performance reasons. So both the website and Alice uh share the same key, so it's very easy to for Alice to change the data and then also just uh re-compute the the signature there, so that's uh that's not of uh of a use. So wouldn't things be a lot simpler if the website just used uh public-private key encryption and just use uh asymmetric signatures there.

Uh that's true, that would make everything a lot easier, and then you just use zero knowledge proofs to add uh more privacy. But unfortunately, uh what we need there is cooperation from the website, and that's an uphill battle. Uh many startups have tried this, and it's uh a very slow process and impossible in most cases to make uh websites assign their data so that somebody else can use what they see it as their data, uh although in most cases everybody agrees it's actually Alice's data, so that's uh a very uh difficult process. Uh of course you could also delegate access, that's what for most common use cases people use.

Is uh but again uh it requires cooperation from the website, and there's also issues with privacy. So now both the website and that uh uh what provider know what data you're accessing. There's also very coarse uh grain uh access rules, there's more ways to do censorship, and there's uh also more places where things could go wrong. Um another option could be to um have an intermediary, so that what what we often call proxy mode, so that would be like the the classic notary, so you have somebody do the um fetch the information from the website with you, so Alice has to give her credentials to that intermediary to do the the call.

Uh so the advantage is that there's no need to do changes on on the web server, but uh on the other hand there's very easy to block at scale, so there's only one computer that you you have to censor if if the web server doesn't agree. Um there's also uh privacy issues, and there's more trust assumptions. Uh if Alice has any access to how the network of that intermediary works, there's also uh risks there. So that brings us to um the TLS notary approach.

So uh what we do is we use cryptography, we use secure multi-party computation, and that has the um so with TLS MPC, both Alice and Bob have to do cryptography together to do uh multi-party computation to access the websites. The website doesn't uh need changes, uh and because of the cryptography, Bob only sees encrypted information, so Alice's privacy is um guaranteed, and also Alice cannot cheat, so because she cannot do anything without Bob's cooperation, Bob can check everything that's happening. Um so that's all advantages, but of course, there's also a cost, so because of the cryptography, it there will be more latency and also a high uh bandwidth cost, so more communication between Alice and Bob than just the data that needs to be fetched from uh from the web server.

But so let's zoom in. Um how that works. Oh, yeah. Uh I said Bob sees only encrypted information that would be not so uh useful. In most use cases, Bob needs to see some information, uh otherwise it would be uh stupid for Alice to share it. Um so how does that work in TLS NoTree? So after the MP uh so the TLS session is finished, um Alice can disclose uh certain information or disclose or redact uh depending on your perspective, and so for example, in this there was like a TLS request to example.com, and so we sh we we redacted uh a session cookie here, which could be also like login um cookie. Um, and then you also have the option to, in this case, maybe the app only needed the username, so you can redact the address and the birthday.

And this can also be combined with zero knowledge so that instead of disclosing the address, you could prove like, okay, I don't live in the US, or instead of uh sharing your exact birthday, you just prove okay, I'm over 18, and that could be enough for the service that Bob is providing to Alice. So summarizing what uh we've discussed already. So TLS Notary actually solves a conceptually simple problem.

So the what it does is it helps you to query web servers and share the data with another party, and the important there is that it's secure and that Alice has full control over what exactly she shares with uh Bob. So how does it work? Uh let's zoom in. Um I'll have tried to find the right balance with enough detail and not going too deep. So um, this is uh a simplified view of how uh TLS works.

So there is a server and there's Alice, and then there's uh ecliptic curve Diffie-Hellman key exchange. So there's um uh public keys exchanged, and then they do some uh eclipse ecliptic curve um cryptography to have a session keys, uh pre-master secrets in TLS jargon, and then once they have those keys, they can just do uh AES encryption to uh send ciphertext or encrypted messages back and forth. So um from now on I will use prover and verifier instead of um Alice and Bob because uh Alice has some information she wants to share with Bob, and so she will prove that data and Bob will verify.

So how does it work in in TLS notary? So with multi-party computation. So instead of um Alice sending her public key, she's now sends a combination of her public key and the verifier's public key. So from the server's perspective, everything stays the same. But where there's in TLS there is originally a user, there's now two parties, the prover and the verifier working together to play as the TLS user. Um and so now we're using multi-party computation.

So I've visualized this as a box in the middle. Uh, but don't think of it as there's an extra computer there that's actually like uh Alice or the prover doing computations, and there's a verifier doing computations, and then there's all cryptographic magic going on with uh garbled circuits and oblivious transfer. But so the end result is both parties keep their secrets but come to um to a result. So they both have a key share that they can use for the TLS communication.

And they only know their secrets, but they used results secrets from the other party to get their secret. So that's the key exchange. So again, there's an MPC part that I visualized in the middle, but now the prover has plain text. In most cases, this will be the HTTP request. So it will be Alice that maybe puts like a session cookie in there and all the information that the web server needs to give a response later.

So the uh the verifier doesn't know the plain text but needs to cooperate again with MPC to come up with the ciphertext, and then with um TLS, it also needs like the message authentication code, so that's the the g hash algorithm that's again implemented with MPC, so that's like a sign checksum uh on the data so that the the once the server then gets this authenticated ciphertext, it will be a valid uh web request. Um but so the in a nutshell this means that prover and verifier have to cooperate to um calculate a valid requests.

The verifier doesn't see the plain text, but uh also knows that the prover cannot send a request without the verifier cooperating. And um what I mean with the the prover commits to the plain text during this process is that so the verifier also keeps track and then can uh use that information later to to check the result. Um so for decryption works uh very similar.

So if the server responds, uh for the prover to see the plain text, first like we have to check whether it was a valid uh response from the server. So first you have to we have to check the the G hash or the the message authentication first. So if it's not valid, then the it needs to be repeated. If it's valid, then they do the AES together again to get the plain text. And then uh verification is then for the prover uh the verifier to check that all the information uh is correct.

So summarizing again. So with TLS MPC, the the verifier and the prover work together to jointly compute the encryption and the decryption. Um the and uh the thing is the verifier cannot see the decrypted text, so the privacy of the prover is guaranteed, but on the other hand, also the prover cannot cheat and do um uh forge requests and uh an additive uh so that because the there's no difference from the server's perspective, um so also only the prover communicates uh with the server, so it's uh also there that uh privacy is uh is safe. So to make this more concrete, this was uh a bit theoretic.

Um I've pre-recorded uh a quick demo. So in this use case, it's a bit artificial, but it's just um easy to understand. So in my example, the server will be the Star Wars API, and the prover um has the statement like I have uh personal information on Luke Skywalker. Uh I know um I know his home world, but that's something I will uh not disclose, but I will disclose everything else, and then the verifier will say, like, okay, uh let's check that together. Um I hope this loads.

So uh on the left side we have the prover, which is in this case a web application, and on the right side, I'm starting a verifier server. Um, so which will do the the MPC verification. So it starts with just exchanging the uh garbled circuits and getting everything ready to do the MPC. So both the verifier and the prover are communicating together, and um once the the key exchange is ready, the prover will also communicate with the Star Wars API, and then uh once the request is sent, it will start uh decrypting. And so in this case, uh what we see here is that the verifier then got the uh redacted response.

So if we zoom in at the verifier side, so in this particular TLS requests, we added a secret header that was redacted. Um and we also uh redacted the the home world fields in the the JSON response. Um so and at the same time the verifier also checked so it cooperated in the MPC and then also checked that uh everything was correct once it it got the the answer. So this was a very artificial use case and actually also public data, but uh it's actually more useful uh if you use it for real world use cases.

So good examples there are identity information, so uh nationality, account ownership, compliance, also financial information is often uh a topic where privacy is very important. So you could prove that you have uh real world assets, like a simple example. There is I own a Teslock car because I can prove I can log in on the Tesla website and and prove it there, credit information, uh and also social information like that uh private messages like uh or um to to bootstrap uh other um networks and but so in summary I'm repeating myself, but so all existing data, all web 2 uh data on the internet becomes composable. So there's a lot of possibilities, and there's already some um some real uh world use cases I want to zoom in on.

So for example, there was uh CKP2P, which is an on-ramping uh project, and they're uh using uh TLS Notary to prove um a transaction on Revolute where some Euros were deposited from one account to another, and then they um you uh upload a proof, they check it, and then they can do uh USDC um transfer to uh to your wallet. Another very nice uh project was uh on uh from OpenLayer, where they build a system uh based on the GameStop saga where you can uh prove your uh wins or losses on Robinhood, like instead of just bragging on Reddit about uh imaginary gains or losses, you can actually prove, like, okay, I lost this amount of money or made this amount of money, so that it where you have bragging rights on real returns.

Another funny example is by Opacity Labs, where they made this meme app where you can uh brag about your DNA on 23andMe, about your baldness uh DNA or your Neanderthal. So all these kind of this is more like in the toy category, but you can uh imagine what what kind of things uh you can do here. So in the earlier examples, I talked about three parties.

So there was a web server, the prover and the verifier. Um in that case, they there's just two parties, but sometimes you want the same proof reusable between different verifiers, so there is like multiple bobs. Um that's also possible with a different uh setup of TLS notary when you delegate the MPC verification to a neutral notary. So in this case, the server and the uh the prover and the notary communicate work together with uh the web server, and then you get a reusable proof that both uh verifier A and verifier B can use. The only downside of this approach is that there is an added trust assumption.

So if you use TLS notary in this setup, verifier A needs to trust that the notary is truly neutral. Because if the prover is actually running the notary, then we're all the way back to square one where it's just TLS and the prover can do uh whatever. Uh but if you have a neutral note tree, this is uh also uh a very good option, and I also have a demo account of um using uh a notary. So in this demo, I will um the prover will access the uh Twitter servers and prove that uh in this case I have Twitter handle uh heekau, and then we will use uh a toy example we have to to visualize that proof.

Um so um and this is also a demo of actually the browser extension we are developing. So the prover in this case is the the browser extension. So I'm accessing the uh my uh my Twitter account. So you see that this extension can see all the requests and then you can replay them. But here we just hit the uh the the Twitter button, and then uh yeah, I do a small fast forward here. Uh we get the response from the Twitter server, and now we can uh either view the proof in the extension or um export it to uh a JSON file.

Uh and so the JSON file is actually like mostly um the the server information and uh the the commitments and then you can upload this proof to um a local uh verifier so it's not accepted because the it has the wrong uh uh notary key but then once you you configure you the right notary key you can see the redacted and unredacted information and if we scroll to the response uh you can see the uh my screen name there so um the browser extension um is available on the Chrome store it's a bit behind the um uh the the core protocol at this time because there's um uh a bug we found but we'll uh fix that soon uh and we're also working on a plugin system um where it's it will become as easy as possible to add new data sources because there's always something specific so you need to know which cookie you need to add to the request to get a valid request things like that and the uh only uh special thing also worth mentioning about running TLS notary in the browser so for TLS notary we have a different kind of TLS connection uh and that's not possible in the browser and so we need to have uh do uh uh a web socket there to to make it uh work um uh TLS NoteRe is um completely open source, so the core is written in Rust, and through uh WebAssembly you can also run it in the browser.

We're also working so the extension is TypeScript, it's all dual license, so Apache or MIT you can choose. And uh everything is on GitHub. So if you have pull requests there, uh very welcome. We also have uh a few quick starts there, depending on your situation. You want you might want to run it native Rust, you might want to run it in a browser, the prover in the browser, the verifier uh on a server or whatever.

We're also at uh hackathon this weekend. So if you would like to play around with it, uh come visit us at the at the boot, um, and then we can also help you. And then to um summarize again. Uh if you want to query web servers and share that data, and security and privacy are important to you, then uh check out our website um for uh to liberate uh your your user data. So we have a Twitter account, we have uh our sources on GitHub and find us on Discord.

Questions so TLS supports like a bunch of cipher suites and algorithms. Are there restrictions on what this works with and what it doesn't work with? But that's also work in progress. So the not all hashes and so today we support TLS 1.2 uh but I expect we will have 1.3 support uh later this year. Uh so this is very much work in progress.

So we're we're moving fast. Um but in in most cases it it works already. So the the the biggest limitation is more like the size of the data. That's so for a four kilobyte requests, it's like uh uh hundredth of megabytes bandwidth between uh the prover and the s and the verifier. So there's a a big explosion there that we're also optimizing, but that's like the the biggest uh uh uh limit or uh that we have today. Thank you.

Hi there. Um C needs the upfront coordination between Alice and Bob for this for the for the sort of combined key generation. Could you have a situation where um Alice just kind of captured the whole TLS handshake um including the certificate sort of signature from from the server and then sent sent that cipher text plus uh plus that handshake and gave proofs about uh contents of that ciphertext? Uh that would be a way to kind of share knowledge to you know broad broadcast knowledge. Uh I'm not sure I got the question um so a kind of slightly alternative architecture could be where you had um alice just performs a normal tls handshake with the server uh records that full handshake uh data then exchange between server and client you now have that you have that full information it includes um a uh a signature on on on that handshake from from the server so you so bob knows that ciphertext is related to something the server send and then Alice could send proofs about that ciphertext um to to just broad broadcast that and uh that could be a way of of of achieving a similar similar task uh maybe we should discuss this offline but there are refinements to what I've shown so this was the simplification so this is the most generic approach but if the the data the for example the response doesn't need to be redacted then there's optimizations where you can avoid the MPC parts uh which would speed up significantly also if you don't need decrypt to decrypt before the TLS session is closed then you can also defer decryption to the end and then you then the prover can commit to the data to the verifier and the verifier can simply after the commitment uh disclose its key to the prover and then it's also again an optimization.

So depend so TLS notary is a flexible protocol, a toolbox, a library. So it depends on the situation what the best way of using it is. But so for most most use cases the the defaults should be fine. So two questions really so the first question is you mentioned that Alice connects to the notary through the use of WebS right. But let's say we're not using the notary here and it's just Alice and Bob how do they communicate?

Yeah it could also be a TLS connection or whatever connection so in the the demo I gave that was like a a simple web service um but it also works peer to peer. So if Alice and Bob are just two two browser extensions that's also possible but they always need a way to to connect to each other but that could be true around the foo server or or whatever okay so you guys have figured out the whole NAT traversal and the hole punching then well that's where you need to use existing uh solutions. Okay.

So they need to connect first and then they can work together. I was also about to ask about the size of the proof but does that scale with the size of the data that you're trying to prove or uh yes. Okay. Yeah. Uh is there a way you can compact that uh maybe or like have a constant size proof um there might be cryptographic solutions there but I think for now we have like So this is like at the the naive approach of just having the commitments to so it's commitments to bytes. So you can redact any byte in the in the stream that's uh works like ZK might also help there.

Okay, thank you. Um hi just a follow-up question about the um the time it takes to prove uh given the size of the data. Is that scale linearly or um how does it scale? Um it's mainly uh bandwidth uh limited, so uh it's mainly communication costs. So uh like compute is not the issue here, it's like the the bandwidth between Alice and Bob that is the the limit today.

And does it scale linearly? So like if you're proving I guess a eight kilobyte um piece of data as opposed to four kilobytes, it'll take two hundred uh megabytes of bandwidth. Uh I think it's more than linearly, but uh uh I I don't have uh exact numbers there. Thank you. Okay, right in time for lunch. Thank you.

Related talks