The SILC Project

source navigation ]
identifier search ]
freetext search ]
file search ]

silc/doc/draft-riikonen-silc-pp-09.nroff

  1 .pl 10.0i
  2 .po 0
  3 .ll 7.2i
  4 .lt 7.2i
  5 .nr LL 7.2i
  6 .nr LT 7.2i
  7 .ds LF Riikonen
  8 .ds RF FORMFEED[Page %]
  9 .ds CF
 10 .ds LH Internet Draft
 11 .ds RH 15 January 2007
 12 .ds CH
 13 .na
 14 .hy 0
 15 .in 0
 16 .nf
 17 Network Working Group                                        P. Riikonen
 18 Internet-Draft
 19 draft-riikonen-silc-pp-09.txt                            15 January 2007
 20 Expires: 15 July 2007
 21 
 22 .in 3
 23 
 24 .ce 2
 25 SILC Packet Protocol
 26 <draft-riikonen-silc-pp-09.txt>
 27 
 28 .ti 0
 29 Status of this Draft
 30 
 31 By submitting this Internet-Draft, each author represents that any
 32 applicable patent or other IPR claims of which he or she is aware
 33 have been or will be disclosed, and any of which he or she becomes
 34 aware will be disclosed, in accordance with Section 6 of BCP 79.
 35 
 36 Internet-Drafts are working documents of the Internet Engineering
 37 Task Force (IETF), its areas, and its working groups. Note that
 38 other groups may also distribute working documents as Internet-
 39 Drafts. Internet-Drafts are draft documents valid for a maximum of
 40 six months and may be updated, replaced, or obsoleted by other
 41 documents at any time. It is inappropriate to use Internet-Drafts as
 42 reference material or to cite them other than as "work in progress".
 43 
 44 The list of current Internet-Drafts can be accessed at
 45 http://www.ietf.org/1id-abstracts.html
 46 The list of Internet-Draft Shadow Directories can be accessed at
 47 http://www.ietf.org/shadow.html.
 48 
 49 
 50 
 51 .ti 0
 52 Abstract
 53 
 54 This memo describes a Packet Protocol used in the Secure Internet Live
 55 Conferencing (SILC) protocol, specified in the Secure Internet Live
 56 Conferencing, Protocol Specification [SILC1].  This protocol describes
 57 the packet types and packet payloads which defines the contents of the
 58 packets.  The protocol provides secure binary packet protocol that
 59 assures that the contents of the packets are secured and authenticated.
 60 
 61 
 62 
 63 
 64 
 65 
 66 
 67 
 68 
 69 .ti 0
 70 Table of Contents
 71 
 72 .nf
 73 1 Introduction ..................................................  3
 74   1.1 Requirements Terminology ..................................  4
 75 2 SILC Packet Protocol ..........................................  4
 76   2.1 SILC Packet ...............................................  4
 77   2.2 SILC Packet Header ........................................  5
 78   2.3 SILC Packet Types .........................................  8
 79       2.3.1 SILC Packet Payloads ................................ 15
 80       2.3.2 Generic payloads .................................... 16
 81             2.3.2.1 ID Payload .................................. 16
 82             2.3.2.2 Argument Payload ............................ 17
 83             2.3.2.3 Argument List Payload ....................... 17
 84             2.3.2.4 Channel Payload ............................. 18
 85             2.3.2.5 Public Key Payload .......................... 19
 86             2.3.2.6 Message Payload ............................. 20
 87       2.3.3 Disconnect Payload .................................. 23
 88       2.3.4 Success Payload ..................................... 24
 89       2.3.5 Failure Payload ..................................... 25
 90       2.3.6 Reject Payload ...................................... 25
 91       2.3.7 Notify Payload ...................................... 26
 92       2.3.8 Error Payload ....................................... 35
 93       2.3.9 Channel Message Payload ............................. 35
 94       2.3.10 Channel Key Payload ................................ 36
 95       2.3.11 Private Message Payload ............................ 38
 96       2.3.12 Private Message Key Payload ........................ 38
 97       2.3.13 Command Payload .................................... 40
 98       2.3.14 Command Reply Payload .............................. 41
 99       2.3.15 Connection Auth Request Payload .................... 41
