@@ -30,14 +30,14 @@ makes it possible to split a message into chunks and reassemble the
30
30
message on the receiver's side while allowing any combination of
31
31
ordered/unordered and reliable/unreliable transport channel underneath.
32
32
33
- ## Wrapped Data Channel
33
+ ## Secure Data Channel
34
34
35
35
This protocol adds another security layer for WebRTC data channels as we
36
36
want our protocol to sustain broken (D)TLS environments. A data channel
37
- that uses this security layer will be called * Wrapped Data Channel* .
38
- Note that the user MAY or MAY NOT choose to use wrapped data channels
37
+ that uses this security layer will be called * Secure Data Channel* .
38
+ Note that the user MAY or MAY NOT choose to use secure data channels
39
39
for its purpose. However, the handed over signalling channel MUST use a
40
- wrapped data channel.
40
+ secure data channel.
41
41
42
42
# Task Protocol Name
43
43
@@ -59,71 +59,56 @@ MUST be validated and potentially stored.
59
59
The task's data SHALL be a ` Map ` containing the following items:
60
60
61
61
* The * exclude* field MUST contain an ` Array ` of WebRTC data channel ids
62
- (non-negative integers) that SHALL not be used for the signalling
63
- channel. This ` Array ` MUST be available to be set from user
64
- applications that use specific data channel ids.
62
+ (non-negative integers less than ` 65535 ` ) that SHALL not be used for
63
+ the signalling channel. This ` Array ` MUST be available to be set from
64
+ user applications that use pre-negotiated data channel ids.
65
65
* The * handover* field SHALL be set to ` true ` unless the user application
66
- explicitly requested to turn off the handover feature or the
67
- implementation has knowledge that ` RTCDataChannel ` s are not supported.
68
- In this case, the value SHALL be set to ` false ` .
66
+ explicitly requested to turn off the handover feature in which case it
67
+ SHALL be set to ` false ` .
69
68
70
69
## Incoming
71
70
72
- A client who receives the task's data from the other peer MUST do the
71
+ A client who receives the task's data from the remote peer MUST do the
73
72
following checks:
74
73
75
74
* The * exclude* field MUST contain an ` Array ` of WebRTC data channel IDs
76
- (non-negative integers) that SHALL not be used for the signalling
77
- channel. The client SHALL store this list for usage during handover.
75
+ (non-negative integers less than ` 65535 ` ) that SHALL not be used for
76
+ the signalling channel. The client SHALL store this list for usage
77
+ during handover.
78
78
* The * handover* field MUST be either ` true ` or ` false ` . If both
79
79
client's values are ` true ` , the negotiated value is ` true ` . In any
80
80
other case, the negotiated value is ` false ` and a handover requested
81
81
by the user application SHALL be rejected (see the * Signalling Channel
82
82
Handover* section for details).
83
83
84
- # Wrapped Data Channel
84
+ # Secure Data Channel
85
85
86
- This protocol adds another security layer to WebRTC's data channels. To
87
- allow both the user's application and the handed over signalling channel
88
- to easily utilise this security layer, it is RECOMMENDED to provide a
89
- wrapper/proxy to the ` RTCDataChannel ` interface. Underneath, the wrapped
90
- data channel MUST use NaCl for encryption/decryption and chunk messages
91
- as specified in the
92
- [ SaltyRTC chunking specification] ( https://github.com/saltyrtc/saltyrtc-meta/blob/master/Chunking.md )
93
- if necessary.
86
+ This protocol adds another security layer to WebRTC's data channels
87
+ which the handed over signalling channel SHALL use. It MUST be possible
88
+ for the user application to utilise this security layer for further data
89
+ channels. The secure data channel MUST use NaCl for
90
+ encryption/decryption of messages.
94
91
95
92
Outgoing messages MUST be processed and encrypted by following the
96
- * Sending a Wrapped Data Channel Message* section. The encrypted messages
97
- SHALL be split into chunks using SaltyRTC message chunking. The maximum
98
- chunk size MUST be determined by querying the ` maxMessageSize ` attribute
99
- of the associated ` RTCPeerConnection ` 's ` RTCSctpTransport ` .
100
-
101
- Incoming messages SHALL be stitched together using SaltyRTC message
102
- chunking. Complete messages MUST be processed and decrypted by following
103
- the * Receiving a Wrapped Data Channel Message* section. The resulting
104
- complete message SHALL raise a corresponding message event.
105
-
106
- As described in the * Sending a Wrapped Data Channel Message* and the
107
- * Receiving a Wrapped Data Channel Message* section, each new wrapped
108
- data channel instance is being treated as a new peer from the nonce's
109
- perspective and independent of the underlying data channel id. To
110
- prevent nonce reuse, it is absolutely vital that each wrapped data
111
- channel instance has its own cookie, sequence number and overflow
93
+ * Sending a Secure Data Channel Message* section.
94
+
95
+ Incoming messages MUST be processed and decrypted by following the
96
+ * Receiving a Secure Data Channel Message* section.
97
+
98
+ As described in the * Sending a Secure Data Channel Message* and the
99
+ * Receiving a Secure Data Channel Message* section, each new secure
100
+ data channel instance is being treated as a distinct remote peer from
101
+ the nonce's perspective and independent of the underlying data channel
102
+ id. To prevent nonce reuse, it is absolutely vital that each secure
103
+ data channel instance has its own cookie, sequence number and overflow
112
104
number, each for incoming and outgoing messages. Both clients SHALL use
113
- cryptographically secure random numbers for the cookie and the sequence
114
- number.
105
+ cryptographically secure random numbers for generating the cookie and
106
+ the sequence number.
115
107
116
108
# Signalling Channel Handover
117
109
118
- As soon as the user application has created a WebRTC ` RTCPeerConnection `
119
- instance which intends to use this task for its signalling, the user
120
- application SHOULD request that the client hands over the signalling
121
- channel to a dedicated data channel before * offer* or * answer* of the
122
- ` RTCPeerConnection ` have been created. If the negotiated * handover*
123
- parameter from the task's data is ` false ` or the necessary
124
- ` RTCDataChannel ` instance could not be created, the user application
125
- SHALL be informed that a handover cannot take place. Otherwise, the
126
- handover process SHALL be started:
110
+ If the negotiated * handover* parameter is ` true ` , the user application
111
+ SHOULD initiate the handover process:
127
112
128
113
1 . The client creates a new data channel on the ` RTCPeerConnection `
129
114
instance with the ` RTCDataChannelInit ` object containing only the
@@ -134,8 +119,8 @@ handover process SHALL be started:
134
119
* * negotiated* MUST be set to ` true ` , and
135
120
* * id* SHALL be set to the lowest possible number, starting from ` 0 ` ,
136
121
that is not excluded by both clients as negotiated.
137
- 2 . The newly created ` RTCDataChannel ` instance shall be wrapped by
138
- following the * Wrapped Data Channel* section.
122
+ 2 . The newly created ` RTCDataChannel ` instance SHALL be secured by
123
+ following the * Secure Data Channel* section.
139
124
3 . As soon as the data channel is ` open ` , the client SHALL send a
140
125
'handover' message on the WebSocket-based signalling channel (* WS
141
126
channel* ) to the other client. Subsequent outgoing messages MUST be
@@ -160,7 +145,7 @@ structure as defined in the
160
145
[ SaltyRTC protocol specification] ( ./Protocol.md#message-structure )
161
146
SHALL be used.
162
147
163
- For all messages that are being exchanged over wrapped data channels
148
+ For all messages that are being exchanged over secure data channels
164
149
(such as the handed over signalling channel), the nonce/header MUST be
165
150
slightly changed:
166
151
@@ -183,12 +168,12 @@ Contains the data channel id of the data channel that is being used for
183
168
a message.
184
169
185
170
The cookie field remains the same as in the SaltyRTC protocol
186
- specification. Each new wrapped data channel SHALL have a new
171
+ specification. Each new secure data channel SHALL have a new
187
172
cryptographically secure random cookie, one for incoming messages and
188
173
one for outgoing messages.
189
174
190
175
Overflow Number and Sequence Number SHALL remain the same as in the
191
- SaltyRTC protocol specification. Each new wrapped data channel instance
176
+ SaltyRTC protocol specification. Each new secure data channel instance
192
177
SHALL have its own overflow number and sequence number, each for
193
178
outgoing and incoming messages.
194
179
@@ -197,34 +182,45 @@ Data Channel ID field. As there can be only communication between the
197
182
peers that set up the peer-to-peer connection, dedicated addresses are
198
183
no longer required.
199
184
200
- # Sending a Wrapped Data Channel Message
185
+ # Sending a Secure Data Channel Message
201
186
202
187
The same procedure as described in the
203
188
[ SaltyRTC protocol specification] ( ./Protocol.md#sending-a-signalling-message )
204
189
SHALL be followed. However, for all messages that are being exchanged
205
- over wrapped data channels (such as the handed over signalling channel),
206
- the following changes MUST be applied:
190
+ over secure data channels, the following changes MUST be applied:
207
191
208
192
* Each data channel instance SHALL have its own cookie, overflow number
209
193
and sequence number for outgoing messages.
210
194
* Source and destination addresses SHALL NOT be set, instead
211
195
* The data channel id MUST be set to the id of the data channel the
212
196
message will be sent on.
213
197
214
- # Receiving a Wrapped Data Channel Message
198
+ For the handed over
199
+ signalling channel, the encrypted message MUST be fragmented into
200
+ chunks using
201
+ [ SaltyRTC chunking] ( https://github.com/saltyrtc/saltyrtc-meta/blob/master/Chunking.md )
202
+ in * unreliable/unordered* mode (for legacy reasons) after encryption.
203
+ The chunk size MUST be less or equal to the ` maxMessageSize ` value of the
204
+ ` RTCPeerConnection ` 's ` RTCSctpTransport ` .
205
+
206
+ # Receiving a Secure Data Channel Message
207
+
208
+ For the handed over signalling channel, the encrypted message MUST be
209
+ reassembled into a complete signalling message using
210
+ [ SaltyRTC chunking] ( https://github.com/saltyrtc/saltyrtc-meta/blob/master/Chunking.md )
211
+ in * unreliable/unordered* mode (for legacy reasons) before decryption.
215
212
216
213
The same procedure as described in the
217
214
[ SaltyRTC protocol specification] ( ./Protocol.md#receiving-a-signalling-message )
218
215
SHALL be followed. However, for all messages that are being exchanged
219
- over wrapped data channels (such as the handed over signalling channel),
220
- the following changes MUST be applied:
216
+ over secure data channels, the following changes MUST be applied:
221
217
222
218
* Each data channel instance SHALL have its own cookie, overflow number
223
219
and sequence number for incoming messages.
224
- * Source and destination addresses are not present in the wrapped data
220
+ * Source and destination addresses are not present in the secure data
225
221
channel's nonce/header.
226
222
* Overflow number and sequence number SHALL NOT be validated to ensure
227
- unordered and unreliable wrapped data channels can function properly.
223
+ unordered and unreliable secure data channels can function properly.
228
224
However, a client SHOULD check that two consecutive incoming messages
229
225
of the same data channel do not have the exact same overflow and
230
226
sequence number.
@@ -235,10 +231,10 @@ the following changes MUST be applied:
235
231
236
232
The following messages are new messages that will be exchanged between
237
233
two clients (initiator and responder) over the signalling channel. Note
238
- that the signalling channel may be handed over to a data channel anytime
239
- which is REQUIRED to be supported by the implementation. Furthermore,
240
- the handed over signalling channel MUST support all existing
241
- client-to-client message types.
234
+ that the signalling channel may be handed over to a data channel any
235
+ time which is RECOMMENDED to be supported by the implementation.
236
+ Furthermore, the handed over signalling channel MUST support all
237
+ existing client-to-client message types.
242
238
243
239
Other messages, general behaviour and error handling for
244
240
client-to-client messages is described in the
@@ -365,11 +361,11 @@ containing the following fields:
365
361
description the candidate is associated with as described in the
366
362
WebRTC specification. It's value SHALL be either an unsigned integer
367
363
(16 bits) or ` Nil ` .
368
- * The * usernameFragment* field SHALL contain the ICE user fragment as defined in
369
- the WebRTC specification in string representation or ` Nil ` .
364
+ * The * usernameFragment* field SHALL contain the ICE user fragment as
365
+ defined in the WebRTC specification in string representation or ` Nil ` .
370
366
371
367
* (Note: The naming is inconsistent with the rest of the protocol,
372
- because it uses camelCase keys instead of under_scores. The reason for
368
+ since it uses camelCase keys instead of under_scores. The reason for
373
369
this is ease of use in browser implementations: When using camelCase
374
370
each ` candidates ` entry can be passed directly to the JavaScript WebRTC
375
371
implementation.)*
@@ -405,7 +401,7 @@ key pair and the other client's session key pair.
405
401
406
402
## 'handover' Message
407
403
408
- Both clients SHALL send this message once the wrapped data channel
404
+ Both clients SHALL send this message once the secure data channel
409
405
dedicated for the signalling is ` open ` . However, the message MUST be
410
406
sent over the WebSocket-based signalling channel.
411
407
@@ -436,10 +432,10 @@ key pair and the other client's session key pair.
436
432
437
433
The message itself and the client's behaviour is described in the
438
434
[ SaltyRTC protocol specification] ( ./Protocol.md#close-message ) . Once the
439
- signalling channel has been handed over to a wrapped data channel, sent
435
+ signalling channel has been handed over to a secure data channel, sent
440
436
and received 'close' messages SHALL trigger closing the underlying data
441
437
channel used for signalling. The user application MAY continue using the
442
- ` RTCPeerConnection ` instance and its data channels. However, wrapped
438
+ ` RTCPeerConnection ` instance and its data channels. However, secure
443
439
data channels MAY or MAY NOT be available once the signalling's data
444
440
channel has been closed, depending on the flexibility of the client's
445
441
implementation.
0 commit comments