Justin Myles Holmes ~ The Privacy Layer for Ethereum with NuCypher
Ethereum Denver·Wed, Oct 9, 2019, 12:00 AM
Justin Myles Holmes speaking, from NuCypher
Transcript
[Music] sound okay whoa it's loud yeah good all right so okay so happy to be able to play a little bit of music for you play a little bit of command-line interface for you you know we at new cipher we develop what we think are interesting and novel cryptographic primitives and the cryptological narratives and logic to go with it today we're going to be talking about our proxy Rhian Krypton project and the sort of root of that is rethinking this 40-year old idea that all cryptographic conversations take place between two parties Alice and Bob you all know Alice and Bob Alison's a message and Bob receives it and there's a number of different ways that it can work but typically Alice encrypts something with Bob's public key and then only Bob can decrypt it in a decentralized narrative it's totally plausible that you might want to break these characters apart but it's difficult to do one thing that we've done is introduced this other guy Enrico so now we have Alice and Rico and Bob you're used to thinking of Alice as the authority meaning she decides who gets the message but also the messenger meaning she decides what the message is in our narrative Alice is still the authority but Enrico just Enrico is the sender of the message the encrypter Alice the authority and Rico the encrypter we introduced also another character who we call Ursula so this is a total of four characters and I'll give you a little preview here we're gonna do like a Brady Bunch thing here and my CLI all right we got four characters so Alice creates a policy and on Ursula Ursula are our nodes on the new cypher network she grants access to Bob now and Rico can encrypt a message not for Bob's public key but for the policy public key then Bob goes to Ursula and she can rien crypt it that is to say she can change the ciphertext from being encrypted for the policy public key to being encrypted for Bob's public key without ever seeing the clear text herself that's the basis of this whole system now normally when we do these demos we've demoed our test net we've shown long scripts that have all four characters going back and forth but we figured hey this is a hackathon let's get like deep into the internals so I am going to try to operate four different tiles and a CLI and show some things that are really bleeding edge some things that we were hacking on in preparation to hack here we we take this we take this very seriously I think there's sort of like in the blockchain community an equivalent of impersonator syndrome where you think to yourself how nobody's really going to use this project no people are going to use this project we feel we feel confident about that and we feel confident about a lot of the other projects out here confident enough that we are willing to dig into things even that are broken to kind of show you the insides now if you'd rather see a demo from a script that shows how our tests met which again is is launched and working if you see it want to see how that works watch my talk from Prague or Berlin all of those are on the new site for YouTube channel all right but right now I'm gonna go into some stuff that is just thoroughly new and broken and I'd love for you to explore with me and I'm gonna play a little bit of music and a little bit of CLI here we go [Applause] so the first thing we do is we're gonna launch Ursula I don't know I feel like I'm real hot on this mic so our new cipher command-line tool has character names for each of the four characters okay so what I'm trying to show here actually I'm gonna do Ursula down a lower right corner what I'm trying to show here is that you can you can lon once you install new cipher you can launch each of the four characters here yourself so what I'm gonna do first is new cipher Ursula run I'm gonna do this in dev mode meeting I don't want to like persist just want to run once and when I control see it's all over federated only I think that's all I need alright and we get Ursula okay so here's the first of the four new cipher characters running in one terminal next we are going to run an Alice so we're gonna start with those two now remember Alice is the authority of the policy Ursula is the node I just described it does this rien ssin okay so I'm gonna come over here and do basically the same thing new cipher Alice could do - - help we do have nice help screens for each of our characters to sort of help you understand how to use each of them new cipher Alice run also dev also federated only and I do want to make a note here when I say federated only what I mean is that this is not using the economic dynamics of the blockchain right normally in order for Ursula to perform this free encryption Ursula needs to stake our work token and our entire know discovery is based on and sampling is based on that stake I'll talk to you more about our the security implications of that in a little bit but I am gonna pass our teacher URI which is that Ursula that I'm already running okay and you can see down here that it's running on port 1 0 1 5 1 so that's what all type here Alice is running Alice has learned about this Ursula awesome now the kind of crazy part okay I am going to open up ipython if I even have it installed I do I'm gonna set up some import one thing I want to be really clear about from the beginning inside this I Python new cipher is not defined so this might be your Python application that maybe you're writing we like Python I think it's a great idea to be writing blockchain apps in Python right now wonderful effort and enthusiasm in the space but even if you're writing in roster Yahveh script or whatever you happen to be writing in what I'm doing here just making HTTP requests in this middle window so this is this is what you can do with your app if you don't want to import new cipher as a library and again when I've just showed you I get name error for new cipher so I'm not leaning on the new cypher library inside this middle one and we're gonna see how far we can go before things break I know I'm gonna need we do some base64 encoding so I'm just gonna take care of importing the base64 stuff right at the beginning we also use JSON okay and then I'm gonna be the main tool I'm going to be using is requests if you're not used to Python you know request is sort of the main HTTP tool that most people use just to make requests and receive responses so the first thing I'm gonna do here is let's go up to the top of Alice and I'm gonna jot down Alice's address okay she's running again a local host on port 81 five one I need HTTP there yeah that's not right and I'm also gonna grab Alice's verifying key sorry about that okay now I'm gonna make the first HTTP request in the system I'm going to derive the policy key now remember the policy key is what everybody encrypts for nobody's encrypting for Bob's public key and the new cipher cryptology instead you might imagine that Enrico is like on the countryside in a war-torn situation he pulls out of his pocket scrawled this one single encrypting key that he managed to keep a hold of as long as he can encrypt for that all the bobs that are in the policy and Alice decides who those are all the Bob's and the policy can read it as long as the Enrico and Cripps with this one key this one public key so let's make that here's my derivation will say derivation response because I'm going to make this request and this is to Alice /drive policy pub key and we are gonna call this song's I think that looks right let's see derivation response good okay now look I got here's the policy encrypting pub key right so that didn't exist before that request response cycle okay it is a key pair Alice has the private key and only the person with the private key can grant and revoke access on this policy so the next thing I'm gonna do is just in my Python stay here I'll save that this is gonna be the policy encrypting key the one that we just got and now it is time to run enrico so here I'm gonna do essentially the same thing I'll do new cipher Enrico - - help okay here we get the help options for Enrico I'm gonna do a new cipher and Rico run - - by the way I'm looking at the help text right along with you all I'm like really you know this is the gonna be the first time I've gone all the way through this i-i've done some trial runs you know but I mean this is literally a hey old what I'm showing you here this is this is what we are hacking on now policy encrypting - key I passed this and this I think will launch in Rico there we go let me zoom in on that a little bit not that much okay so now you can see that sort of the beginning of this thing coming together right I've got three terminal windows three different characters you yourself can do the same thing if you want to you if you want to develop with new cipher okay now the next thing I'm gonna do is I'm gonna copy and rico's port and I'm gonna come back over to my my python here that I'm working on and I'm gonna say Enrico is HTTP colon slash slash again localhost this is all running locally and in Rico's port I also need to grab in Rico's verifying key okay this is the key that when Bob gets a message maybe in your narrative Enrico is someone important and Bob needs to know that this came from the person he's expecting maybe not either way you want to grab this key and invalidate the signature maybe the signature is meaningful to you in the sense that it's coming from a trusted party but either way you want to validate okay now we're gonna pick a message to encrypt I figure the label is called song so we'll pick the next song that we're gonna play together I got a request from nuke Mandan I don't know if he's in the room but to play zoom in on this a little from The Legend of Zelda the ocarina of time we're gonna play Lost Woods alright so there's our message to encrypt oh yeah that's supposed to be bytes thank you this is I've got a little you know half my colleagues are in the front here yelling out to me all the things that I'm doing wrong and it's gonna get worse so now I'm gonna make the encryption request this is where stuff starts to get a little crazy but this is really just a this is a JSON dick for the key is message and I'm gonna do I'm gonna encode it to base64 again it's already bytes the only weird part and this is arguably the strangest part of this whole presentation is that I then have to decode it to utf-8 to send it over the wire don't concern yourself with that for the moment or if you're used to operating with internals of these sorts of api's maybe you're already used to it but and now I'm going to do I'm gonna see if I can get the encryption response okay so now I'm gonna post to and Rieko if there are any Python fans in the audience look at me I'm using f strings here like I'm like really hip with the cool kids right and I'm gonna hit his encrypt message endpoint and here I'm passing data and I'm gonna do JSON dumps for the encryption requests that one okay let's see here encryption response dot content look at that now we've got what we call a message kit okay that is that is a message that is encrypted for the policy public key not for Bob okay and we will show that now because we're gonna launch Bob we're gonna do new cipher same thing I'll do Bob - - health new cipher Bob run very very similar again we're federated only here Bob's not concerning himself with with the token right now and we're gonna do teacher URI which is going to be the same as Alice was okay when you all hack you feel free to use our test net right here right but I'm trying to show this this 2x2 screen there we go now we've got all four all four characters all four main characters we actually have several other really wacky characters that I'd be it loved to do a deep dive through the secondary characters of new cipher at some point but now we've got like alright that's all we're doing to that no more I don't I'm not big on the kitchen Erica memes but when you do Brady Bunch you do the Brady Bunch right okay now we're back here and we're gonna try to retrieve right now in in a traditional public key cryptography scheme this operation I didn't say Bobby out actually let me do that first I've got to do Bob Bob is gonna be HTTP colon slash slash localhost port 1 1 1 1 1 5 1 who comes up with these port numbers that's not true I do and now we're gonna do Bob's verifying key oops in here all right cool wrong key oh that's Enrico yeah all right Bob's verifying key oh yeah we need both of Bob's keys Bob's verifying key they're trying to leave me with as few excuses for this failure as possible okay now we're gonna let's make a retrieval request let's see what happens when we try to retrieve this data remember the the name of the song okay for that we need the same label that we used at the beginning yeah well let's just start a dict here we need the same label that we had at the beginning which is just the word songs [Music] we need the policy encrypting pub key okay which we saved here is policy encrypting pub key I think good we need we also need Alice's signing key or verifying pub key Alice verifying key and then finally we need the message KITT let me go get that message KITT it was the encryption response that kind of so we'll do the message kit is remember encryption response dot content okay but we need to JSON load that and we look up a result and from there we look up message KITT let's see what that comes out to be that's correct okay and so for our retrieval request our message KITT is that okay now let's let's try to retrieve so I'll do request stop post okay with for Bob we're gonna hit his retrieve endpoint and say hey Bob go ahead and try to retrieve JSON dumps ask that retrieval dictionary that we just put together okay I believe we will get a 500 here and we do not the prettiest access denied message you know we'll work on it if you need something better will make it for you come up to our table on the second floor here right at the top of the stairs so now what we have to do is grant access to Bob what has happened so far Enrico encrypted for the policy Bob tried to retrieve but Bob can retrieve cuz he's not on the policy okay so now the next thing we're gonna do is make our grant okay and granting access we need we need Bob signing key we need Bob's encrypting key okay so if you're Alice and you want to grant a Bob first you got to find a little bit about out about the dude all right gather this little bit of information here I'm just gonna do m and n values of 1 if you already are hip to what that stuff means that's cool but if not definitely watch some of our other demos where we go deep into that and I'm gonna do label the same one of course is just the word songs okay so now we're gonna try to I'm going to do requests dot put this time to Alice and we're gonna say Alice grant access to Bob grant the data here is gonna be JSON dump s for that grant what oh yeah yeah gonna need that okay / grant there we go there's a 200 the grant ostensibly went okay okay now let's see here we're gonna try to retrieve again okay I'm gonna I'm gonna put the same exact thing I put when Bob last tried a tree retrieve but failed we're not gonna change anything retrieve and the data is JSON dump ass for our retrieval what's that look good we're ah yeah there how's that look everybody liked that one okay retrieved let's see it's a 200 let's see what the content is okay he's got some plain text hold on hold on we're gonna do retrieved in base64 this is gonna be we're gonna we're gonna load that that response okay retrieved you ever had that thing where you see a word so much it starts to look weird I'm having that with retrieved right now retrieve content result and we're gonna take that plaintext now I mess something up there what I do let's try that one more time hi I'm miss mash yeah okay it's bear with me loads retrieved content that's what's being loaded we want to get the result and from the result we want the plain text this thing that okay now we are going to be 64 decode that actually we need the first member of that it's possible that Bob has received many messages in this case we only received one but we take the first one and look at that we get I cannot believe that worse I did not expect that to work all right so what just happened what just happened Enrico encrypted that message not for Bob but for the policy Bob tried to get it he wasn't granted on the policy so he was unable to get it then Alice granted him then he was able to get it you can do this in your hackathon projects it's totally decentralized again Ursula in the real world you'll use higher m of n values using one in one is totally insecure in the real world watch some of our other demos and you'll understand how that works paying for higher values will cost you a little bit more but our nodes our Ursula's will do that that that rien Krypton service for you and now you can grant access via you know in a totally decentralized fashion now I think that I owe you all song so [Music] all right and now a little bit of guitar and questions if anyone has questions what do we have six minutes six minutes for questions who's got them yeah I think I don't know if you need to come to the mic if not if you want to yell repeat your question a little sound in this like what hi Bob does Bob ever find out it came from Enrico or it's just those it came from the policy Bob Bob does get ideally Enrico's verifying key you want to check that to make sure that there was no funny business with the ciphertext in the first place now you can use and we do use in our demos a different Enrico for every message that's no problem so Enrico doesn't need to have personhood in the sense that he persists across the network tying any sort of identity to his key but you want to at least check that signature so the answer is is no unless you want to got it yeah other questions can you all hear my guitars that coming through come on other questions what's going on I'm happy to sing for you for just a little bit [Music] [Laughter] [Music] well it's been a pleasure to share my CLI with you I really look forward to seeing the other presentations here it's it's really fun to be part of something so awesome a new cipher I think we've really I mean I don't mean to boast but I feel like we've built a really elite team of good friends building some wonderful things I know a lot of you have also we're interested in using your stuff and we're interested in you using our stuff and this is a great place to make that exchange it's also been really fun sharing my CLI with you it's been a long time since I've done just straight-up absolutely live coding like that I I'm really it's awesome that it worked it came together at the last minute it'll work for you also and of course it'll only get more solid I mean we built that this morning so you know we there will be lots of upgrades and support to come [Music] [Laughter] thank you so much [Applause]
Automatic transcript — names and jargon may be misspelled.