100       2.3.16 New ID Payload ..................................... 42
101       2.3.17 New Client Payload ................................. 43
102       2.3.18 New Server Payload ................................. 44
103       2.3.19 New Channel Payload ................................ 45
104       2.3.20 Key Agreement Payload .............................. 45
105       2.3.21 Resume Router Payload .............................. 47
106       2.3.22 File Transfer Payload .............................. 47
107       2.3.23 Resume Client Payload .............................. 48
108       2.3.24 Acknowledgement Payload ............................ 50
109   2.4 SILC ID Types ............................................. 50
110   2.5 Packet Encryption And Decryption .......................... 51
111       2.5.1 Normal Packet Encryption And Decryption ............. 51
112       2.5.2 Channel Message Encryption And Decryption ........... 52
113       2.5.3 Private Message Encryption And Decryption ........... 53
114   2.6 Packet MAC Generation ..................................... 53
115   2.7 Packet Padding Generation ................................. 54
116   2.8 Packet Compression ........................................ 54
117   2.9 Packet Sending ............................................ 55
118   2.10 Packet Reception ......................................... 55
119   2.11 Packet Routing ........................................... 55
120   2.12 Packet Broadcasting ...................................... 57
121 3 Security Considerations ....................................... 57
122 4 References .................................................... 57
123 5 Author's Address .............................................. 59
124 6 Full Copyright Statement ...................................... 59
125 
126 .ti 0
127 List of Figures
128 
129 .nf
130 Figure 1:   Typical SILC Packet
131 Figure 2:   SILC Packet Header
132 Figure 3:   ID Payload
133 Figure 4:   Argument Payload
134 Figure 5:   Argument List Payload
135 Figure 6:   Channel Payload
136 Figure 7:   Public Key Payload
137 Figure 8:   Message Payload
138 Figure 9:   Disconnect Payload
139 Figure 10:  Success Payload
140 Figure 11:  Failure Payload
141 Figure 12:  Reject Payload
142 Figure 13:  Notify Payload
143 Figure 14:  Error Payload
144 Figure 15:  Channel Key Payload
145 Figure 16:  Private Message Key Payload
146 Figure 17:  Command Payload
147 Figure 18:  Connection Auth Request Payload
148 Figure 19:  New Client Payload
149 Figure 20:  New Server Payload
150 Figure 21:  Key Agreement Payload
151 Figure 22:  Resume Router Payload
152 Figure 23:  File Transfer Payload
153 Figure 24:  Resume Client Payload
154 
155 
156 .ti 0
157 1. Introduction
158 
159 This document describes a Packet Protocol used in the Secure Internet
160 Live Conferencing (SILC) protocol specified in the Secure Internet Live
161 Conferencing, Protocol Specification [SILC1].  This protocol describes
162 the packet types and packet payloads which defines the contents of the
163 packets.  The protocol provides secure binary packet protocol that
164 assures that the contents of the packets are secured and authenticated.
165 The packet protocol is designed to be compact to avoid unnecessary
166 overhead as much as possible.  This makes the SILC suitable also in
167 environment of low bandwidth requirements such as mobile networks.  All
168 packet payloads can also be compressed to further reduce the size of
169 the packets.
170 
171 All packets in SILC network are always encrypted and their integrity
172 is assured by computed MACs.  The protocol defines several packet types
173 and packet payloads.  Each packet type usually has a specific packet
174 payload that actually defines the contents of the packet.  Each packet
175 also includes a default SILC Packet Header that provides sufficient
176 information about the origin and the destination of the packet.
177 
178 
179 .ti 0
180 1.1 Requirements Terminology
181 
182 The keywords MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED,
183 MAY, and OPTIONAL, when they appear in this document, are to be
184 interpreted as described in [RFC2119].
185 
186 
187 .ti 0
188 2 SILC Packet Protocol
189 
190 .ti 0
191 2.1 SILC Packet
192 
193 SILC packets deliver messages from sender to receiver securely by
194 encrypting important fields of the packet.  The packet consists of
195 default SILC Packet Header, Padding, Packet Payload data, and, packet
196 MAC.
197 
198 The following diagram illustrates typical SILC packet.
199 
200 .in 5
201 .nf
202  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
203 |   n bytes   | 1 - n bytes |      n bytes       |  n bytes
204 | SILC Header |   Padding   |    Data Payload    |    MAC
205  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
206 .in 3
207 
208 .ce
209 Figure 1:  Typical SILC Packet
210 
211 
212 SILC Header is always the first part of the packet and its purpose
213 is to provide information about the packet.  It provides for example
214 the packet type, origin of the packet and the destination of the packet.
215 The header is variable in length.  See the following section for
216 description of SILC Packet header.  Packets without SILC header or
217 with malformed SILC header MUST be dropped.
218 
219 Padding follows the packet header.  The purpose of the padding is to
220 make the packet multiple by eight (8) or by the block size of the
221 cipher used in the encryption, which ever is larger.  The maximum
222 length of padding is currently 128 bytes.  The padding is always
223 encrypted.  The padding is applied always, even if the packet is
224 not encrypted.  See the section 2.7 Padding Generation for more
225 detailed information.
226 
227 Data payload area follows padding and it is the actual data of the
228 packet.  The packet data is the packet payloads defined in this
229 protocol.  The data payload area is always encrypted.
230 
231 The last part of SILC packet is the packet MAC that assures the
232 integrity of the packet.  See the section 2.6 Packet MAC Generation
233 for more information.  If compression is used the compression is
234 always applied before encryption.
235 
236 All fields in all packet payloads are always in MSB (most significant
237 byte first) order.
238 
239 
240 .ti 0
241 2.2 SILC Packet Header
242 
243 The SILC packet header is applied to all SILC packets and it is
244 variable in length.  The purpose of SILC Packet header is to provide
245 detailed information about the packet.  The receiver of the packet
246 uses the packet header to parse the packet and gain other relevant
247 parameters of the packet.
248 
249 The following diagram represents the SILC packet header.
250 
251 .in 5
252 .nf
253                      1                   2                   3
254  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
256 |         Payload Length        |     Flags     |  Packet Type  |
257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
258 |   Pad Length  |    RESERVED   | Source ID Len |  Dest ID Len  |
259 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
260 |  Src ID Type  |                                               |
261 +-+-+-+-+-+-+-+-+                                               +
262 |                                                               |
263 ~                           Source ID                           ~
264 |                                                               |
265 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
266 |  Dst ID Type  |                                               |
267 +-+-+-+-+-+-+-+-+                                               +
268 |                                                               |
269 ~                         Destination ID                        ~
270 |                                                               |
271 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
272 .in 3
273 
274 .ce
275 Figure 2:  SILC Packet Header
276 
277 .in 6
278 o Payload Length (2 bytes) - Indicates the length of the
279   packet not including the padding of the packet.
280 
281 o Flags (1 byte) - Indicates flags to be used in packet
282   processing.  Several flags may be set by ORing the flags
283   together.
284 
285   The following flags are reserved for this field:
286 
287 
288      No flags                  0x00
289 
290        In this case the field is ignored.
291 
292 
293      Private Message Key       0x01
294 
295        Indicates that the packet data MUST include private
296        message that is encrypted using private key set by
297        client.  Servers does not know this key and cannot
298        decrypt the payload, but simply passes it along.  See
299        section 2.5.3 Private Message Encryption And Decryption
300        for more information.
301 
302 
303      List                      0x02
304 
305        Indicates that the packet consists of list of
306        packet payloads indicated by the Packet Type field.
307        The payloads are added one after the other.  Note that
308        there are packet types that must not be used as
309        list.  Parsing of list packet is done by calculating
310        the length of each payload and parsing them one by
311        one.
312 
313 
314      Broadcast                 0x04
315 
316        Marks the packet to be broadcasted.  Client and normal
317        server cannot send broadcast packets.  Only router server
318        may send broadcast packet.  The router receiving of packet
319        with this flag set MUST send (broadcast) the packet to
320        its primary route.  If router has several router connections
321        the packet may be sent only to the primary route.  See
322        section 2.12 Packet Broadcasting for description of
323        packet broadcasting.
324 
325 
326      Compressed                0x08
327 
328        Marks that the payload of the packet is compressed.
329        The sender of the packet marks this flag when it
330        compresses the payload, and any server or router
331        en route to the recipient MUST NOT unset this flag.
332        See section 2.8 Packet Compression for description of
333        packet compressing.
334 
335 
336      Acknowledgement           0x10
337 
338        Marks that the packet needs to be acknowledged by the
339        recipient.  The ACK packet MUST NOT have this flag set.
340        The acknowledgement packet is SILC_PACKET_ACK packet.
341        If the packet is not acknowledged the packet may be
342        retransmitted.  This flag is especially useful when
343        using UDP/IP and SHOULD NOT be used with TCP/IP.  The
344        flag MUST NOT be used with message packets.  The
345        SILC_MESSAGE_FLAG_ACK can be used instead.  Broadcast
346        packets MUST NOT set this flag.  Retransmission
347        may use for example exponential backoff algorithm.
348 
349 .in 3
350 
351 o Packet Type (1 byte) - Indicates the type of the packet.
352   Receiver uses this field to parse the packet.  See section
353   2.3 SILC Packets for list of defined packet types.
354 
355 o Pad Length (1 byte) - Indicates the length of the padding
356   applied after the SILC Packet header.  Maximum length for
357   padding is 128 bytes.
358 
359 o RESERVED (1 byte) - Reserved field and must include a
360   zero (0) value.
361 
362 o Source ID Length (1 byte) - Indicates the length of the
363   Source ID field in the header, not including this or any
364   other fields.
365 
366 o Destination ID Length (1 byte) - Indicates the length of the
367   Destination ID field in the header, not including this or
368   any other fields.
369 
370 o Src ID Type (1 byte) - Indicates the type of ID in the
371   Source ID field.  See section 2.4 SILC ID Types for
372   defined ID types.
373 
374 o Source ID (variable length) - The actual source ID that
375   indicates which is the original sender of the packet.
376 
377 o Dst ID Type (1 byte) - Indicates the type of ID in the
378   Destination ID field.  See section 2.4 SILC ID Types for
379   defined ID types.
380 
381 o Destination ID (variable length) - The actual destination
382   ID that indicates which is the end receiver of the packet.
383 
384 
385 
386 .ti 0
387 2.3 SILC Packet Types
388 
389 SILC packet types defines the contents of the packet and it is used by
390 the receiver to parse the packet.  The packet type is 8 bits in length.
391 The range for the packet types are from 0 - 255, where 0 is never sent and
392 255 is currently reserved for future extensions and MUST NOT be defined to
393 any other purpose.  Every SILC specification compliant implementation
394 SHOULD support all the following packet types.
395 
396 The below list of the SILC Packet types includes reference to the packet
397 payload as well.  Packet payloads are the actual packet data area.  Each
398 packet type defines packet payload which usually may only be sent with
399 the specific packet type.
400 
401 Most of the packets are packets that must be destined directly to entity
402 that is connected to the sender.  It is not allowed, for example, for a
403 router to send SILC_PACKET_DISCONNECT packet to client that is not
404 directly connected to the router.  However, there are some special packet
405 types that may be destined to some entity that the sender does not have
406 direct connection with.  These packets are for example private message
407 packets, channel message packets, command packets and some other packets
408 that may be broadcasted in the SILC network.  The following packet
409 desription list will define it separately if a packet is allowed to be
410 sent to indirectly connected entity.  Other packets MUST NOT be sent or
411 accepted, if sent, to indirectly connected entities.
412 
413 Some packets MAY be sent as lists by adding the List flag to the Packet
414 Header and constructing multiple packet payloads one after the other.
415 When this is allowed it is separately defined in the following list.
416 Other packets MUST NOT be sent as list and the List flag MUST NOT be set.
417 
418 
419 List of SILC Packet types are defined as follows.
420 
421 .in 1
422      0    SILC_PACKET_NONE
423 
424           This type is reserved and it is never sent.
425 
426 
427      1    SILC_PACKET_DISCONNECT
428 
429           This packet is sent to disconnect the remote end.  Reason of
430           the disconnection is sent inside the packet payload.
431 
432           Payload of the packet:  See section 2.3.3 Disconnect Payload
433 
434 
435      2    SILC_PACKET_SUCCESS
436 
437           This packet is sent upon successful execution of a protocol.
438           The status of the success is sent in the packet payload.
439 
440           Payload of the packet:  See section 2.3.4 Success Payload
441 
442 
443      3    SILC_PACKET_FAILURE
444 
445           This packet is sent upon failure of a protocol.  The status
446           of the failure is sent in the packet payload.
447 
448           Payload of the packet:  See section 2.3.5 Failure Payload
449 
450 
451      4    SILC_PACKET_REJECT
452 
453           This packet MAY be sent upon rejection of a protocol.  The
454           status of the rejection is sent in the packet payload.
455 
456           Payload of the packet:  See section 2.3.6 Reject Payload
457 
458 
459      5    SILC_PACKET_NOTIFY
460 
461           This packet is used to send notify message.  The packet is
462           usually sent between server and client, but also between
463           server and router.  Client MUST NOT send this packet.  Server
464           MAY destine this packet to channel as well when the packet is
465           distributed to all clients on the channel.  This packet MAY
466           be sent as list.
467 
468           Payload of the packet:  See section 2.3.7 Notify Payload.
469 
470 
471      6    SILC_PACKET_ERROR
472 
473           This packet is sent when an error occurs.  Server MAY
474           send this packet.  Client MUST NOT send this packet.  The
475           client MAY entirely ignore the packet, however, server is
476           most likely to take action anyway.  This packet MAY be sent
477           to entity that is indirectly connected to the sender.
478 
479           Payload of the packet:  See section 2.3.8 Error Payload.
480 
481 
482      7    SILC_PACKET_CHANNEL_MESSAGE
483 
484           This packet is used to send messages to channels.  The packet
485           includes Channel ID of the channel and the actual message to
486           the channel.  Messages sent to the channel are always protected
487           by channel specific keys.  This packet MAY be sent to entity
488           that is indirectly connected to the sender.
489 
490           Payload of the packet:  See section 2.3.9 Channel Message
491                                   Payload
492 
493 
494      8    SILC_PACKET_CHANNEL_KEY
495 
496           This packet is used to distribute new key for particular
497           channel when server generates it.  Each channel has their own
498           independent keys that is used to protect the traffic on the
499           channel.  It is also possible to use channel private keys that
500           are not server generated.  In this case this packet is not used.
501           Client MUST NOT send this packet.  This packet MAY be sent to
502           entity that is indirectly connected to the sender.
503 
504           Payload of the packet:  See section 2.3.10 Channel Key Payload
505 
506 
507      9    SILC_PACKET_PRIVATE_MESSAGE
508 
509           This packet is used to send private messages from client
510           to another client.  By default, private messages are protected
511           by session keys established by normal key exchange protocol.
512           However, it is possible to use specific key to protect private
513           messages.  See [SILC1] for private message key generation.
514           This packet MAY be sent to entity that is indirectly connected
515           to the sender.
516 
517           Payload of the packet:  See section 2.3.11 Private Message
518                                   Payload
519 
520 
521      10   SILC_PACKET_PRIVATE_MESSAGE_KEY
522 
523           This packet is OPTIONAL and sender of the packet can indicate
524           that a private message key should be used in private message
525           communication.  The actual key material is not sent in this
526           packet but must be either static or pre-shared key.  The
527           receiver of the packet is considered to be the responder
528           when processing the static or pre-shared key material as
529           defined in [SILC1] and [SILC3] for private message keys.
530           This packet MAY be sent to entity that is indirectly connected
531           to the sender.
532 
533           Payload of the packet:  See section 2.3.12 Private Message
534                                   Key Payload
535 
536 
537      11   SILC_PACKET_COMMAND
538 
539           This packet is used to send commands from client to server.
540           Server MAY send this packet to other servers as well.  All
541           commands are listed in their own section SILC Command Types
542           in [SILC4].  The contents of this packet is command specific.
543           This packet MAY be sent to entity that is indirectly connected
544           to the sender.
545 
546           Payload of the packet:  See section 2.3.13 Command Payload
547 
548 
549      12   SILC_PACKET_COMMAND_REPLY
550 
551           This packet is sent as reply to the SILC_PACKET_COMMAND packet.
552           The contents of this packet is command specific.  This packet
553           MAY be sent to entity that is indirectly connected to the
554           sender.  This packet MAY be sent as list.
555 
556           Payload of the packet:  See section 2.3.14 Command Reply
557                                   Payload and section 2.3.13 Command
558                                   Payload
559 
560 
561      13   SILC_PACKET_KEY_EXCHANGE
562 
563           This packet is used to start SILC Key Exchange Protocol,
564           described in detail in [SILC3].
565 
566           Payload of the packet:  Payload of this packet is described
567                                   in the section SILC Key Exchange
568                                   Protocol and its sub sections in
569                                   [SILC3].
570 
571 
572      14   SILC_PACKET_KEY_EXCHANGE_1
573 
574           This packet is used as part of the SILC Key Exchange Protocol.
575 
576           Payload of the packet:  Payload of this packet is described
577                                   in the section SILC Key Exchange
578                                   Protocol and its sub sections in
579                                   [SILC3].
580 
581 
582      15   SILC_PACKET_KEY_EXCHANGE_2
583 
584           This packet is used as part of the SILC Key Exchange Protocol.
585 
586           Payload of the packet:  Payload of this packet is described
587                                   in the section SILC Key Exchange
588                                   Protocol and its sub sections in
589                                   [SILC3].
590 
591 
592      16   SILC_PACKET_CONNECTION_AUTH_REQUEST
593 
594           This packet is used to request an authentication method to
595           be used in the SILC Connection Authentication Protocol.  If
596           initiator of the protocol does not know the mandatory
597           authentication method this packet MAY be used to determine it.
598           The party receiving this payload SHOULD respond with the same
599           packet including the mandatory authentication method.
600 
601           Payload of the packet:  See section 2.3.15 Connection Auth
602                                   Request Payload
603 
604 
605      17   SILC_PACKET_CONNECTION_AUTH
606 
607           This packet is used to start and perform the SILC Connection
608           Authentication Protocol.  This protocol is used to authenticate
609           the connecting party.  The protocol is described in detail in
610           [SILC3].
611 
612           Payload of the packet:  Payload of this packet is described
613                                   in the section SILC Authentication
614                                   Protocol and it sub sections in [SILC].
615 
616 
617      18   SILC_PACKET_NEW_ID
618 
619           This packet is used to distribute new IDs from server to
620           router and from router to all other routers in SILC network.
621           This is used when for example new client is registered to
622           SILC network.  The newly created IDs of these operations are
623           distributed by this packet.  Only server may send this packet,
624           however, client MUST be able to receive this packet.  This
625           packet MAY be sent to entity that is indirectly connected
626           to the sender.  This packet MAY be sent as list.
627 
628           Payload of the packet:  See section 2.3.16 New ID Payload
629 
630 
631      19   SILC_PACKET_NEW_CLIENT
632 
633           This packet is used by client to register itself to the
634           SILC network.  This is sent after key exchange and
635           authentication protocols has been completed.  Client sends
636           various information about itself in this packet to the server.
637 
638           Payload of the packet:  See section 2.3.17 New Client Payload
639 
640 
641      20   SILC_PACKET_NEW_SERVER
642 
643           This packet is used by server to register itself to the
644           SILC network.  This is sent after key exchange and
645           authentication protocols has been completed.  Server sends
646           this to the router it connected to, or, if router was
647           connecting, to the connected router.  Server sends its
648           Server ID and other information in this packet.  The client
649           MUST NOT send or receive this packet.
650 
651           Payload of the packet:  See section 2.3.18 New Server Payload
652 
653 
654      21   SILC_PACKET_NEW_CHANNEL
655 
656           This packet is used to notify routers about newly created
657           channel.  Channels are always created by the router and it MUST
658           notify other routers about the created channel.  Router sends
659           this packet to its primary route.  Client MUST NOT send this
660           packet.  This packet MAY be sent to entity that is indirectly
661           connected to the sender.  This packet MAY be sent as list.
662 
663           Payload of the packet:  See section 2.3.19 New Channel Payload
664 
665 
666      22   SILC_PACKET_REKEY
667 
668           This packet is used to indicate that re-key must be performed
669           for session keys.  See section Session Key Regeneration in
670           [SILC1] for more information.  This packet does not have
671           a payload.
672 
673 
674      23   SILC_PACKET_REKEY_DONE
675 
676           This packet is used to indicate that re-key is performed and
677           new keys must be used hereafter.  This packet does not have a
678           payload.
679 
680 
681      24   SILC_PACKET_HEARTBEAT
682 
683           This packet is used by clients, servers and routers to keep the
684           connection alive.  It is RECOMMENDED that all servers implement
685           keepalive actions and perform it to both direction in a link.
686           This packet does not have a payload.
687 
688 
689      25   SILC_PACKET_KEY_AGREEMENT
690 
691           This packet is used by clients to request key negotiation
692           between another client in the SILC network.  If the negotiation
693           is started it is performed using the SKE protocol.  The result of
694           the negotiation, the secret key material, can be used for
695           example as private message key.  The server and router MUST NOT
696           send this packet.
697 
698           Payload of the packet:  See section 2.3.20 Key Agreement Payload
699 
700 
701      26   SILC_PACKET_RESUME_ROUTER
702 
703           This packet is used during backup router protocol when the
704           original primary router of the cell comes back online and wishes
705           to resume the position as being the primary router of the cell.
706 
707           Payload of the packet:  See section 2.3.21 Resume Router Payload
708 
709 
710      27   SILC_PACKET_FTP
711 
712           This packet is used to perform an file transfer protocol in the
713           SILC session with some entity in the network.  The packet is
714           multi purpose.  The packet is used to tell other entity in the
715           network that the sender wishes to perform an file transfer
716           protocol.  The packet is also used to actually tunnel the
717           file transfer protocol stream.  The file transfer protocol
718           stream is always protected with the SILC binary packet protocol.
719 
720           Payload of the packet:  See section 2.3.22 File Transfer Payload
721 
722 
723      28   SILC_PACKET_RESUME_CLIENT
724 
725           This packet is used to resume a client back to the network
726           after it has been detached.  A client is able to detach from
727           the network but the client is still valid client in the network.
728           The client may then later resume its session back by sending
729           this packet to a server.  Routers also use this packet to notify
730           other routers in the network that the detached client has resumed.
731 
732           Payload of the packet:  See section 2.3.23 Resume Client Payload
733 
734 
735      29   SILC_PACKET_ACK
736 
737           This packet is used to acknowledge a packet that had the
738           Acknowledgement packet flag set.
739 
740           Payload of the packet:  See section 2.3.24 Acknowledgement
741           Payload
742 
743 
744      30 - 199
745 
746           Currently undefined commands.
747 
748 
749      200 - 254
750 
751           These packet types are reserved for private use and they will
752           not be defined by this document.
753 
754 
755      255  SILC_PACKET_MAX
756 
757           This type is reserved for future extensions and currently it
758           MUST NOT be sent.
759 .in 3
760 
761 
762 .ti 0
763 2.3.1 SILC Packet Payloads
764 
765 All payloads resides in the main data area of the SILC packet.  However
766 all payloads MUST be at the start of the data area after the SILC
767 packet header and padding.  All fields in the packet payload are always
768 encrypted, as they reside in the data area of the packet which is
769 always encrypted.  Most of the payloads may only be sent with specific
770 packet type which is defined in the description of the payload.
771 
772 There are some other payloads in SILC as well.  However, they are not
773 common in the sense that they could be sent at any time.  These payloads
774 are not described in this section.  These are payloads such as SILC
775 Key Exchange payloads and so on.  These are described in [SILC1],
776 [SILC3] and [SILC4].
777 
778 
779 .ti 0
780 2.3.2 Generic payloads
781 
782 This section describes generic payloads that are not associated to any
783 specific packet type.  They can be used for example inside some other
784 packet payload.
785 
786 
787 .ti 0
788 2.3.2.1 ID Payload
789 
790 This payload can be used to send an ID.  ID's are variable in length
791 thus this payload provides a way to send variable length ID.
792 
793 The following diagram represents the ID Payload.
794 
795 .in 5
796 .nf
797                      1                   2                   3
798  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
799 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
800 |             ID Type           |           ID Length           |
801 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
802 |                                                               |
803 ~                           ID Data                             ~
804 |                                                               |
805 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
806 .in 3
807 
808 .ce
809 Figure 3:  ID Payload
810 
811 
812 .in 6
813 o ID Type (2 bytes) - Indicates the type of the ID.  See
814   section 2.4 SILC ID Types for list of defined ID types.
815 
816 o ID Length (2 bytes) - Length of the ID Data area not
817   including the length of any other fields in the payload.
818 
819 o ID Data (variable length) - The actual ID data.  The encoding
820   of the ID data is defined in section 2.4 SILC ID Types.
821 .in 3
822 
823 
824 .ti 0
825 2.3.2.2 Argument Payload
826 
827 Argument Payload is used to set arguments for any packet payload that
828 need and support arguments, such as commands.  Number of arguments
829 associated with a packet MUST be indicated by the packet payload which
830 need the arguments.  Argument Payloads MUST always reside right after
831 the packet payload needing the arguments.  Incorrect amount of argument
832 payloads MUST cause rejection of the packet.
833 
834 The following diagram represents the Argument Payload.
835 
836 .in 5
837 .nf
838                      1                   2                   3
839  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
840 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
841 |          Data Length          | Argument Type |               |
842 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
843 |                                                               |
844 ~                        Argument Data                          ~
845 |                                                               |
846 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
847 .in 3
848 
849 .ce
850 Figure 4:  Argument Payload
851 
852 
853 .in 6
854 o Data Length (2 bytes) - Length of the Argument Data field
855   not including the length of any other field in the payload.
856 
857 o Argument Type (1 byte) - Indicates the type of the argument.
858   Every argument can have a specific type that are defined
859   by the packet payload needing the argument.  For example
860   every command specify a number for each argument that may be
861   associated with the command.  By using this number the receiver
862   of the packet knows what type of argument this is.  If there is
863   no specific argument type this field is set to zero (0) value.
864 
865 o Argument Data (variable length) - Argument data.
866 .in 3
867 
868 
869 .ti 0
870 2.3.2.3 Argument List Payload
871 
872 Argument List Payload is a list of Argument Payloads appended one
873 after the other.  The number of arguments is indicated in the
874 payload.
875 
876 The following diagram represents the Argument List Payload.
877 
878 .in 5
879 .nf
880                      1                   2                   3
881  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
882 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
883 |         Argument Nums         |                               |
884 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
885 |                                                               |
886 ~                        Argument Payloads                      ~
887 |                                                               |
888 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
889 .in 3
890 
891 .ce
892 Figure 5:  Argument List Payload
893 
894 
895 .in 6
896 o Argument Nums (2 bytes) - Indicates the number of Argument
897   Payloads.  If zero (0) value is found in this field no
898   arguments are present.
899 
900 o Argument Payloads (variable length) - The Argument Payloads
901   appended one after the other.  The payloads can be decoded
902   since the length of the payload is indicated in each of
903   the Argument Payload.
904 .in 3
905 
906 
907 
908 
909 
910 .ti 0
911 2.3.2.4 Channel Payload
912 
913 Generic Channel Payload may be used to send information about a channel,
914 its name, the Channel ID and a mode.
915 
916 The following diagram represents the Channel Payload.
917 
918 
919 .in 5
920 .nf
921                      1                   2                   3
922  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
923 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
924 |      Channel Name Length      |                               |
925 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
926 |                                                               |
927 ~                         Channel Name                          ~
928 |                                                               |
929 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
930 |       Channel ID Length       |                               |
931 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
932 |                                                               |
933 ~                          Channel ID                           ~
934 |                                                               |
935 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
936 |                           Mode Mask                           |
937 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
938 .in 3
939 
940 .ce
941 Figure 6:  New Channel Payload
942 
943 
944 .in 6
945 o Channel Name Length (2 bytes) - Length of the Channel Name
946   field.
947 
948 o Channel Name (variable length) - The name of the channel.
949 
950 o Channel ID Length (2 bytes) - Length of the Channel ID field.
951 
952 o Channel ID (variable length) - The encoded Channel ID.
953 
954 o Mode Mask (4 bytes) - A mode.  This can be the mode of the
955   channel but it can also be the mode of a client on the
956   channel.  The contents of this field is dependent of the
957   usage of this payload.  The usage is defined separately
958   when this payload is used.  This is a 32 bit MSB first value.
959 .in 3
960 
961 
962 
963 
964 
965 
966 .ti 0
967 2.3.2.5 Public Key Payload
968 
969 Generic Public Key Payload may be used to send different type of
970 public keys and certificates.
971 
972 The following diagram represents the Public Key Payload.
973 
974 .in 5
975 .nf
976                      1                   2                   3
977  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
978 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
979 |       Public Key Length       |        Public Key Type        |
980 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
981 |                                                               |
982 ~                  Public Key (or certificate)                  ~
983 |                                                               |
984 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
985 .in 3
986 
987 .ce
988 Figure 7:  Public Key Payload
989 
990 
991 .in 6
992 o Public Key Length (2 bytes) - The length of the Public Key
993   (or certificate) field, not including any other field.
994 
995 o Public Key Type (2 bytes) - The public key (or certificate)
996   type.  This field indicates the type of the public key in
997   the packet.  See the [SILC3] for defined public key types.
998 
999 o Public Key (or certificate) (variable length) - The
1000   encoded public key or certificate data.
1001 .in 3
1002 
1003 
1004 .ti 0
1005 2.3.2.6 Message Payload
1006 
1007 Generic Message Payload can be used to send messages in SILC.  It
1008 is used to send channel messages and private messages.
1009 
1010 The following diagram represents the Message Payload.
1011 
1012 (*) indicates that the field is not encrypted.
1013 
1014 
1015 
1016 
1017 
1018 
1019 
1020 
1021 
1022 .in 5
1023 .nf
1024                      1                   2                   3
1025  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
1026 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1027 |        Message  Flags         |         Message Length        |
1028 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1029 |                                                               |
1030 ~                         Message Data                          ~
1031 |                                                               |
1032 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1033 |        Padding Length         |                               |
1034 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1035 |                                                               |
1036 ~                            Padding                            ~
1037 |                                                               |
1038 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1039 |                                                               |
1040 ~                    Initialization Vector *                    ~
1041 |                                                               |
1042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1043 |                                                               |
1044 ~                              MAC *                            ~
1045 |                                                               |
1046 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1047 .in 3
1048 
1049 .ce
1050 Figure 8:  Message Payload
1051 
1052 
1053 .in 6
1054 o Message Flags (2 bytes) - Includes the Message Flags of the
1055   message.  The flags can indicate a reason or a purpose for
1056   the message.  The following Message Flags are defined:
1057 
1058   0x0000  SILC_MESSAGE_FLAG_NONE
1059 
1060           No specific flags set.
1061 
1062   0x0001  SILC_MESSAGE_FLAG_AUTOREPLY
1063 
1064           This message is an automatic reply to an earlier
1065           received message.
1066 
1067   0x0002  SILC_MESSAGE_FLAG_NOREPLY
1068 
1069           There should not be reply messages to this
1070           message.
1071 
1072   0x0004  SILC_MESSAGE_FLAG_ACTION
1073 
1074           The sender is performing an action and the message
1075           is the indication of the action.
1076 
1077   0x0008  SILC_MESSAGE_FLAG_NOTICE
1078 
1079           The message is for example an informational notice
1080           type message.
1081 
1082   0x0010  SILC_MESSAGE_FLAG_REQUEST
1083 
1084           This is a generic request flag to send request
1085           messages.  A separate document should define any
1086           payloads associated to this flag.
1087 
1088   0x0020  SILC_MESSAGE_FLAG_SIGNED
1089 
1090           This flag indicates that the message is signed
1091           with sender's private key and thus can be verified
1092           by the receiver using the sender's public key.  A
1093           separate document should define the detailed procedure
1094           of the signing process and any associated payloads
1095           for this flag.
1096 
1097   0x0040  SILC_MESSAGE_FLAG_REPLY
1098 
1099           This is a generic reply flag to send a reply to
1100           previously received request.  A separate document
1101           should define any payloads associated to this flag.
1102 
1103   0x0080  SILC_MESSAGE_FLAG_DATA
1104 
1105           This is a generic data flag, indicating that the
1106           message includes some data which can be interpreted
1107           in a specific way.  Using this flag any kind of data
1108           can be delivered inside message payload.  A separate
1109           document should define how this flag is interpreted
1110           and define any associated payloads.
1111 
1112   0x0100  SILC_MESSAGE_FLAG_UTF8
1113 
1114           This flag indicates that the message is UTF-8 encoded
1115           textual message.  When sending text messages in SILC
1116           this flag SHOULD be used.  When this flag is used the
1117           text sent as message MUST be UTF-8 encoded.
1118 
1119   0x0200  SILC_MESSAGE_FLAG_ACK
1120 
1121           This flag indicates the sender requires the recpipient
1122           to acknowledge the received message.  This same flag
1123           is used in the acknowledgement.  A separate document
1124           should define how the acknowledgement is performed.
1125 
1126   0x0400 - 0x1000 RESERVED
1127 
1128           Reserved for future flags.
1129 
1130   0x2000 - 0x8000 PRIVATE RANGE
1131 
1132           Private range for free use.
1133 
1134 o Message Length (2 bytes) - Indicates the length of the
1135   Message Data field in the payload, not including any
1136   other field.
1137 
1138 o Message Data (variable length) - The actual message data.