Managing Secrets in your DApp with NuCypher
ETHGlobal·Wed, Oct 9, 2019, 12:00 AM
ETHNewYork 2019 workshop at New Lab featuring NuCypher. ETHNewYork was an ethereum focused hackathon organized by ETHGlobal that took place at New Lab in the Brooklyn Navy Yard, May 8-10, 2019.
Transcript
so again I'm Justin this is talks we've also got Kieran right there he's another new cipher II no mater see see what say again sneak sneak Oran Snee mod her kyon have we met before okay I believe you for now yeah Chris kion Oran Snee mod her Oran kion Chris MD MD MD and B got it okay MD [Music] that's cool oh that's terrible so it's like start time like almost now it [Music] okay so I'm Justin this is tux and that's Kieran at that end of the table the three of us are a new cipher II know that's our species designation okay so let's go down the side of the table and see we get names Lane Lane Thomas what is it Rahul Rahul Thomas Lane Tom not Thomas so Lane Thomas Rahul Tom MD Chris Keon Orrin Snee mater all right so far so good we'll see so let's have a little like it like 20 questions but without any like goal toward any answer just to see like who answers once so like who've walked in the room primarily because they're like very concerned about like the future of the species in terms of privacy like you you're your primary impetus is socio-political maybe we'll say who's in that camp ok so you've all got some kind of it if it's not you then you then you probably see if this raise your hand you've got something in your life where you need to like manage secrets in a distributed app is that you raise your hands if that's you okay this is gonna be a little bit of like cold reading I'm getting like a woman with a G name from that corner a Gloria or Georgia no okay okay who is here primarily because they think this might be like low-hanging fruit that they could hack on and win money who's like is anybody in that in that camp all right we got one okay so you know as the apps move into a domain of usability and reflection on user or hood that is to say reflection on the sovereignty of the pecking of the keyboard and the in the smearing of the touchscreen at the other end of the app inevitably there will be secrets so you know I'd like to initially just sort of dispense with the idea that the only possible [Music] start by dispensing with the idea that the only real the only real thrust for building something with something like new cipher and you probably could extend this to all cryptography if you are sort of willing to think about it with sufficient abstraction that the only impetus is that there is a need for enduring secrecy this idea that you have that will remain in a limited audience until the heat death of the universe right that's not really what this is or at least not only what this is in theory what it really is is you've got stuff that you want some of your users to be able to see and others not see for some period of time and you need to figure out how to handle that scenario without relying on the centralized infrastructure that until now we've been told is the one right way of doing that primarily I hope what comes to your mind there is the like certificate authorities and you know there's this whole infrastructure this whole secrecy industry that has sort of led down one path and like many other components of the distributed web what we're talking about here is starting from similar intention and forging instead down a different path we got a couple of classes on my screen here right now maybe you've heard of these crazy characters they've been having a secret discussion since the early 70s on going unbroken between Alice and Bob and look at like half the tutorial room are my colleagues now we'll see we'll wait until we have like an uninterrupted uninterrupted for Gourley block times before we like reintroduce so here you have on the screen again what I'm trying to do here is facilitate a discussion that helps you sort of understand the the particular without resorting to slides and sort of keeping you in our code base okay so these two these two folks Alice and Bob who's heard of Allison pot let's have a hand raise there okay who's like never really who's like what Allison Bob what does that even mean anybody we got we okay we got maybe a couple okay so when you want to discuss the abstractions of communication between two parties typically what's done in sort of orthodox cryptology if that's not too unreasonable a thing to say is that we say well Alice sends a message to Bob that only Bob can read unless some things some way in which the system can fail occurs and then maybe we say Eve can read it so if we talk in terms of these people that are communicating with each other right but of course in a in an environment of web applications they're rarely people they're often applications that are trying to talk within or between different servers and clients in the old model or we might say decentralized nodes in the new model so Alice and Bob have been around basically in in full in a full-throated way since public key cryptography became widely used this is the idea where Bob has a public key and Alice has a public key and Bob can encrypt a message for Alice by using Alice's public key and then only Alice can receive it by using her private key so even though the cement the cryptography is asymmetrical right there's a private key and a public key you don't use the same key to decrypt you do turi encrypt nevertheless what we do with this narrative is caused a narrative to become symmetrical because there's nothing special about Alice or what she's capable of nothing special about Bob or what he's capable of now this works okay and the traditional speak when spoken to client-server model I guess it breaks down though fairly quickly when you're talking about the authority structure of a decentralized ecosystem so what new cipher does this is my we sometimes we try to come up with an elevator pitch and see how few words we can say it this is what you've just heard is the most words I think I could possibly say this is my 8 minute really long slow elevator under maintenance sort of ride so what new cipher does really is we sort of dredged the world of cryptography papers and cryptography primitives and we build some of those cryptography primitives into powers that are wielded by the characters in our narrative that allow you to do things that you can't do with public key cryptography alone so the one that we'll show now is some is the power that a character that we call Ursula has let's show Ursula here now when I talk about these characters I want you to understand that these are not merely examples that we use in the documentation these are actually classes in our code base so here's Ursula for example Ursula has the power of proxy rien Krypton this means she can act as a proxy between two communicating parties she can take ciphertext encrypted for one public key and at the behest of the authority of the policy that's Alice she can rien crypt the ciphertext for a different public key to be decrypted by a different private key that matches that second public key we do this with proxy tree encryption which is a cryptographic primitive that was sort of had a lot of intellectual yeast in the late 90s there was a paper about it in 1998 and then never really win anywhere never never achieved the kind of mainstream prominence the public key encryption has now we believe that one of the reasons for that is that it is very very helpful to have a swarm of decentralized disinterested nodes who are less likely to collude with one another than Google running servers within its own you know Google essentially is a central authority or Facebook right that's who we trust now with this model we say well nobody else can log into my gmail so like I guess only I can read my email right we sort of throw up our hands of this idea and it's encrypted from Google to you and it's encrypted from you to Google but the decentralized ecosystem challenges us to do something more than that to create in some cases end-to-end encryption schemes but at very least encryption schemes which utilize the full gamut of possible cryptographic primitives in order to have the kind of secret management that you need in your in your distributed ecosystem so Ursula for example again is the one that we use proxy this is the power of proxy Ari encryption and when you make a policy you select a number of Ursula's so you say we call the number of Ursula's that'll be in your policy we call that n and of those arsal is Bob needs to visit at least M of these so this is an M of n scheme an M of n schemes are a great example of the kind of thing that are very very challenging to do in a disinterested way and by disinterested I mean resistant to arbitrary collusion resistant to what sometimes are called Sybil attacks hey there's another character Sybil right there's another classic character in the cryptographic meta-narrative the blockchain is good for this and so what new cipher does is dredge up these cryptographic primitives and say hey maybe this thing that didn't achieve mainstream prominence before can now because we have the blockchain ok so what I'm gonna do now I guess I'll sing [Music] so let's walk through a quick module even if you've never seen Python before try to stay with me in the logic here I think I'm hoping this will be easy enough for you to read we call this our Finnegan's Wake demo because we encrypt line by line passages from james joyce's novel Finnegan's Wake so the first thing we do is make an Ursula as we've discussed above now on line 43 in this comment we introduce you to another policy that I already talked about verbally a couple times I'm sorry another model that I talked about verbally a couple times that we call policy okay so a policy is Alice authorizing Bob to access something Alice sets a policy that says I want to share this resource with Bob Alice does this by denoting this resource as having a label we'll get to that in just a minute but that gives you sort of the four corners of policy so here are the details we want to say when it's going to end in this case it's five days from now we set our m and n values I don't know why I have one in one there that's silly let's do two and three because I've been messing with this file actually actually let's do a whole bunch of control Z okay that's better [Music] right to close down or something and our label is whatever secret files and stuff now we introduce you to Alice the authority of the policy now remember in this sort of a narrative from yesteryear Alice and Bob are essentially although they were characters in an asymmetric cryptography scheme they essentially did the same thing they were essentially symmetric with one another here they do different things they're not quite the same empowered actor on your network alice is the authority the policy decides who's in and who's out though who's in and who's out we call them Bob so there's really nothing that we're passing here to Alice that's particularly important for the first of this discussion just understand that sort of this is where some of the internals go and if you want to follow how our thing works you can dive down in here and see what these different options do now check this out we're gonna make a policy public key this is the key for which everybody is going to encrypt when they want to share stuff with Bob with all the Bob's Alice can do this before she's even created the policy which is to say before she's even done anything on the blockchain so here's where we get that public key right here we do Alice get a policy public key from label and it's worth saying at this point that we have CLI and and sort of rest like although I we're not convinced that RPC or rest are sort of still appropriate in the decentralized network but we have an HTTP interface that can do each of these steps as well okay now we have Bob Bob takes essentially the same arguments as Alice which is to say they're not really worth talking about this second hey Alice here starts what we could call her learning loop she starts learning about the network and now 74 is is perhaps where the interesting thing happens that you wouldn't see in any crypto cryptographic narrative that I'm aware of outside of new Seifer Alice grants to Bob on this label with these values of M and n this means that in order for Bob to receive messages on this label he'll need to visit any M among and Ursula's that our network selects let me pause for a moment here to say that the the economics of the situation between these two are such that Ursula is the one who has to state the new cipher token right so Ursula demonstrates that she's following the rules of the network by staking a token outwork token not that different really than other work tokens you've seen around we've got a cool interesting things that make it different for example we can determine on the blockchain whether Ursula has attempted to mislead Bob by giving back garbage that kind of thing but other than that it's a sort of fairly typical work token and Alice here will have to pay for the policy in ether now Alice puts her public key somewhere for Bob to find later some kind of a side channel here we just saw it in memory and then Alice can disappear completely from the internet okay now Alice's is disappears some time passes and then we have Bob know now with Alice offline it's time to get out of D we're off to like a with Ellis gone from from the Internet Bob can join the policy so maybe at this point in your mind you've started to map who Alice might be in your app who Bob might be in your app and then we've already talked about Ursula and I'm gonna introduce one more character before this is over if you have a clean mapping to each of these four characters in what you're trying to do in your app we'd love to hear about that our table is where's our table right outside these doors basically right or yeah right out into the right here so do come and talk to us we'd love to hear if you have a one-to-one mapping to Alice and Bob and I'm gonna introduce Enrico the encrypter and a little bit if you have a one-to-one mapping to each of those three we'd love to hear about that particularly if it's some kind of a weird in-game universe case I'd love to hear about that because I'm variants should to see sort of how gaming secrecy evolves on the blockchain and here we're going to read we get to get the path of the book we read the book and then we're going to iterate through the lines in this book Finnegan's Wake and now we make Enrico and Rico needs the policy public key and he can in he encrypts a message here and you see he gets a single passage and a signature and then he leaves his public key somewhere to be found and then he disappears from the network himself and now look what Bob does Bob reconstructs Enrico with that public key that he left behind and now Bob can retrieve the original message now I don't know I just went through a crazy heck of a lot I basically took you through a year and a half of new cipher discovering our identity in developing this sort of schema and protocol and way of thinking about this so let me stop now and ask who has questions I I'm what do you got yeah because we only have six minutes left and I'm not sure what it really shows for me to run this thing except this suffice to say that it does run but I mean I'm happy to but right if we if there's a discussion to be had that'd be even better it starts with a cake key on yeah 74 this is why we have line numbers yeah [Music] yeah okay so the question is how dare I describe line 74 is having some unique quality when it really just seems to be traditional MFN encryption maybe you're thinking of like show me your secret sharing or something like this yeah okay so imagine for a moment what would happen if this were naked Schumi or secret cherry by the way I think that's groovy and we probably will deploy a character that does exactly that in the future you know but we're sort of really interesting in showing that we can bring a fairly novel cryptographic primitive to the forefront before we just you know lean on something that is as already as well promulgated as shmear secret sharing but in Shamir's secret sharing what would happen here is that I suspect that you wouldn't have Bob here on the other end at all right because Alice doesn't really grant to Bob and she mere secret sharing if people don't know Alice can split up a secret an arbitrary secret anything you know she can take her journal and divide it among in holders of the secret and any m of them can put the secret back together okay so this is useful maybe for traditional scenario free blockchain that sometimes it's discussed is if you want to have like your master secret to your password manager that maybe you wouldn't give away in life but maybe you'd you know give three or four shares two very close friends and knowing that no three of them would collude to impersonate you but in the event of your untimely death they could come together with these three shares and have access to all your stuff right so what's your secret sharing would do in this is allow M Ursula's to collude to get the secret you see here and this is what makes this different and unique might be too strong a word although I can't say I've ever seen anything done like it and in decentralized blockchain incentivize way is that only Bob can get the secret after the after the M Ursula's what we like to say is that Bob goes on his journey with a capsule in a secret inside these are all classes on our code base and Bob's journey Falls asking imploring at least em Ursula's to attach see frags ciphertext fragments to that capsule once he has MC frags he can with his own private key obtain the secret say again only to him while Alice can add other bobs to the policy so let's say only to those bobs who have been granted on the policy right other questions how about like really beginner who who got lost a little early and wants a little bit of like like who has okay who feels like super comfort or with everything I've said you totally get it yeah okay so I mean there you know there's some there's different levels of following along so if you're a lower level of following along and ask a foundational question because other people almost certainly have the same question and it'll be where this is your time yeah [Music] know what we do is build blockchain based characters who stake our token and those characters follow the rules of the network that we layout including using these encryption schemes that have some kind of need for dis interests in other words some kind of anti civil attack anti collusion or just the economic impact of needing to follow the rules in a verifiable way or risk being slashed right everything we don't build anything specific for any corporation or government at least that's certainly not our typical wheelhouse we're building things for you we build things that are on the blockchain that are there for you to use and you know you have to pay a little bit of ether for them right so you are our if anyone building our decentralized application with any kind of a secret to manage our our clients yeah Chris so we do have smart contracts that are written in solidity with the exception of those smart contracts and a little bit of bash the entirety of the rest of our code base more than 99% is in Python so the way that the interaction happens is that the when Alice grants here for example what's happening under the hood is that we're running a smart contract function we're in Alice samples the network for who is staking our token and selects from among those who are staking our token that have already vowed to stake beyond the end of the expiration time on line 77 so that's like one example another example which is not depicted here but which might be interesting to you is that if Bob opens up the capsule at the end and there's a pair of garbage inside he can initiate a dispute using a smart contract and the the there's a smart contract that can actually take as input the ciphertext and determine whether Ursula has given Bob garbage which is a suggestion the chief is not doing the right thing by our network and in that case she will be slashed some of her new cipher token so those are the sorts of ways that we have interactivity with the smart contract we don't do if you were interested if you were like making a top 5 list for incredibly compelling use cases for smart contracts I don't know that this presentation would be on your list right well we use smart contracts for our to enforce what we think are already novel and exciting cryptographic concepts they just needed a little bit of help a little bit of help from a smart contract to enforce some kind of anti collusion or good behavior scheme because without those the cryptographic primitive is sort of hollow and never went anywhere right so again this is a cryptographic proxy encryption is a cryptographic primitive from 1998 it's not super new and yet it's not a household name yet we think in part because there has not yet been a blockchain to enforce the anti collusion properties that are necessary to really do it right that's kind of what we're staking yeah I didn't get your name Dean yeah Dean has been sent here from Portland to distract me with a topic that I could discuss a day and night his question is is there some kind of a node discovery mechanism or why am i able to just do Alice grant Bob yeah there is a no discovery mechanism happening under the hood here really what's happening here and literally a missed module is that Bob is in memory but but in terms of how the network work that wouldn't normally be the case inter it's not impossible but in terms of how it would normally work we have a node discovery we've actually rolled our own node discovered we have a blog post about that and our new cipher works actually without the blockchain at all in a federated mode you can see I have federated only here and that means that there's no blockchain component they just discover each other but of course that's super susceptible to a civil attack you wouldn't want to use such a network that beep you know they'd be essentially the same as is trusting one party with all of your with all of your re-encrypt in notes again [Music] yeah we want pay to encrypt as a thing this is like we're right on schedule there because I think we're about five minutes into the QA which is when we usually get that question so good you're yeah we don't yet support a paid encrypt scheme there are a few different ways that you can imagine it being done one is for one that could be done with really very little further ado would be for Alice to grant already generating the cryptographic material necessary and handing it over to Ursula just as she does now but Ursula refusing to perform the task until Bob pays that's one way to do it and there are several other ways which we have thought of which we're happy to discuss but maybe that prompts you a little that is not functional that's built into our network yet it's also not something we're planning to build before main net but I it's something that if it comes to a vote I will happily vote in favor of shortly after we launch on main net yeah I don't think we know yet how much ether policies are gonna cost right now it's Alice who pays not Bob right now it's Alice who pays yeah but again it could be Bob we wouldn't be there would be no incredible gymnastics to make that happen and that's maybe something we'll address shortly after Maine net but we don't actually have really a number I think we actually have it defaulted to zero right now while we poke and prod is that right here--an yeah so we don't know depends what kind of a market there is for it I mean you know and by the way I know what a neat global event but let me say loudly and proudly we're not sure if he arranged the right blockchain for us I don't know if anybody is maybe it is maybe it isn't we are planning to deploy on the etherion blockchain but if the economics line up in such a way that either aetherium doesn't make sense or the use of a micro payments technology on top of or to the off to the side of a theory make more sense you know it's our code is is sufficiently portable and for you that means that in terms of hacking projects we don't need to see anything that necessarily relies or assumes that aetherium is the end-all be-all blockchain we are deploying on it for now we do have a lot of confidence in it for now but we are interested in seeing any of the variety of ways that you might use the technology even if it means that you sort of have to skim over the details of payment I think we might be done here [Music] we're done right we're wrapping it up all right well listen Dean mod her Snee Oran kion Chris MD everybody everybody in the room thanks so much for joining will come to our table [Applause] [Music]
Automatic transcript — names and jargon may be misspelled.