Return to Video

34C3 - The Noise Protocol Framework

  • 0:00 - 0:16
    preroll music
  • 0:16 - 0:23
    Herald: So, the next talk would be from
    Trevor Perrin. He has been called -- wait
  • 0:23 - 0:29
    for it -- "Living Evangelist in
    cryptographic protocol modernization"; he
  • 0:29 - 0:35
    helped out design some of the protocols
    that your phone right now is executing and
  • 0:35 - 0:43
    sending to that AP over there. Like
    signal, which gave him the award of the
  • 0:43 - 0:46
    Levchin Prize and the Noise Protocol
    Framework, which is used by WhatsApp for
  • 0:46 - 0:51
    client-to-server communication and
    WireGuard, the VPN from Jason Donenfeld,
  • 0:51 - 0:56
    which I don't see around here... Anyways,
    the talk will focus on the Noise Protocol
  • 0:56 - 1:02
    Framework. What is the rationale behind it
    and how to use it. Please hand of
  • 1:02 - 1:09
    applause.
    applause
  • 1:09 - 1:14
    Trevor: All right, thank you everyone for
    being here. My name is Trevor Perrin; I do
  • 1:14 - 1:19
    cryptography, consulting and secure
    protocol design. I'm going to be talking
  • 1:19 - 1:26
    to you this evening about a project I've
    been working on for the last few years in
  • 1:26 - 1:33
    the field of protocol design, which is the
    Noise Protocol Framework. Noise is a
  • 1:33 - 1:40
    framework that helps you in creating
    cryptographic secure channel protocols.
  • 1:40 - 1:46
    The sort of protocols it addresses is
    things like TLS or SSH or IPSec, where you
  • 1:46 - 1:49
    have 2 parties -- they're online at the
    same time, for example an internet client
  • 1:49 - 1:53
    talking to an internet server -- they're
    going to want to exchange a few messages
  • 1:53 - 1:58
    to authenticate each other and then
    establish some some shared secret keys,
  • 1:58 - 2:02
    which they can use for further
    communication. Secure channel protocols
  • 2:02 - 2:06
    like this are the the workhorses of
    practical cryptography; most the time when
  • 2:06 - 2:12
    crypto is used, it's within the context of
    some sort of secure channel protocol.
  • 2:12 - 2:15
    There's other sorts of protocols, like
    secure messaging and cryptocurrency and
  • 2:15 - 2:19
    all sorts of other things, but Noise is
    specifically focused on secure channels,
  • 2:19 - 2:25
    so that's what I'm going to be talking
    about in this talk. And probably a lot of
  • 2:25 - 2:29
    people, just kind of off the bat, have a
    reaction to that of being like "Well, why?
  • 2:29 - 2:33
    We we have secure channel protocols
    already: We have TLS; we have SSH; we have
  • 2:33 - 2:38
    IPSec; and these things have been a huge
    amount of effort to design over the last
  • 2:38 - 2:42
    20+ years. We've been bolting features
    onto them and picking bugs out of them.
  • 2:42 - 2:47
    Why would we want to start down that road
    again and build different and newer
  • 2:47 - 2:51
    protocols?" And I think, that's a very
    legitimate question and source of
  • 2:51 - 2:59
    skepticism. And my feelings about this is
    as follows: It's that, what a secure
  • 2:59 - 3:03
    channel protocol does is really a very
    simple thing; it just sends a couple
  • 3:03 - 3:08
    messages -- 2 or 3, maybe 4 -- sets up a
    secure channel. So, these protocols really
  • 3:08 - 3:12
    should be pretty simple; they should be
    simple to implement; they should be simple
  • 3:12 - 3:14
    to design; and I think, a lot of the ones
    that we find ourselves with -- the
  • 3:14 - 3:19
    mainstream ones -- for what they do, for
    what they actually accomplish, I think,
  • 3:19 - 3:25
    they're probably often too complex, too
    complicated and too difficult to extend.
  • 3:25 - 3:30
    And I think, we need to extend them; we're
    going to need to keep adding features and
  • 3:30 - 3:33
    extending them into new areas and with new
    types of cryptography. So, it's important
  • 3:33 - 3:37
    to have good frameworks and good ways of
    doing this. I think, this is an area where
  • 3:37 - 3:42
    we need a lot of room for improvement. And
    so, Noise is a somewhat, I guess,
  • 3:42 - 3:46
    ambitious effort in that direction. It's
    ambitious in the sense that I love to get
  • 3:46 - 3:51
    it to a point where people could use Noise
    for building all sorts of new and future
  • 3:51 - 3:56
    protocols. I'll be the first to admit that
    it's a work in progress; it hasn't
  • 3:56 - 4:00
    achieved all of its ambitions yet; its
    achieved some of them. But we're still
  • 4:00 - 4:05
    working to extend it and if, by the end of
    this talk, I have then convinced people in
  • 4:05 - 4:10
    the next 20 minutes to try to use Noise
    for all your new protocol design...
  • 4:10 - 4:15
    Challenges, that's going to be okay. What
    I mainly want to get across is, just
  • 4:15 - 4:18
    something about how these protocols work,
    the components that go into them, the
  • 4:18 - 4:22
    design space they're a part of, because I
    think, these protocols are so essential to
  • 4:22 - 4:27
    computer security, it's helpful for
    everyone to understand, how they work and
  • 4:27 - 4:31
    what they do, and not just think of them
    as kind of black magic that only a few
  • 4:31 - 4:37
    wizards can ever touch. So, to understand
    these sorts of protocols, secure channel
  • 4:37 - 4:41
    protocols, I'm going to want to start by
    giving just some background on the type of
  • 4:41 - 4:46
    cryptography that's involved in them: And
    the main cryptographic construct in any
  • 4:46 - 4:50
    secure channel protocol is going to be
    what cryptographers call an "Authenticated
  • 4:50 - 4:55
    Key Exchange" or "AKE protocol" . And an
    AKE is just a sequence of messages that go
  • 4:55 - 4:59
    back and forth between 2 parties, between
    Alice and Bob, so they can authenticate
  • 4:59 - 5:02
    each other and then, at the end of that,
    have a shared secret key that they know
  • 5:02 - 5:08
    they share with their authenticated party.
    These protocols, these AKE protocols, can
  • 5:08 - 5:11
    have different properties: All the ones
    we're going to look at have forward
  • 5:11 - 5:15
    secrecy; they might have mutual
    authentication of both parties; they might
  • 5:15 - 5:20
    have one-way authentication; how they
    handled identity information might be
  • 5:20 - 5:25
    different in different AKEs, so maybe in
    some AKEs, both parties start off knowing
  • 5:25 - 5:29
    each other's identity and public key and
    some AKEs will have to transmit this
  • 5:29 - 5:34
    information. In other AKEs, they might
    want to transmit this information, but do
  • 5:34 - 5:38
    it only after the other party has
    negotiated some encryption, so that their
  • 5:38 - 5:43
    identity information is encrypted, is
    protected on the wire. So, there are
  • 5:43 - 5:46
    different properties of how these things
    work; there are different types of crypto
  • 5:46 - 5:52
    we can use to design AKEs that have these
    properties. And I want to expand on this a
  • 5:52 - 5:57
    little bit, because most AKEs that people
    have experience with, the mainstream ones,
  • 5:57 - 6:03
    all do their AKE in kind of the same way:
    They do a AKE using signatures for
  • 6:03 - 6:08
    authenticaton and Diffie-Hellman for a key
    agreement. But in the last... that's a 10
  • 6:08 - 6:12
    or so... 10+ years, there has been a
    growing interest in doing AKEs that are
  • 6:12 - 6:17
    just purely based on Diffie-Hellman key
    agreement without signatures, and there
  • 6:17 - 6:22
    has been a bunch of papers that analyze
    security models and do proofs for this
  • 6:22 - 6:27
    sort of AKE. People have put this into
    practice in things like Tor and Tor key
  • 6:27 - 6:33
    agreement by Ian Goldberg and a number of
    designs by Daniel Bernstein and others,
  • 6:33 - 6:38
    like SALT cryptoboxes, CurveCP, etc. So,
    there has been a kind of interest in doing
  • 6:38 - 6:42
    this and Noise is particularly trying to
    take this idea and run with it. So, I want
  • 6:42 - 6:48
    to explain a little bit more about how
    these sorts of Diffie-Hellman-centric AKEs
  • 6:48 - 6:53
    work. And so, we'll start by looking at
    just the key exchange part of an AKE and
  • 6:53 - 6:57
    this is part is going to be sort of
    generic to all the protocols, all the AKE
  • 6:57 - 7:01
    protocols, we talked about, which is just
    going to be an unauthenticated dDffie-
  • 7:01 - 7:06
    Hellman key exchange. The way you think
    about Diffie-Hellman is that there's Alice
  • 7:06 - 7:09
    and Bob: They each have a key pair, a
    private key and a public key; they're each
  • 7:09 - 7:13
    going to exchange their public key with
    the others; then they're going to take
  • 7:13 - 7:15
    their public key, they're going to take
    their private key; they're going to
  • 7:15 - 7:21
    combine these two and get a shared secret,
    which is the same for both parties. So,
  • 7:21 - 7:25
    that's just a basic Diffie-Hellman to
    add... to key agreement, to turn it into
  • 7:25 - 7:31
    an authenticated key exchange, you
    exchange, we're going to add
  • 7:31 - 7:35
    authentication. And so, we can do that by
    adding signatures in a very conventional
  • 7:35 - 7:39
    way: Let's say both parties know each
    other's public keys, so Bob just has to
  • 7:39 - 7:42
    send an encrypted signature to Alice;
    Alice responds with an encrypted
  • 7:42 - 7:48
    signature; now we have an AKE. And this
    design is called Sigma, it's essentially
  • 7:48 - 7:52
    Sigma, and it's essentially how something
    like TLS 1.3 works, where you first get a
  • 7:52 - 7:58
    secret key, then send signatures as
    authenticators under the encryption. And
  • 7:58 - 8:02
    there's nothing wrong with this design,
    it's a good design. We can look at that
  • 8:02 - 8:07
    schematically by imagining that what's
    happening if we don't consider the message
  • 8:07 - 8:11
    sequences: Alice and Bob are each signing
    the key agreement, so that once they get a
  • 8:11 - 8:15
    shared key, they know that the other party
    agrees with this shared key by verifying
  • 8:15 - 8:20
    the signature. If we want to do an AKE
    that's entirely signature-based, we're
  • 8:20 - 8:24
    going to have to replace these signatures
    with some sort of Diffie-Hellman, while
  • 8:24 - 8:28
    still getting that same confidence and
    that same guarantee, that the other party
  • 8:28 - 8:35
    agrees on the ultimate, final, shared
    secret key we get out of this AKE. So, the
  • 8:35 - 8:40
    way we can do that is, we can say "Well,
    these these long-lived key pairs that
  • 8:40 - 8:42
    people have, we'll call them static key
    pairs; they're going to be Diffie-Hellman
  • 8:42 - 8:48
    key pairs instead of signature key pairs;
    and each party is going, to in addition to
  • 8:48 - 8:53
    doing an ephemeral, do ephemeral DH for
    forward secrecy, do an ephemeral DH to the
  • 8:53 - 8:56
    other party's static key for
    authentication, and then hash all these
  • 8:56 - 9:02
    DHs together to get a final key. And the
    reason why this convinces each party that
  • 9:02 - 9:07
    the other party has agreed to the final
    key is, because this final key is a hash
  • 9:07 - 9:13
    that includes the DH of the authentication
    DH of their ephemeral key, the other
  • 9:13 - 9:16
    party's static private key -- the only
    other party who knows the output of that
  • 9:16 - 9:22
    DH is the other party -- thus, if we do
    anything with the final shared secret key,
  • 9:22 - 9:25
    like receive any encrypted message from
    it, we know that key can only have been
  • 9:25 - 9:32
    calculated by the correct counterparty.
    So, we're accomplishing authentication by
  • 9:32 - 9:37
    using DH instead of signatures here and so
    this is a... it's a well understood thing,
  • 9:37 - 9:41
    but I wanted to kind of just touch on that
    before we talk about... where I dive into
  • 9:41 - 9:44
    the history of Noise. And the history of
    Noise is that a few years ago, I was
  • 9:44 - 9:49
    reading a lot of these papers that talked,
    Diffie-Hellman-based key exchange, and
  • 9:49 - 9:53
    looking at a number of these designs where
    people were doing Diffie-Hellman-based key
  • 9:53 - 9:57
    exchange and I thought, these were cool
    designs. I thought, they were elegant; I
  • 9:57 - 10:02
    thought they were efficient. But every
    time someone did a new Diffie-Hellman-
  • 10:02 - 10:07
    based thing, like nTor or salt or CurveCP
    or OPTLS, they would sort of start from
  • 10:07 - 10:11
    scratch and they'd say "Okay, how are we
    going to do key derivation? How are we
  • 10:11 - 10:14
    going to do transcript hashing? How are we
    going to do key confirmation?" If they
  • 10:14 - 10:17
    were doing security analysis, they'd
    create their own security model; they'd
  • 10:17 - 10:22
    write their own Gap DH ROM-based
    security proof that's pretty much the same
  • 10:22 - 10:25
    as everyone else's security proof, but
    it's still a lot of work. So, there was a
  • 10:25 - 10:30
    lot of reused or sort of repeated work
    being done to build this style of protocol
  • 10:30 - 10:35
    and so, the the motivating idea for Noise
    was, whether we could capture that work
  • 10:35 - 10:38
    into a framework that just provided you
    some common elements so people could
  • 10:38 - 10:43
    easily combine those elements together and
    create a wide range of different protocols
  • 10:43 - 10:47
    in this style. And so, I started working
    on ways of kind of connecting protocol
  • 10:47 - 10:53
    pieces together. Eventually, I talked to
    Mike Hamburg who's working on something
  • 10:53 - 10:57
    else -- this Strobe Protocol Framework
    that was kind of based on sponge-based
  • 10:57 - 11:03
    cryptography -- and we kind of took some
    ideas from that. With with all those ideas
  • 11:03 - 11:06
    we were able to come up with I think a
    pretty good system for describing a wide
  • 11:06 - 11:09
    range of protocols just by taking a
    Diffie-Hellman operation and some simple
  • 11:09 - 11:16
    other cryptography and combining them in a
    bunch of different ways. That core design
  • 11:16 - 11:23
    of noise is what we arrived at by 2015 and
    it's been stable since then. We know noise
  • 11:23 - 11:25
    is still a work in progress because we're
    trying to extend it and add new forms of
  • 11:25 - 11:31
    cryptography and build more things around
    this core but we do have a pretty good
  • 11:31 - 11:35
    core at this point. We've built a small
    community around it with a mailing list,
  • 11:35 - 11:40
    website, specifications, test suites, open
    source libraries in a bunch of common
  • 11:40 - 11:45
    languages and we also have a couple users:
    Noise Based Protocol is used by WhatsApp
  • 11:45 - 11:51
    for client-to-server communication from
    the app to the server and WireGuard which
  • 11:51 - 11:57
    is a next generation VPN tunnel project by
    Jason Donenfeld, it also uses a a noise
  • 11:57 - 12:01
    based secure channel protocol. We're also
    getting interest from some some other
  • 12:01 - 12:05
    directions, from people doing like
    Internet of Things, embedded systems,
  • 12:05 - 12:11
    anonymity network type systems, the
    Lightning Network proposal for Bitcoin
  • 12:11 - 12:16
    which will incorporate a Noise Based
    Protocol. So I think we're getting
  • 12:16 - 12:21
    interest from people who potentially want
    a customized secure channel protocol for a
  • 12:21 - 12:25
    new area they're working in but don't want
    to drag in a lot of extraneous complexity.
  • 12:25 - 12:30
    They want something simple and efficient
    that addresses their use case. That's what
  • 12:30 - 12:35
    I think is the sweet spot for Noise so
    far. For the rest of this talk, what I
  • 12:35 - 12:41
    want to do is talk about what the
    components of a secure channel protocol
  • 12:41 - 12:45
    are, why I think it's a good idea to have
    a framework that addresses the design of
  • 12:45 - 12:50
    these things, and then fill in the details
    on what the Noise framework actually is.
  • 12:50 - 12:54
    Secure channel protocols all have kind of
    the same structure: they start with a
  • 12:54 - 12:58
    handshake phase where parties send a few
    messages back and forth to get a shared
  • 12:58 - 13:03
    secret key, then they use this shared
    secret key for the transport phase of just
  • 13:03 - 13:08
    doing bulk encryption. The transport phase
    is a simple thing, it's pretty easy to
  • 13:08 - 13:13
    just use shared keys to encrypt data back
    and forth, so I'm not going to say a lot
  • 13:13 - 13:18
    more about it. The handshake phase is
    where all the excitement and the
  • 13:18 - 13:26
    interesting things are. Of course, the
    main component of a secure protocol, a
  • 13:26 - 13:28
    secure channel, is the handshake. It's
    going to be just an authenticated key
  • 13:28 - 13:34
    exchange, an AKE of some sort, but a lot
    of secure channel protocols will also have
  • 13:34 - 13:41
    some sort of negotiation that happens
    logically before the rest of this that
  • 13:41 - 13:45
    determines the type of AKE, and the
    parameters of the AKE, and the parameters
  • 13:45 - 13:50
    of the encryption such as which cipher to
    use. You can think of this negotiation
  • 13:50 - 13:54
    happening logically before everything else
    because it determines everything else, but
  • 13:54 - 13:58
    in practice, for efficiency, the
    negotiation of the AKE are usually
  • 13:58 - 14:03
    overlaid or woven together a little bit.
    So I might send an initial message from
  • 14:03 - 14:08
    the client that says "I'm speculatively
    executing this AKE protocol but I'm
  • 14:08 - 14:11
    willing to execute these other protocols
    and I'm willing to use these ciphers for
  • 14:11 - 14:15
    the transport phase", and then the server
    can respond by saying "I want you to do a
  • 14:15 - 14:20
    different AKE, I want you to use these
    ciphers at the end of it". So you have
  • 14:20 - 14:24
    these negotiation in AKE happening kind of
    simultaneously, which is one of the
  • 14:24 - 14:29
    reasons these protocols are a little
    complicated to think about. But anyways,
  • 14:29 - 14:34
    if we were building a single secure
    channel protocol, we would be trying to
  • 14:34 - 14:38
    fill in these elements. We would be
    saying, okay, what AKE do we want to use,
  • 14:38 - 14:41
    how do we want to instantiate the
    cryptography within them, and then how do
  • 14:41 - 14:46
    we want to design a negotiation structure
    that can select one of these different
  • 14:46 - 14:52
    things, and how do we assemble all that
    together. We're not trying to build a a
  • 14:52 - 14:57
    single AKE protocol, we're trying to build
    a framework for building AKE protocols, so
  • 14:57 - 15:05
    we're doing something a little bit more
    confusing and the reason is pretty simple.
  • 15:05 - 15:11
    If you're trying to build a single
    protocol, you have a hard decision, and a
  • 15:11 - 15:16
    difficult trade-off to manage between
    adding features into this protocol and
  • 15:16 - 15:20
    keeping it simple. Because the more
    features you add, the more negotiations
  • 15:20 - 15:25
    you have, the more different branches your
    protocol can take, the more complexity
  • 15:25 - 15:29
    every implementer has to deal with, the
    more attack service you have, because if
  • 15:29 - 15:33
    there's any bug in any of these features
    that an attacker can navigate to, that's
  • 15:33 - 15:39
    potentially a problem. We want to work on
    things that have a lot of features that
  • 15:39 - 15:43
    address a lot of cases, but we also want
    to keep things simple. So if we think of
  • 15:43 - 15:47
    ourselves as creating not just a single
    protocol, but a framework of protocols, we
  • 15:47 - 15:51
    can kind of manage that tension a little
    bit better by imagining that we have all
  • 15:51 - 15:55
    these features and all these capabilities
    off to the side, and a library or a tool
  • 15:55 - 15:58
    somewhere. And when we build a concrete
    protocol, we're just going to select a
  • 15:58 - 16:02
    bunch of features and hopefully have some
    simple combination rules for putting them
  • 16:02 - 16:07
    together and to get a very customized
    protocol that does exactly what we want
  • 16:07 - 16:13
    and not anything that we we don't want.
    That means that working with Noise is
  • 16:13 - 16:19
    different from working with something like
    TLS because with most cryptographic
  • 16:19 - 16:23
    protocols, you probably can just take a
    TLS library, point it at another TLS
  • 16:23 - 16:26
    library, and they'll figure out how to
    connect. They'll do negotiations, fall
  • 16:26 - 16:31
    backs, retries, ... and they'll find the
    intersection of cipher suites and
  • 16:31 - 16:36
    versions, etc. that they support, and will
    connect to each other. That's a feat of
  • 16:36 - 16:39
    engineering, but there's a lot of
    complexity that lies behind that, and
  • 16:39 - 16:45
    there's a lot of opacity in understanding
    what you're really getting. To use Noise,
  • 16:45 - 16:49
    on the other hand, you have to think in
    advance about what you want to use, what
  • 16:49 - 16:52
    AKEs you want to use, what cryptography
    you're gonna get... You're going to choose
  • 16:52 - 16:55
    all these things. You're going to have to
    understand why you want the sequence of
  • 16:55 - 16:58
    messages, you're going to put them
    together, and you're going to end up with
  • 16:58 - 17:03
    something that very much addresses your
    use case, hopefully, but is not going to
  • 17:03 - 17:07
    have a lot of extraneous complexity. So
    that's a different way of working with
  • 17:07 - 17:12
    protocols and thinking about protocols,
    but I think it's the right answer for a
  • 17:12 - 17:17
    lot of cases. At least that's our goal. We
    want to build as a framework where we can
  • 17:17 - 17:25
    choose a bunch of things, combine them
    together, and then end up with a wide
  • 17:25 - 17:29
    range of different protocols. But to get
    there is a little bit complicated. To get
  • 17:29 - 17:34
    there, we're gonna have to take our
    structure of a secure channel protocol and
  • 17:34 - 17:37
    break it up into some different elements
    so that we can mix and match these
  • 17:37 - 17:42
    elements and get different protocols.
    We're gonna break it up in a couple
  • 17:42 - 17:46
    different ways. The first way we're going
    to do that is we're gonna separate out all
  • 17:46 - 17:52
    the points in the protocol where runtime
    decisions are made from all the points of
  • 17:52 - 17:57
    the protocol, we can think of, it's just
    straight line, linear code. And the reason
  • 17:57 - 18:02
    why is because, if we have straight line,
    just linear cryptographic code that just
  • 18:02 - 18:06
    does one thing after another and sends one
    message after another, and does nothing
  • 18:06 - 18:11
    else, except maybe erroring if it detects,
    say, it detects cryptographic
  • 18:11 - 18:14
    authentication failure. We have code like
    that. It's very easy to test, it's easy to
  • 18:14 - 18:19
    think about, it's easy to design things
    around because it just does one thing in a
  • 18:19 - 18:24
    sequence. And so that's… Noise is very
    much going to be about forcing people to
  • 18:24 - 18:30
    use straight line code with no branches as
    much as possible. Our idea of being a
  • 18:30 - 18:33
    framework hopefully helps with that
    because we've moved a lot of decisions
  • 18:33 - 18:38
    that might have been runtime decisions,
    negotiation decision in a full protocol,
  • 18:38 - 18:42
    we're moving them to, hopefully, design
    time decisions within a framework. But we
  • 18:42 - 18:46
    might still have some negotiation
    decisions remaining about, like, which
  • 18:46 - 18:51
    cipher to use or, you know like, if we try
    to do a zero round-trip encryption, we
  • 18:51 - 18:54
    might have to fall back to something else.
    So there might be some decisions that
  • 18:54 - 18:57
    remain. We're going to try to compress all
    those decisions into kind of one, and say
  • 18:57 - 19:01
    there's only one point in this framework
    where runtime decisions get made, which is
  • 19:01 - 19:06
    selecting what we're going to call a Noise
    protocol. And the Noise… And this notion
  • 19:06 - 19:09
    of the Noise protocol is going to
    encapsulate everything else that happens.
  • 19:09 - 19:13
    It's just a linear sequence of code, it's
    going to be the AKE plus whatever
  • 19:13 - 19:18
    transport encryption happens after that.
    So with this framework we've hopefully…
  • 19:18 - 19:21
    You know, we hate decision-making at
    runtime but we're going to compress it
  • 19:21 - 19:24
    down to one if we have to and then call
    everything else just a straight line
  • 19:24 - 19:28
    sequence of code. The next thing we're
    going to do to make this framework sort of
  • 19:28 - 19:34
    manageable and break it down, is zoom in
    on this notion of the Noise protocol and
  • 19:34 - 19:37
    break that into pieces too. And so we're
    going to view that as a combination of,
  • 19:37 - 19:42
    what we call a handshake pattern, with
    some actual crypto algorithms. And a
  • 19:42 - 19:46
    handshake pattern is going to be like an
    abstract notion of an AKE, so it's going
  • 19:46 - 19:51
    to be an AKE protocol that just says: do
    some sort of Diffie-Hellman, encrypt this
  • 19:51 - 19:54
    in some way, hash this in some way, but
    it's not going to tell you what crypto to
  • 19:54 - 19:58
    use. You're going to plug in crypto, and
    it's that combination of things is gonna
  • 19:58 - 20:04
    give you a concrete Noise protocol, which
    is in kind of an implementable unit of
  • 20:04 - 20:10
    this framework. So, the whole framework
    then kind of ends up being like this: the
  • 20:10 - 20:13
    sort of core central piece is this notion
    of the Noise protocol which is, what we've
  • 20:13 - 20:17
    probably spent most of our engineering
    effort on, where we combine some abstract
  • 20:17 - 20:22
    notion of an AKE, a handshake pattern,
    with some crypto to get a Noise protocol.
  • 20:22 - 20:25
    We're going to imagine a negotiation layer
    that can really just make one decision
  • 20:25 - 20:29
    which is: does the server want to switch
    from the initial noise protocol to a
  • 20:29 - 20:32
    different one. So we're only going to
    allow one transition, just to make things
  • 20:32 - 20:37
    really simple. And then the only other
    layer we're going to add, is this notion
  • 20:37 - 20:42
    of an encoding layer which is that, we
    might want to send our messages over TCP,
  • 20:42 - 20:46
    in which case we'd have to add length
    fields. Or we might send them over HTTP,
  • 20:46 - 20:49
    in which case we'll have to encode them as
    HTTP requests. So we have this kind of
  • 20:49 - 20:53
    abstract notion of our protocol, but we
    might need to add a little bit more
  • 20:53 - 20:57
    encoding to actually fit it into a
    particular context. And that's, you know,
  • 20:57 - 21:02
    that's gonna be kind of just the whole way
    we build secure channel protocols. So, the
  • 21:02 - 21:10
    main thing that you're going to interact
    with, is, or the kind of central piece of
  • 21:10 - 21:14
    this is the Noise protocol and the main
    way that you're going to interact with
  • 21:14 - 21:19
    Noise protocols and design them as a user,
    is by just giving them names. And so we
  • 21:19 - 21:23
    have this notion of, you can precisely
    name a Noise protocol and then that just,
  • 21:23 - 21:30
    kind of like, defines the entire protocol.
    So here we have a Noise protocol that's,
  • 21:30 - 21:35
    you know, this is a concrete implementable
    thing: it uses the NX pattern which, I
  • 21:35 - 21:40
    haven't explained what that means, but it
    also combines that pattern that AKE notion
  • 21:40 - 21:44
    with Curve25519 for Diffie-Hellman, with
    AES-GCM for encryption, with SHA-256 for
  • 21:44 - 21:52
    hashing, we can plug in or out different
    options of any one of these things. So we
  • 21:52 - 21:57
    could have different patterns, different
    ciphers, etc. to get a Noise protocol and
  • 21:57 - 22:01
    then the specification, and most of our
    Noise libraries can take this name and
  • 22:01 - 22:05
    will just automatically know what to do.
    They'll synthesize a whole protocol around
  • 22:05 - 22:11
    this, just with some some pretty simple
    rules. And, so the pattern notion and the
  • 22:11 - 22:16
    way we're naming patterns… There is a
    naming convention here but I think more
  • 22:16 - 22:18
    important than understanding the naming
    convention, is understanding this simple
  • 22:18 - 22:24
    language that it's built on top of. And,
    so we're gonna have a sort of simple
  • 22:24 - 22:30
    language for describing a range of sort of
    abstract AKE patterns based on, based on
  • 22:30 - 22:36
    this set of concepts, based on just saying
    we have Alice and Bob, they each might
  • 22:36 - 22:39
    have a static key and they might have an
    ephemeral key, and the only things we're
  • 22:39 - 22:44
    gonna allow them to do, as part of their
    AKE protocol, is send their public keys
  • 22:44 - 22:48
    back and forth and do Diffie-Hellman
    operations and the only Diffie-Hellman
  • 22:48 - 22:52
    operations they can do are, you know,
    these four involving some combination of
  • 22:52 - 22:56
    their keys which you can just read from
    left to right, so they can do this static-
  • 22:56 - 23:01
    static Diffie-Hellman, they can do the
    Alice's static to Bob's ephemeral which
  • 23:01 - 23:05
    sort of authenticates Alice, you can do
    Alice's ephemeral to Bob's static which
  • 23:05 - 23:10
    authenticates Bob, or they can do this EE
    Diffie-Hellman for forward secrecy. So
  • 23:10 - 23:13
    we're going to allow them just to combine
    these units in different ways and get a
  • 23:13 - 23:19
    wide range of different AKEs out of this.
    So let's start demonstrate... I'm going to
  • 23:19 - 23:21
    demonstrate a bunch of patterns and kind
    of go through them quickly, and let's
  • 23:21 - 23:24
    start with something that's very simple,
    which is just a public key encryption. So
  • 23:24 - 23:28
    this AKE pattern doesn't even describe an
    interactive protocol, it's just Alice
  • 23:28 - 23:33
    encrypting a message to Bob. And so, our
    little language here, we're going to add
  • 23:33 - 23:38
    three dots to indicate when Alice has
    prior knowledge of something before the
  • 23:38 - 23:43
    protocol starts. So this is a protocol
    where Alice knows Bob's public key at the
  • 23:43 - 23:46
    outset. She's going to send one message
    which is an ephemeral public key she
  • 23:46 - 23:50
    chooses. She's going to do an ES,
    Ephemeral Static Diffie-Hellman, to
  • 23:50 - 23:54
    authenticate Bob and that's going to give
    her public key encryption because then
  • 23:54 - 23:58
    she's going to have keys that she can use
    for sort of the transport phase encryption
  • 23:58 - 24:02
    of the message she's sending to Bob. So
    that's just--you could think of this as in
  • 24:02 - 24:06
    like an ECIES or an ephemeral static
    public key encryption. We could make this
  • 24:06 - 24:10
    more complicated by saying both parties
    know their public keys and we want Alice
  • 24:10 - 24:13
    to authenticate to Bob, and now we just
    throw in the static-static encryption and
  • 24:13 - 24:18
    now we have Alice authenticating herself
    to Bob. We could make another step in
  • 24:18 - 24:22
    complexity and say we want Alice to
    authenticate herself to Bob and also send
  • 24:22 - 24:26
    her public key to Bob, and she might also
    have to send certificates and things like
  • 24:26 - 24:30
    that to convince Bob her public key is to
    be trusted. That can go in the transport
  • 24:30 - 24:34
    payload, but the point is now we've taken
    Alice's public key and say instead of it
  • 24:34 - 24:40
    being prior knowledge of Bob's, it's
    transported in the message itself, and
  • 24:40 - 24:45
    we're going to have this additional rule
    which is that any time we send the static
  • 24:45 - 24:48
    public key we're gonna encrypt it with all
    the other keys that have come before. So
  • 24:48 - 24:53
    in this case Alice's static public key is
    encrypted with the output of the ephemeral
  • 24:53 - 24:57
    static DH, which provides some identity
    hiding, so someone looking at the wire
  • 24:57 - 25:04
    doesn't know who Alice's is, even though
    Bob knows. We can move on to interactive
  • 25:04 - 25:07
    protocols and look at unauthenticated
    Diffie-Hellman, just looks like this: an
  • 25:07 - 25:12
    exchange of the ephemeral public keys and
    a Diffie-Hellman. You could add server
  • 25:12 - 25:17
    authentication to that, where the server
    just sends its static public key and does
  • 25:17 - 25:22
    a Diffie-Hellman. You could imagine that
    the server's public key is known in
  • 25:22 - 25:31
    advance by the client and in this case
    we're not transporting it from the server,
  • 25:31 - 25:35
    but if we're in this case we can use
    something even better, which is kind of a
  • 25:35 - 25:40
    nice property of the style of protocol. We
    can move that ephemeral static DH from the
  • 25:40 - 25:47
    second message to the first and say Alice
    can actually do zero round-trip encryption
  • 25:47 - 25:50
    to Bob or to the server's public key. So
    she does--the first message there is
  • 25:50 - 25:53
    essentially what I earlier called the
    public key encryption. She's just
  • 25:53 - 25:57
    encrypting straight away to Bob in her
    first message, and that's something we can
  • 25:57 - 26:01
    do with a Diffie-Hellman-based AKE that
    you can't do with say a signature-based
  • 26:01 - 26:05
    AKE, because if Bob's static key is the
    signing key you would not be able to
  • 26:05 - 26:11
    encrypt to it. So, you know, that's kind
    of an example of some nice features we get
  • 26:11 - 26:16
    from this style of AKE. We could continue
    making things more complicated. So we
  • 26:16 - 26:20
    could add not just zero round-trip
    encryption, zero round-trip
  • 26:20 - 26:27
    authentication, in this first flow by
    having Alice send her identity and doing
  • 26:27 - 26:32
    an additional Diffie-Hellman. And if we're
    doing that we should probably also refresh
  • 26:32 - 26:38
    the authentication in the second message
    with this ES so that Bob's authentication
  • 26:38 - 26:43
    of Alice is based on a fresh ephemeral
    instead of a long-term static key which
  • 26:43 - 26:47
    could potentially be compromised. And if
    we do all this, we get actually--this is
  • 26:47 - 26:52
    very close to WireGuard's pattern.
    WireGuard adds an additional feature that
  • 26:52 - 26:58
    is a pre-shared symmetric key, and that's
    something that, you know, we designed
  • 26:58 - 27:02
    working with the WireGuard designer Jason
    Donenfeld that just allows you to add an
  • 27:02 - 27:09
    extra key that gets mixed into everything.
    The idea being that in a VPN context the
  • 27:09 - 27:13
    two parties want to share a secret key,
    then your security will depend on either
  • 27:13 - 27:17
    that or all these Diffie-Hellmans, and so
    even if someone is able to break Diffie-
  • 27:17 - 27:23
    Hellman through cryptanalysis or a quantum
    computer, if you've shared a secret key
  • 27:23 - 27:27
    through some other means they would not be
    able to go back and break your traffic. So
  • 27:27 - 27:32
    that's kind of just an example of how we
    can take this language that is a fairly
  • 27:32 - 27:36
    simple language, extend it with new
    features, and we're interested in
  • 27:36 - 27:40
    continuing that process and adding new
    features onto this. So, you know things
  • 27:40 - 27:43
    that are there in the mix is trying to
    figure out how to add you know post
  • 27:43 - 27:47
    quantum resistant algorithms to provide
    hybrid forward secrecy onto these
  • 27:47 - 27:52
    protocols, even going back and adding the
    notions of signatures into this. Because
  • 27:52 - 27:56
    just like all this machinery we have is
    good for Diffie-Hellman based protocols,
  • 27:56 - 28:00
    probably we can take all these notions of
    patterns and of Noise protocols and how
  • 28:00 - 28:04
    our approach to negotiation and
    apply them even to more conventional AKEs
  • 28:04 - 28:08
    into other things as well. So that's sort
    of our framework, you know it ends up
  • 28:08 - 28:12
    looking kind of like this, with some, you
    know, a very simple negotiation layer
  • 28:12 - 28:17
    switching to this very linear notion of a
    fixed Noise protocol that you can assemble
  • 28:17 - 28:21
    together by taking an abstract notion of
    patterns and combining it with
  • 28:21 - 28:25
    cryptography of your choice. You know
    we're still working on a lot of extensions
  • 28:25 - 28:30
    for this, I'd love to get more people who
    wanted to experiment with it or use it for
  • 28:30 - 28:34
    anything. You can find more on our website
    which has links to our mailing list as
  • 28:34 - 28:38
    well. I'm happy to talk about it with
    anyone. There's gonna be a WireGuard meet
  • 28:38 - 28:43
    up tomorrow at 3 o'clock and I'll probably
    be milling around there as well, but if
  • 28:43 - 28:46
    you want to talk to Jason and other
    WireGuard people and see how all this
  • 28:46 - 28:50
    works in a concrete context, that would be
    you know a good way to learn more about
  • 28:50 - 28:55
    it. Thank you for listening, and do I have
    time for questions? Maybe a brief amount
  • 28:55 - 29:08
    of time.
    applause
  • 29:08 - 29:22
    Herald-Angel: Microphone one.
    Question: So in the context of like multi-
  • 29:22 - 29:28
    party systems, if you have like a person
    that has either multiple devices or
  • 29:28 - 29:35
    multiple keys, is there anything that you
    could use inside Noise to work with that
  • 29:35 - 29:39
    so that you have like messages being sent
    to both identities, or would you recommend
  • 29:39 - 29:44
    some doing something like that over like a
    central registry and then linking the keys
  • 29:44 - 29:48
    and having it sent to one and the devices
    sharing with each other?
  • 29:48 - 29:51
    Answer: Yeah that's a good question, I
    mean I think that really gets into the
  • 29:51 - 29:54
    scope of what like secure messaging
    protocols try to address, is when you have
  • 29:54 - 29:57
    notions of groups and want to be
    consistent with the group and you want to
  • 29:57 - 30:00
    talk to everyone in the group and maybe
    everyone in the group isn't online at the
  • 30:00 - 30:04
    same time, and I would say that's a
    different and more complex class of
  • 30:04 - 30:07
    protocols that we're kind of just not
    trying to handle here. I think with Noise
  • 30:07 - 30:10
    hopefully we're looking at something
    that's a very simple and well understood
  • 30:10 - 30:13
    design space so we can build a lot of
    machinery around it, because it's so
  • 30:13 - 30:16
    simple, and these other cases you're
    talking about I think just add a lot of
  • 30:16 - 30:20
    complexity about how you would want to do
    all those things. So we've kind of just
  • 30:20 - 30:26
    chosen a narrow scope to make this
    specific problem a lot easier, I would
  • 30:26 - 30:29
    say.
    Q: Okay, thanks!
  • 30:29 - 30:33
    Q: Does Noise include any of the
    ratcheting or sort of key evolution over
  • 30:33 - 30:36
    time properties that we've seen in
    protocols like this in the past?
  • 30:36 - 30:41
    A: No, so Noise has a pretty simple model
    of just you have like a handshake phase
  • 30:41 - 30:44
    and a transport phase and the transport
    phase just uses a key. Now we have added a
  • 30:44 - 30:49
    notion of being able to like update this
    key by just replacing it with, like, you
  • 30:49 - 30:53
    know, some of its own output, essentially.
    So we can kind of roll it forward in a
  • 30:53 - 30:56
    very simple way and we have an efficient
    way of doing that, so you could do things
  • 30:56 - 30:59
    like have every one of your messages
    update the key to the next key, and then
  • 30:59 - 31:03
    you have within the protocol forward
    secrecy. We don't try to do like more
  • 31:03 - 31:10
    complicated things with Diffie-Hellman
    ratchets or anything like that,
  • 31:10 - 31:16
    Q: When would be--what's the simple sales
    pitch for why to use Noise over TLS?
  • 31:16 - 31:21
    A: You know, probably the simplest sales
    pitch would be like, if you really really
  • 31:21 - 31:25
    want your protocol to just do like one
    thing and you don't want to drag around a
  • 31:25 - 31:28
    lot of code that does like a lot of
    things, you know like Noise will let you
  • 31:28 - 31:32
    produce a very fine-tuned protocol that's
    a very small amount of code that just does
  • 31:32 - 31:35
    like one thing pretty easily.
  • 31:35 - 31:37
    Herald: That's it, thanks a lot
  • 31:37 - 31:42
    Perrin: Thank you.
    applause
  • 31:42 - 31:48
    postroll music
  • 31:48 - 32:03
    subtitles created by c3subtitles.de
    in the year 2018. Join, and help us!
Title:
34C3 - The Noise Protocol Framework
Description:

more » « less
Video Language:
English
Duration:
32:04

English subtitles

Revisions