|
@@ -1,12 +1,42 @@
|
1
|
|
-# End-to-end encryption using Insertable Streams
|
|
1
|
+# End-to-End Encryption using Insertable Streams
|
|
2
|
+
|
|
3
|
+## Overview
|
2
|
4
|
|
3
|
5
|
**NOTE** e2ee is work in progress.
|
4
|
6
|
This document describes some of the high-level concepts and outlines the design.
|
5
|
7
|
Please refer to the source code for details.
|
6
|
8
|
|
7
|
|
-## Packet format
|
8
|
|
-We are using a variant of
|
9
|
|
- https://tools.ietf.org/html/draft-omara-sframe-00
|
|
9
|
+This library implements End-to-End Encryiption (E2EE) on supported endpopints (currently just browsers with support
|
|
10
|
+for [insertable streams](https://github.com/w3c/webrtc-insertable-streams)).
|
|
11
|
+
|
|
12
|
+This implementation follows the model outlined in [SFrame](https://tools.ietf.org/html/draft-omara-sframe-00) with
|
|
13
|
+slight changes.
|
|
14
|
+
|
|
15
|
+## Signaling
|
|
16
|
+
|
|
17
|
+Each participant will have a randomly generated key which is used to encrypt the media. The key is distributed with
|
|
18
|
+other participants (so they can decrypt the media) via an E2EE channel which
|
|
19
|
+is established with [Olm](https://gitlab.matrix.org/matrix-org/olm).
|
|
20
|
+
|
|
21
|
+### Key rotation
|
|
22
|
+
|
|
23
|
+Each participant's key is rotated (a new random one is generated) every time a participant leaves. This new key is
|
|
24
|
+then sent to every other participant over the E2EE Olm channel.
|
|
25
|
+
|
|
26
|
+### Key ratcheting
|
|
27
|
+
|
|
28
|
+Each participant ratchets their key when another participant joins. The new resulting key is not distributed since
|
|
29
|
+every participant can derive it by ratchetting themselves.
|
|
30
|
+
|
|
31
|
+Unlike described in [SFrame 4.3.5.1](https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1)
|
|
32
|
+we attempt to ratchet the key forward when we do not find a valid authentication tag. Note that we only update
|
|
33
|
+the set of keys when we find a valid signature which avoids a denial of service attack with invalid signatures.
|
|
34
|
+
|
|
35
|
+## Media
|
|
36
|
+
|
|
37
|
+### Packet format
|
|
38
|
+
|
|
39
|
+We are using a variant of [SFrame](https://tools.ietf.org/html/draft-omara-sframe-00)
|
10
|
40
|
that uses a trailer instead of a header. We call it JFrame.
|
11
|
41
|
|
12
|
42
|
At a high level the encrypted frame format looks like this:
|
|
@@ -32,25 +62,15 @@ At a high level the encrypted frame format looks like this:
|
32
|
62
|
+----+Encrypted Portion Authenticated Portion+---+
|
33
|
63
|
```
|
34
|
64
|
|
35
|
|
-We do not encrypt the first few bytes of the packet that form the VP8 payload
|
36
|
|
- https://tools.ietf.org/html/rfc6386#section-9.1
|
37
|
|
-(10 bytes for key frames, 3 bytes for interframes) nor the Opus TOC byte
|
38
|
|
- https://tools.ietf.org/html/rfc6716#section-3.1
|
39
|
|
-This allows the decoder to understand the frame a bit more and makes it decode the fun looking garbage we see in the video.
|
40
|
|
-This also means the SFU does not know (ideally) that the content is end-to-end encrypted and there are no changes in the SFU required at all.
|
41
|
|
-
|
42
|
|
-## Key Ratcheting
|
43
|
|
-Unlike described in
|
44
|
|
- https://tools.ietf.org/html/draft-omara-sframe-00#section-4.3.5.1
|
45
|
|
-we attempt to ratchet the key forward when we do not find a valid
|
46
|
|
-authentication tag. Note that we only update the set of keys when
|
47
|
|
-we find a valid signature which avoids a denial of service attack with invalid signatures.
|
48
|
|
-
|
49
|
|
-TODO: if a frame ratchets the key forward it should be signed with the senders private key.
|
|
65
|
+We do not encrypt the first few bytes of the packet that form the
|
|
66
|
+[VP8 payload](https://tools.ietf.org/html/rfc6386#section-9.1) (10 bytes for key frames, 3 bytes for interframes) nor
|
|
67
|
+the [Opus TOC byte](https://tools.ietf.org/html/rfc6716#section-3.1)
|
|
68
|
+This allows the decoder to understand the frame a bit more and makes it decode the fun looking garbage we see in the
|
|
69
|
+video. This also means the SFU does not know (ideally) that the content is end-to-end encrypted and there are no
|
|
70
|
+changes in the SFU required at all.
|
50
|
71
|
|
51
|
|
-## Using workers
|
|
72
|
+### Using Web Workers
|
52
|
73
|
|
53
|
|
-Insertable Streams are transferable and can be sent from the main javascript context to a Worker
|
54
|
|
- https://developer.mozilla.org/en-US/docs/Web/API/Worker
|
55
|
|
-We are using a named worker (E2EEworker) which allows very easy inspection in Chrome Devtools.
|
56
|
|
-It also makes the keys very self-contained.
|
|
74
|
+Insertable Streams are transferable and can be sent from the main JavaScript context to a
|
|
75
|
+[Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).
|
|
76
|
+We are using a named worker (E2EEworker) which allows very easy inspection in Chrome DevTools.
|