Skip to content

Securejoin v3: Encrypt all securejoin messages #7701

@Hocuri

Description

@Hocuri

As explained at #7042 (comment), we would like to change the securejoin protocol. Most importantly, all securejoin messages will be encrypted.

Securejoin is the protocol than runs when the user scans a QR code or clicks on an invite link. By convention, the person who creates the QR codes is called "Alice", and the person who scans it is called "Bob".

Motivation

  • Today, the first securejoin message (vc-request) is unencrypted. This leaks Bob's cryptographic identity.
  • Also, the fact that some securejoin messages are unencrypted means that we need an exception in chatmail servers, which otherwise don't allow any unencrypted messages. It also makes workarounds like Detect Secure-Join request step using only Secure-Join-Invitenumber #7687 necessary.
  • Today, there are two tokens in the QR code, AUTH and INVITENUMBER. Once everyone upgrades, we can get rid of the INVITENUMBER, making QR codes a little bit smaller.

Protocol flow chart

Old protocol New protocol
Image Image

If Bob already knows Alice's pubkey, there is a shortcut: The first two messages can be skipped.

Implementation considerations

  • When Alice answers the first message, she doesn't know anything about Bob, not even his pubkey. So, she can't create a contact for him; but we can create and send the answer message pretty much directly, without using all of the existing sending logic that expects a contact id. I.e. we can directly create a MimeFactory or a RenderedEmail.
  • Probably it's easiest to call the 3rd message vc-request-with-auth for backwards compatibility, even though this doesn't exactly describe what it does

Backwards compatibility

  • In order to stay backwards compatible, QR codes will get a new parameter &v=3. This means that old clients will continue to understand them. Unfortunately, it also means that we need to include an INVITENUMBER, even though it's only needed if an old client scans the QR code.
  • For the case that Alice or Bob has two devices, one of which understands the new protocol, and one of which doesn't:
    • What's easy to solve is the case that the old device created or scanned the QR code; in this case, we just need to make sure that we continue to understand these messages in observe_securejoin_on_other_device().
    • If the new device created or scanned the QR code:
      • The old device won't be able to decrypt the first two messages, because they are symmetrically encrypted.
      • Therefore, we need to make sure not to self-send the first two messages.
      • Apart from that, observe_securejoin_on_other_device() should understand the request-with-auth or member-added/contact-confirm message just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions