Skip to content

proposal: Noise extension registry #450

@marten-seemann

Description

@marten-seemann

Problem: Noise doesn’t define a way to add general-purpose extensions to the handshake. These extensions could be used to negotiate optional features.

Currently, we have 3 (!) proposals in flight that would use Noise’s Early Data feature to either modify the Noise handshake or negotiate application-layer behavior:

  1. WebTransport: webtransport: use CBOR to encode cert hashes during Noise handshake #429, to tie the certificate hash to the (authenticated) peer IDs
  2. WebRTC: webrtc/: Add libp2p WebRTC browser-to-server spec #412, in a similar fashion, to tie the certificate fingerprint to the peer IDs
  3. Muxer selection in security handshake #446, to negotiate the stream multiplexer

By pure coincidence, these 3 use cases don’t overlap, i.e. you’d only want to use one OR the other, but not two or three at the same time. However, I can easily come up with use cases where you’d want to use one of those described above AND another extension.

As a point of reference, both TLS (via RFC 6066) and QUIC (via transport parameters, see Section 19.21 of RFC 9000 provide such a general-purpose mechanism.

I propose to define a mechanism exactly along those lines: When defining a Noise extension, you’d pick a code point, and could then attach extension-defined data to that code point. It makes sense to use a Protobuf here, as our Noise handshake already uses Protobufs. We’re making use of the property of Protobufs that only fields that actually have a value are being serialized (I assume).

With the 3 use cases before, we’d start with something like this:

message NoiseExtension {
    repeated bytes webtransport_certhashes = 1;
    optional bytes webrtc_fingerprint = 2;
    repeated string stream_muxers = 3; 
}

We could also add version field at the beginning of the protobuf, with a fixed version number, to make this even more future-proof.

Regarding document structure, this definition would probably live in a separate markdown file in the Noise directory. Specifications that want to use a Noise extension would need to update this file.

Regarding code points, we can reserve the short (1- and 2-byte varints) for approved specifications, and leave the space with longer varints open for experimentation on a first-come-first-serve basis.

@MarcoPolo @mxinden @julian88110 @p-shahi @BigLep, what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🎉 Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions