Started implementing protocol version 1.1 and narrowing down
[silc.git] / doc / draft-riikonen-silc-spec-05.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 XXX
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-spec-05.txt                        XXX
20 Expires: XXX
21
22 .in 3
23
24 .ce 3
25 Secure Internet Live Conferencing (SILC),
26 Protocol Specification
27 <draft-riikonen-silc-spec-05.txt>
28
29 .ti 0
30 Status of this Memo
31
32 This document is an Internet-Draft and is in full conformance with   
33 all provisions of Section 10 of RFC 2026.  Internet-Drafts are   
34 working documents of the Internet Engineering Task Force (IETF), its   
35 areas, and its working groups.  Note that other groups may also   
36 distribute working documents as Internet-Drafts.   
37
38 Internet-Drafts are draft documents valid for a maximum of six months   
39 and may be updated, replaced, or obsoleted by other documents at any   
40 time.  It is inappropriate to use Internet-Drafts as reference   
41 material or to cite them other than as "work in progress."   
42
43 The list of current Internet-Drafts can be accessed at   
44 http://www.ietf.org/ietf/1id-abstracts.txt   
45
46 The list of Internet-Draft Shadow Directories can be accessed at   
47 http://www.ietf.org/shadow.html   
48
49 The distribution of this memo is unlimited.  
50
51
52 .ti 0
53 Abstract
54
55 This memo describes a Secure Internet Live Conferencing (SILC)
56 protocol which provides secure conferencing services over insecure
57 network channel.  SILC is IRC [IRC] like protocol, however, it is 
58 not equivalent to IRC and does not support IRC.  Strong cryptographic
59 methods are used to protect SILC packets inside the SILC network.
60 Three other Internet Drafts relates very closely to this memo;
61 SILC Packet Protocol [SILC2], SILC Key Exchange and Authentication
62 Protocols [SILC3] and SILC Commands [SILC4].
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 Concepts .................................................  4
76   2.1 SILC Network Topology .....................................  4
77   2.2 Communication Inside a Cell ...............................  5
78   2.3 Communication in the Network ..............................  6
79   2.4 Channel Communication .....................................  7
80   2.5 Router Connections ........................................  7
81 3 SILC Specification ............................................  8
82   3.1 Client ....................................................  8
83       3.1.1 Client ID ...........................................  9
84   3.2 Server .................................................... 10
85       3.2.1 Server's Local ID List .............................. 10
86       3.2.2 Server ID ........................................... 11
87       3.2.3 SILC Server Ports ................................... 12
88   3.3 Router .................................................... 12
89       3.3.1 Router's Local ID List .............................. 12
90       3.3.2 Router's Global ID List ............................. 13
91       3.3.3 Router's Server ID .................................. 14
92   3.4 Channels .................................................. 14
93       3.4.1 Channel ID .......................................... 16
94   3.5 Operators ................................................. 16
95   3.6 SILC Commands ............................................. 16
96   3.7 SILC Packets .............................................. 17
97   3.8 Packet Encryption ......................................... 17
98       3.8.1 Determination of the Source and the Destination ..... 17
99       3.8.2 Client To Client .................................... 18
100       3.8.3 Client To Channel ................................... 19
101       3.8.4 Server To Server .................................... 20
102   3.9 Key Exchange And Authentication ........................... 20
103       3.9.1 Authentication Payload .............................. 20
104   3.10 Algorithms ............................................... 22
105       3.10.1 Ciphers ............................................ 22
106       3.10.2 Public Key Algorithms .............................. 23
107       3.10.3 Hash Functions ..................................... 24
108       3.10.4 MAC Algorithms ..................................... 24
109       3.10.5 Compression Algorithms ............................. 25
110   3.11 SILC Public Key .......................................... 25
111   3.12 SILC Version Detection ................................... 27
112   3.13 Backup Routers ........................................... 28
113       3.13.1 Switching to Backup Router ......................... 29
114       3.13.2 Resuming Primary Router ............................ 30
115       3.13.3 Discussion on Backup Router Scheme ................. 32
116 4 SILC Procedures ............................................... 33
117   4.1 Creating Client Connection ................................ 33
118   4.2 Creating Server Connection ................................ 34
119       4.2.1 Announcing Clients, Channels and Servers ............ 35
120   4.3 Joining to a Channel ...................................... 36
121   4.4 Channel Key Generation .................................... 37
122   4.5 Private Message Sending and Reception ..................... 38
123   4.6 Private Message Key Generation ............................ 38
124   4.7 Channel Message Sending and Reception ..................... 39
125   4.8 Session Key Regeneration .................................. 39
126   4.9 Command Sending and Reception ............................. 40
127   4.10 Closing Connection ....................................... 41
128 5 Security Considerations ....................................... 41
129 6 References .................................................... 42
130 7 Author's Address .............................................. 44
131
132
133
134 .ti 0
135 List of Figures
136
137 .nf
138 Figure 1:  SILC Network Topology
139 Figure 2:  Communication Inside cell
140 Figure 3:  Communication Between Cells
141 Figure 4:  Router Connections
142 Figure 5:  SILC Public Key
143
144
145 .ti 0
146 1. Introduction
147
148 This document describes a Secure Internet Live Conferencing (SILC)
149 protocol which provides secure conferencing services over insecure
150 network channel.  SILC is IRC [IRC] like protocol, however, it is 
151 not equivalent to IRC and does not support IRC.
152
153 Strong cryptographic methods are used to protect SILC packets inside
154 the SILC network.  Three other Internet Drafts relates very closely
155 to this memo; SILC Packet Protocol [SILC2], SILC Key Exchange and
156 Authentication Protocols [SILC3] and SILC Commands [SILC4].
157
158 The protocol uses extensively packets as conferencing protocol 
159 requires message and command sending.  The SILC Packet Protocol is
160 described in [SILC2] and should be read to fully comprehend this
161 document and protocol.  [SILC2] also describes the packet encryption
162 and decryption in detail.
163
164 The security of SILC protocol, and for any security protocol for that
165 matter, is based on strong and secure key exchange protocol.  The SILC
166 Key Exchange protocol is described in [SILC3] along with connection
167 authentication protocol and should be read to fully comprehend this
168 document and protocol.
169
170 The SILC protocol has been developed to work on TCP/IP network
171 protocol, although it could be made to work on other network protocols
172 with only minor changes.  However, it is recommended that TCP/IP
173 protocol is used under SILC protocol.  Typical implementation would
174 be made in client-server model.
175
176
177 .ti 0
178 1.1 Requirements Terminology
179
180 The keywords MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED, 
181 MAY, and OPTIONAL, when they appear in this document, are to be
182 interpreted as described in [RFC2119].
183
184
185 .ti 0
186 2. SILC Concepts
187
188 This section describes various SILC protocol concepts that forms the 
189 actual protocol, and in the end, the actual SILC network.  The mission
190 of the protocol is to deliver messages from clients to other clients 
191 through routers and servers in secure manner.  The messages may also 
192 be delivered from one client to many clients forming a group, also 
193 known as a channel.
194
195 This section does not focus to security issues.  Instead, basic network 
196 concepts are introduced to make the topology of the SILC network 
197 clear.
198
199
200 .ti 0
201 2.1 SILC Network Topology
202
203 SILC network is a cellular network as opposed to tree style network 
204 topology.  The rationale for this is to have servers that can perform 
205 specific kind of tasks what other servers cannot perform.  This leads 
206 to two kinds of servers; normal SILC servers and SILC routers.
207
208 A difference between normal server and router server is that routers 
209 knows everything about everything in the network.  They also do the 
210 actual routing of the messages to the correct receiver.  Normal servers 
211 knows only about local information and nothing about global information.
212 This makes the network faster as there are less servers that needs to 
213 keep global information up to date at all time.
214
215 This, on the other hand, leads to cellular like network, where routers 
216 are in the center of the cell and servers are connected to the router.
217
218
219
220
221
222
223
224 The following diagram represents SILC network topology.
225
226 .in 8
227 .nf
228   ---- ---- ----         ---- ---- ----
229  | S8 | S5 | S4 |       | S7 | S5 | S6 |
230  ----- ---- -----       ----- ---- -----
231 | S7 | S/R1 | S2 | --- | S8 | S/R2 | S4 |
232  ---- ------ ----       ---- ------ ----
233  | S6 | S3 | S1 |       | S1 | S3 | S2 |         ---- ----
234   ---- ---- ----         ---- ---- ----         | S3 | S1 |
235      Cell 1.   \\             Cell 2.  | \\____  ----- -----
236                 |                     |        | S4 | S/R4 |
237     ---- ---- ----         ---- ---- ----       ---- ------
238    | S7 | S4 | S2 |       | S1 | S3 | S2 |      | S2 | S5 |
239    ----- ---- -----       ----- ---- -----       ---- ----
240   | S6 | S/R3 | S1 | --- | S4 | S/R5 | S5 | ____/ Cell 4.
241    ---- ------ ----       ---- ------ ----
242    | S8 | S5 | S3 |       | S6 | S7 | S8 |     ... etc ...
243     ---- ---- ----         ---- ---- ----
244        Cell 3.                Cell 5.
245 .in 3
246
247 .ce
248 Figure 1:  SILC Network Topology
249
250
251 A cell is formed when a server or servers connect to one router.  In
252 SILC network normal server cannot directly connect to other normal
253 server.  Normal server may only connect to SILC router which then
254 routes the messages to the other servers in the cell.  Router servers
255 on the other hand may connect to other routers to form the actual SILC 
256 network, as seen in above figure.  However, router is also normal SILC 
257 server; clients may connect to it the same way as to normal SILC 
258 server.  Normal server also cannot have active connections to more 
259 than one router.  Normal server cannot be connected to two different 
260 cells.  Router servers, on the other hand, may have as many router to 
261 router connections as needed.
262
263 There are many issues in this network topology that needs to be careful
264 about.  Issues like the size of the cells, the number of the routers in 
265 the SILC network and the capacity requirements of the routers.  These
266 issues should be discussed in the Internet Community and additional
267 documents on the issue may be written.
268
269
270 .ti 0
271 2.2 Communication Inside a Cell
272
273 It is always guaranteed that inside a cell message is delivered to the 
274 recipient with at most two server hops.  A client which is connected to
275 server in the cell and is talking on channel to other client connected 
276 to other server in the same cell, will have its messages delivered from 
277 its local server first to the router of the cell, and from the router 
278 to the other server in the cell.
279
280 The following diagram represents this scenario:
281
282
283 .in 25
284 .nf
285 1 --- S1     S4 --- 5
286          S/R
287  2 -- S2     S3
288      /        |
289     4         3
290 .in 3
291
292
293 .ce
294 Figure 2:  Communication Inside cell
295
296
297 Example:  Client 1. connected to Server 1. send message to
298           Client 4. connected to Server 2. travels from Server 1.
299           first to Router which routes the message to Server 2.
300           which then sends it to the Client 4.  All the other
301           servers in the cell will not see the routed message.
302
303
304 If the client is connected directly to the router, as router is also normal
305 SILC server, the messages inside the cell are always delivered only with 
306 one server hop.  If clients communicating with each other are connected 
307 to the same server, no router interaction is needed.  This is the optimal
308 situation of message delivery in the SILC network.
309
310
311 .ti 0
312 2.3 Communication in the Network
313
314 If the message is destined to server that does not belong to local cell 
315 the message is routed to the router server to which the destination 
316 server belongs, if the local router is connected to destination router.
317 If there is no direct connection to the destination router, the local
318 router routes the message to its primary route.  The following diagram
319 represents message sending between cells.
320
321
322 .in 16
323 .nf
324 1 --- S1     S4 --- 5            S2 --- 1
325          S/R - - - - - - - - S/R
326  2 -- S2     S3           S1
327      /        |             \\
328     4         3              2
329
330    Cell 1.               Cell 2.
331 .in 3
332
333
334 .ce
335 Figure 3:  Communication Between Cells
336
337
338 Example:  Client 5. connected to Server 4. in Cell 1. sends message
339           to Client 2. connected to Server 1. in Cell 2. travels
340           from Server 4. to Router which routes the message to
341           Router in Cell 2, which then routes the message to 
342           Server 1.  All the other servers and routers in the
343           network will not see the routed message.
344
345
346 The optimal case of message delivery from the client point of view is
347 when clients are connected directly to the routers and the messages
348 are delivered from one router to the other.
349
350
351 .ti 0 
352 2.4 Channel Communication
353
354 Messages may be sent to group of clients as well.  Sending messages to
355 many clients works the same way as sending messages point to point, from
356 message delivery point of view.  Security issues are another matter
357 which are not discussed in this section.
358
359 Router server handles the message routing to multiple recipients.  If 
360 any recipient is not in the same cell as the sender the messages are 
361 routed further.
362
363 Server distributes the channel message to its local clients which are 
364 joined to the channel.  Router also distributes the message to its 
365 local clients on the channel.
366
367
368 .ti 0
369 2.5 Router Connections
370
371 Router connections play very important role in making the SILC like
372 network topology to work.  For example, sending broadcast packets in
373 SILC network require special connections between routers; routers must
374 be connected in a specific way.
375
376 Every router has their primary route which is a connection to another
377 router in the network.  Unless there is only two routers in the network
378 must not routers use each other as their primary routes.  The router
379 connections in the network must form a ring.
380
381
382
383
384
385
386
387 Example with three routers in the network:
388
389
390 .in 16
391 .nf
392     S/R1 - < - < - < - < - < - < - S/R2
393      \\                               /
394       v                             ^
395        \\ - > -  > - S/R3 - > - > - /
396 .in 3
397
398
399 .ce
400 Figure 4:  Router Connections
401
402
403 Example:  Network with three routers.  Router 1. uses Router 2. as its
404           primary router.  Router 2. uses Router 3. as its primary router,
405           and Router 3. uses Router 1. as its primary router.  There may
406           be other direct connections between the routers but they must
407           not be used as primary routes.
408
409 The above example is applicable to any amount of routers in the network
410 except for two routers.  If there are only two routers in the network both
411 routers must be able to handle situation where they use each other as their
412 primary routes.
413
414 The issue of router connections are very important especially with SILC
415 broadcast packets.  Usually all router wide information in the network is
416 distributed by SILC broadcast packets.  This sort of ring network, with
417 ability to have other direct routes in the network cause interesting
418 routing problems.  The [SILC2] discusses the routing of packets in this
419 sort of network in more detail.
420
421
422 .ti 0
423 3. SILC Specification
424
425 This section describes the SILC protocol.  However, [SILC2] and
426 [SILC3] describes other important protocols that are part of this SILC
427 specification and must be read.
428
429
430 .ti 0
431 3.1 Client
432
433 A client is a piece of software connecting to SILC server.  SILC client 
434 cannot be SILC server.  Purpose of clients is to provide the user 
435 interface of the SILC services for end user.  Clients are distinguished
436 from other clients by unique Client ID.  Client ID is a 128 bit ID that
437 is used in the communication in the SILC network.  The client ID is 
438 based on the nickname selected by the user.  User uses logical nicknames
439 in communication which are then mapped to the corresponding Client ID.
440 Client ID's are low level identifications and must not be seen by the
441 end user.
442
443 Clients provide other information about the end user as well. Information
444 such as the nickname of the user, username and the host name of the end 
445 user and user's real name.  See section 3.2 Server for information of 
446 the requirements of keeping this information.
447
448 The nickname selected by the user is not unique in the SILC network.
449 There can be 2^8 same nicknames for one IP address.  As for comparison
450 to IRC [IRC] where nicknames are unique this is a fundamental difference
451 between SILC and IRC.  This causes the server names or client's host names
452 to be used along with the nicknames to identify specific users when sending
453 messages.  This feature of SILC makes IRC style nickname-wars obsolete as
454 no one owns their nickname; there can always be someone else with the same
455 nickname.  The maximum length of nickname is 128 characters.
456
457
458 .ti 0
459 3.1.1 Client ID
460
461 Client ID is used to identify users in the SILC network.  The Client ID
462 is unique to the extent that there can be 2^128 different Client ID's,
463 and ID's based on IPv6 addresses extends this to 2^224 different Client
464 ID's.  Collisions are not expected to happen.  The Client ID is defined
465 as follows.
466
467
468
469 .in 6
470 128 bit Client ID based on IPv4 addresses:
471
472 32 bit  Server ID IP address (bits 1-32)
473  8 bit  Random number or counter
474 88 bit  Truncated MD5 hash value of the nickname
475
476 224 bit Client ID based on IPv6 addresses:
477
478 128 bit  Server ID IP address (bits 1-128)
479   8 bit  Random number or counter
480  88 bit  Truncated MD5 hash value of the nickname
481
482 o Server ID IP address - Indicates the server where this
483   client is coming from.  The IP address hence equals the
484   server IP address where to the client has connected.
485
486 o Random number or counter - Random number to further 
487   randomize the Client ID.  Another choice is to use
488   a counter starting from the zero (0).  This makes it
489   possible to have 2^8 same nicknames from the same
490   server IP address.
491
492 o MD5 hash - MD5 hash value of the nickname is truncated
493   taking 88 bits from the start of the hash value.  This
494   hash value is used to search the user's Client ID from
495   the ID lists.
496
497 .in 3
498 Collisions could occur when more than 2^8 clients using same nickname
499 from the same server IP address is connected to the SILC network.  
500 Server MUST be able to handle this situation by refusing to accept 
501 anymore of that nickname.
502
503 Another possible collision may happen with the truncated hash value of
504 the nickname.  It could be possible to have same truncated hash value for
505 two different nicknames.  However, this is not expected to happen nor
506 cause any problems if it would occur.  Nicknames are usually logical and
507 it is unlikely to have two distinct logical nicknames produce same
508 truncated hash value.
509
510
511 .ti 0
512 3.2 Server
513
514 Servers are the most important parts of the SILC network.  They form the
515 basis of the SILC, providing a point to which clients may connect to.
516 There are two kinds of servers in SILC; normal servers and router servers.
517 This section focus on the normal server and router server is described
518 in the section 3.3 Router.
519
520 Normal servers MUST NOT directly connect to other normal server.  Normal
521 servers may only directly connect to router server.  If the message sent
522 by the client is destined outside the local server it is always sent to
523 the router server for further routing.  Server may only have one active
524 connection to router on same port.  Normal server MUST NOT connect to other
525 cell's router except in situations where its cell's router is unavailable.
526
527
528 .ti 0
529 3.2.1 Server's Local ID List
530
531 Normal server keeps various information about the clients and their end
532 users connected to it.  Every normal server MUST keep list of all locally
533 connected clients, Client ID's, nicknames, usernames and host names and
534 user's real name.  Normal servers only keeps local information and it
535 does not keep any global information.  Hence, normal servers knows only
536 about their locally connected clients.  This makes servers efficient as
537 they don't have to worry about global clients.  Server is also responsible
538 of creating the Client ID's for their clients.
539
540 Normal server also keeps information about locally created channels and
541 their Channel ID's.
542
543
544 Hence, local list for normal server includes:
545
546 .in 6
547 server list        - Router connection
548    o Server name
549    o Server IP address
550    o Server ID
551    o Sending key
552    o Receiving key
553    o Public key
554
555 client list        - All clients in server
556    o Nickname
557    o Username@host
558    o Real name
559    o Client ID
560    o Sending key
561    o Receiving key
562    o Public key
563
564
565 channel list       - All channels in server
566    o Channel name
567    o Channel ID
568    o Client ID's on channel
569    o Client ID modes on channel
570    o Channel key
571 .in 3
572
573
574 .ti 0
575 3.2.2 Server ID
576
577 Servers are distinguished from other servers by unique 64 bit Server ID 
578 (for IPv4) or 160 bit Server ID (for IPv6).  The Server ID is used in
579 the SILC to route messages to correct servers.  Server ID's also provide
580 information for Client ID's, see section 3.1.1 Client ID.  Server ID is
581 defined as follows.
582
583 .in 6
584 64 bit Server ID based on IPv4 addresses:
585
586 32 bit  IP address of the server
587 16 bit  Port
588 16 bit  Random number
589
590 160 bit Server ID based on IPv6 addresses:
591
592 128 bit  IP address of the server
593  16 bit  Port
594  16 bit  Random number
595
596 o IP address of the server - This is the real IP address of
597   the server.
598
599 o Port - This is the port the server is bound to.
600
601 o Random number - This is used to further randomize the Server ID.
602
603 .in 3
604 Collisions are not expected to happen in any conditions.  The Server ID
605 is always created by the server itself and server is responsible of
606 distributing it to the router.
607
608
609 .ti 0
610 3.2.3 SILC Server Ports
611
612 The following ports has been assigned by IANA for the SILC protocol:
613
614 .in 10
615 silc            706/tcp    SILC
616 silc            706/udp    SILC
617 .in 3
618
619
620 If there are needs to create new SILC networks in the future the port
621 numbers must be officially assigned by the IANA.
622
623 Server on network above privileged ports (>1023) SHOULD NOT be trusted
624 as they could have been set up by untrusted party.
625
626
627 .ti 0
628 3.3 Router
629
630 Router server in SILC network is responsible for keeping the cell together
631 and routing messages to other servers and to other routers.  Router server
632 is also a normal server thus clients may connect to it as it would be
633 just normal SILC server.
634
635 However, router servers has a lot of important tasks that normal servers
636 do not have.  Router server knows everything about everything in the SILC.
637 They know all clients currently on SILC, all servers and routers and all
638 channels in SILC.  Routers are the only servers in SILC that care about
639 global information and keeping them up to date at all time.  And, this
640 is what they must do.
641
642
643 .ti 0
644 3.3.1 Router's Local ID List
645
646 Router server as well MUST keep local list of connected clients and
647 locally created channels.  However, this list is extended to include all
648 the informations of the entire cell, not just the server itself as for
649 normal servers.
650
651 However, on router this list is a lot smaller since routers do not need
652 to keep information about user's nickname, username and host name and real
653 name since these are not needed by the router.  The router keeps only
654 information that it needs.
655
656
657 Hence, local list for router includes:
658
659 .in 6
660 server list        - All servers in the cell
661    o Server name
662    o Server ID
663    o Router's Server ID
664    o Sending key
665    o Receiving key
666
667 client list        - All clients in the cell
668    o Client ID
669
670
671 channel list       - All channels in the cell
672    o Channel ID
673    o Client ID's on channel
674    o Client ID modes on channel
675    o Channel key
676 .in 3
677
678
679 Note that locally connected clients and other information include all the
680 same information as defined in section section 3.2.1 Server's Local ID
681 List.
682
683
684 .ti 0
685 3.3.2 Router's Global ID List
686
687 Router server MUST also keep global list.  Normal servers do not have
688 global list as they know only about local information.  Global list
689 includes all the clients on SILC, their Client ID's, all created channels
690 and their Channel ID's and all servers and routers on SILC and their
691 Server ID's.  That is said, global list is for global information and the
692 list must not include the local information already on the router's local
693 list.
694
695 Note that the global list does not include information like nicknames,
696 usernames and host names or user's real names.  Router does not need to
697 keep these informations as they are not needed by the router.  This 
698 information is available from the client's server which maybe queried
699 when needed.
700
701 Hence, global list includes:
702
703 .in 6
704 server list        - All servers in SILC
705    o Server name
706    o Server ID
707    o Router's Server ID
708
709 client list        - All clients in SILC
710    o Client ID
711
712 channel list       - All channels in SILC
713    o Channel ID
714    o Client ID's on channel
715    o Client ID modes on channel
716 .in 3
717
718
719
720 .ti 0
721 3.3.3 Router's Server ID
722
723 Router's Server ID's are equivalent to normal Server ID's.  As routers
724 are normal servers as well same types of ID's applies for routers as well.
725 Thus, see section 3.2.2 Server ID.
726
727
728 .ti 0
729 3.4 Channels
730
731 A channel is a named group of one or more clients which will all receive
732 messages addressed to that channel.  The channel is created when first
733 client requests JOIN command to the channel, and the channel ceases to
734 exist when the last client has left it.  When channel exists, any client
735 can reference it using the name of the channel.
736
737 Channel names are unique although the real uniqueness comes from 64 bit
738 Channel ID.  However, channel names are still unique and no two global
739 channels with same name may exist.  The Channel name is a string of
740 maximum length of 256 characters.  Channel names MUST NOT contain any
741 spaces (`  '), any non-printable ASCII characters, commas (`,') and
742 wildcard characters.
743
744 Channels can have operators that can administrate the channel and
745 operate all of its modes.  The following operators on channel exist on
746 the SILC network.
747
748 .in 6
749 o Channel founder - When channel is created the joining client becomes
750   channel founder.  Channel founder is channel operator with some more
751   privileges.  Basically, channel founder can fully operate the channel
752   and all of its modes.  The privileges are limited only to the
753   particular channel.  There can be only one channel founder per
754   channel. Channel founder supersedes channel operator's privileges.
755
756   Channel founder privileges cannot be removed by any other operator on
757   channel.  When channel founder leaves the channel there is no channel
758   founder on the channel.  However, it is possible to set a mode for
759   the channel which allows the original channel founder to regain the
760   founder privileges even after leaving the channel.  Channel founder
761   also cannot be removed by force from the channel.
762
763 o Channel operator - When client joins to channel that has not existed
764   previously it will become automatically channel operator (and channel
765   founder discussed above).  Channel operator is able administrate the
766   channel, set some modes on channel, remove a badly behaving client
767   from the channel and promote other clients to become channel
768   operator.  The privileges are limited only to the particular channel.
769
770   Normal channel user may be promoted (opped) to channel operator
771   gaining channel operator privileges.  Channel founder or other
772   channel operator may also demote (deop) channel operator to normal
773   channel user.
774 .in 3
775
776
777 .ti 0
778 3.4.1 Channel ID
779
780 Channels are distinguished from other channels by unique Channel ID.
781 The Channel ID is a 64 bit ID (for IPv4) or 160 bit ID (for IPv6), and
782 collisions are not expected to happen in any conditions.  Channel names
783 are just for logical use of channels.  The Channel ID is created by the
784 server where the channel is created.  The Channel ID is defined as
785 follows.
786
787 .in 6
788 64 bit Channel ID based on IPv4 addresses:
789
790 32 bit  Router's Server ID IP address (bits 1-32)
791 16 bit  Router's Server ID port (bits 33-48)
792 16 bit  Random number
793
794 160 bit Channel ID based on IPv6 addresses:
795
796 128 bit  Router's Server ID IP address (bits 1-128)
797  16 bit  Router's Server ID port (bits 129-144)
798  16 bit  Random number
799
800 o Router's Server ID IP address - Indicates the IP address of 
801   the router of the cell where this channel is created.  This is 
802   taken from the router's Server ID.  This way SILC router knows 
803   where this channel resides in the SILC network.
804
805 o Router's Server ID port - Indicates the port of the channel on 
806   the server.  This is taken from the router's Server ID.
807
808 o Random number - To further randomize the Channel ID.  This makes
809   sure that there are no collisions.  This also means that
810   in a cell there can be 2^16 channels.
811 .in 3
812
813
814 .ti 0
815 3.5 Operators
816
817 Operators are normal users with extra privileges to their server or
818 router.  Usually these people are SILC server and router administrators
819 that take care of their own server and clients on them.  The purpose of
820 operators is to administrate the SILC server or router.  However, even
821 an operator with highest privileges is not able to enter invite-only
822 channel, to gain access to the contents of a encrypted and authenticated
823 packets traveling in the SILC network or to gain channel operator
824 privileges on public channels without being promoted.  They have the
825 same privileges as everyone else except they are able to administrate
826 their server or router.
827
828
829 .ti 0
830 3.6 SILC Commands
831
832 Commands are very important part on SILC network especially for client
833 which uses commands to operate on the SILC network.  Commands are used
834 to set nickname, join to channel, change modes and many other things.
835
836 Client usually sends the commands and server replies by sending a reply
837 packet to the command.  Server MAY also send commands usually to serve
838 the original client's request.  However, server MUST NOT send commands
839 to client and there are some commands that server must not send.
840
841 Note that the command reply is usually sent only after client has sent
842 the command request but server is allowed to send command reply packet
843 to client even if client has not requested the command.  Client MAY,
844 choose to ignore the command reply.
845
846 It is expected that some of the commands may be miss-used by clients
847 resulting various problems on the server side.  Every implementation
848 SHOULD assure that commands may not be executed more than once, say,
849 in two (2) seconds.  However, to keep response rate up, allowing for
850 example five (5) commands before limiting is allowed.  It is RECOMMENDED
851 that commands such as SILC_COMMAND_NICK, SILC_COMMAND_JOIN, 
852 SILC_COMMAND_LEAVE and SILC_COMMAND_KILL SHOULD be limited in all cases
853 as they require heavy operations.  This should be sufficient to prevent
854 the miss-use of commands.
855
856 SILC commands are described in [SILC4].
857
858
859 .ti 0
860 3.7 SILC Packets
861
862 Packets are naturally the most important part of the protocol and the
863 packets are what actually makes the protocol.  Packets in SILC network
864 are always encrypted using, usually the shared secret session key
865 or some other key, for example, channel key, when encrypting channel
866 messages.  It is not possible to send packet in SILC network without
867 encryption.  The SILC Packet Protocol is a wide protocol and is described
868 in [SILC2].  This document does not define or describe details of
869 SILC packets.
870
871
872 .ti 0
873 3.8 Packet Encryption
874
875 All packets passed in SILC network MUST be encrypted.  This section
876 defines how packets must be encrypted in the SILC network.  The detailed
877 description of the actual encryption process of the packets are
878 described in [SILC2].
879
880 Client and its server shares secret symmetric session key which is
881 established by the SILC Key Exchange Protocol, described in [SILC3]. 
882 Every packet sent from client to server, with exception of packets for
883 channels, are encrypted with this session key.
884
885 Channels has their own key that are shared by every client on the channel.
886 However, the channel keys are cell specific thus one cell does not know
887 the channel key of the other cell, even if that key is for same channel.
888 Channel key is also known by the routers and all servers that has clients
889 on the channel.  However, channels MAY have channel private keys that
890 are entirely local setting for the client.  All clients on the channel
891 MUST know the channel private key before hand to be able to talk on the
892 channel.  In this case, no server or router know the key for channel.
893
894 Server shares secret symmetric session key with router which is
895 established by the SILC Key Exchange Protocol.  Every packet passed from
896 server to router, with exception of packets for channels, are encrypted
897 with the shared session key.  Same way, router server shares secret
898 symmetric key with its primary route.  However, every packet passed
899 from router to other router, including packets for channels, are
900 encrypted with the shared session key.  Every router connection has
901 their own session keys.
902
903
904 .ti 0
905 3.8.1 Determination of the Source and the Destination
906
907 The source and the destination of the packet needs to be determined
908 to be able to route the packets to correct receiver.  This information
909 is available in the SILC Packet Header which is included in all packets
910 sent in SILC network.  The SILC Packet Header is described in [SILC2].
911
912 The header MUST be encrypted with the session key who is next receiver
913 of the packet along the route.  The receiver of the packet, for example
914 a router along the route, is able to determine the sender and the
915 destination of the packet by decrypting the SILC Packet Header and
916 checking the ID's attached to the header.  The ID's in the header will
917 tell to where the packet needs to be sent and where it is coming from.
918
919 The header in the packet MUST NOT change during the routing of the
920 packet.  The original sender, for example client, assembles the packet
921 and the packet header and server or router between the sender and the
922 receiver MUST NOT change the packet header.
923
924 Note that the packet and the packet header may be encrypted with
925 different keys.  For example, packets to channels are encrypted with
926 the channel key, however, the header is encrypted with the session key
927 as described above.  However, the header and the packet may be encrypted
928 with same key.  This is the case, for example, with command packets.
929
930
931 .ti 0
932 3.8.2 Client To Client
933
934 The process of message delivery and encryption from client to another
935 client is as follows.
936
937 Example:  Private message from client to another client on different
938           servers.  Clients do not share private message delivery
939           keys; normal session keys are used.
940
941 o Client 1. sends encrypted packet to its server.  The packet is
942   encrypted with the session key shared between client and its
943   server.
944
945 o Server determines the destination of the packet and decrypts
946   the packet.  Server encrypts the packet with session key shared
947   between the server and its router, and sends the packet to the
948   router.
949
950 o Router determines the destination of the packet and decrypts
951   the packet.  Router encrypts the packet with session key 
952   shared between the router and the destination server, and sends
953   the packet to the server.
954
955 o Server determines the client to which the packet is destined
956   to and decrypts the packet.  Server encrypts the packet with
957   session key shared between the server and the destination client,
958   and sends the packet to the client.
959
960 o Client 2. decrypts the packet.
961
962
963 Example:  Private message from client to another client on different
964           servers.  Clients has established secret shared private
965           message delivery key with each other and that is used in 
966           the message encryption.
967
968 o Client 1. sends encrypted packet to its server.  The packet is
969   encrypted with the private message delivery key shared between
970   clients.
971
972 o Server determines the destination of the packet and sends the 
973   packet to the router.
974
975 o Router determines the destination of the packet and sends the
976   packet to the server.
977
978 o Server determines the client to which the packet is destined
979   to and sends the packet to the client.
980
981 o Client 2. decrypts the packet with the secret shared key.
982
983
984 If clients share secret key with each other the private message
985 delivery is much simpler since servers and routers between the
986 clients do not need to decrypt and re-encrypt the packet.
987
988 The process for clients on same server is much simpler as there are
989 no need to send the packet to the router.  The process for clients 
990 on different cells is same as above except that the packet is routed 
991 outside the cell.  The router of the destination cell routes the 
992 packet to the destination same way as described above.
993
994
995 .ti 0
996 3.8.3 Client To Channel
997
998 Process of message delivery from client on channel to all the clients
999 on the channel.
1000
1001 Example:  Channel of four users; two on same server, other two on
1002           different cells.  Client sends message to the channel.
1003
1004 o Client 1. encrypts the packet with channel key and sends the
1005   packet to its server.
1006
1007 o Server determines local clients on the channel and sends the
1008   packet to the Client on the same server.  Server then sends
1009   the packet to its router for further routing.
1010
1011 o Router determines local clients on the channel, if found
1012   sends packet to the local clients.  Router determines global
1013   clients on the channel and sends the packet to its primary
1014   router or fastest route.
1015
1016 o (Other router(s) do the same thing and sends the packet to
1017    the server(s))
1018
1019 o Server determines local clients on the channel and sends the
1020   packet to the client.
1021
1022 o All clients receiving the packet decrypts the packet.
1023
1024
1025 .ti 0
1026 3.8.4 Server To Server
1027
1028 Server to server packet delivery and encryption is described in above
1029 examples. Router to router packet delivery is analogous to server to
1030 server.  However, some packets, such as channel packets, are processed
1031 differently.  These cases are described later in this document and
1032 more in detail in [SILC2].
1033
1034
1035 .ti 0
1036 3.9 Key Exchange And Authentication
1037
1038 Key exchange is done always when for example client connects to server
1039 but also when server and router, and router and router connects to each
1040 other.  The purpose of key exchange protocol is to provide secure key
1041 material to be used in the communication.  The key material is used to
1042 derive various security parameters used to secure SILC packets.  The
1043 SILC Key Exchange protocol is described in detail in [SILC3].
1044
1045 Authentication is done after key exchange protocol has been successfully
1046 completed.  The purpose of authentication is to authenticate for example
1047 client connecting to the server.  However, usually clients are accepted
1048 to connect to server without explicit authentication.  Servers are
1049 required use authentication protocol when connecting.  The authentication
1050 may be based on passphrase (pre-shared-secret) or public key.  The
1051 connection authentication protocol is described in detail in [SILC3].
1052
1053
1054 .ti 0
1055 3.9.1 Authentication Payload
1056
1057 Authentication payload is used separately from the SKE and the Connection
1058 Authentication protocol.  It is used during the session to authenticate
1059 with the remote.  For example, the client can authenticate itself to the
1060 server to become server operator.  In this case, Authentication Payload is
1061 used.
1062
1063 The format of the Authentication Payload is as follows:
1064
1065
1066 .in 5
1067 .nf
1068                      1                   2                   3
1069  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
1070 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1071 |        Payload Length         |     Authentication Method     |
1072 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1073 |      Public Data Length       |                               |
1074 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1075 |                                                               |
1076 ~                           Public Data                         ~
1077 |                                                               |
1078 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1079 |   Authentication Data Length  |                               |
1080 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1081 |                                                               |
1082 ~                       Authentication Data                     ~
1083 |                                                               |
1084 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1085 .in 3
1086  
1087 .ce
1088 Figure 5:  Authentication Payload
1089
1090
1091 .in 6
1092 o Payload Length (2 bytes) - Length of the entire payload.
1093
1094 o Authentication Method (2) - The method of the authentication.
1095   The authentication methods are defined in [SILC2] in the
1096   Connection Auth Request Payload.  The NONE authentication
1097   method SHOULD NOT be used.
1098
1099 o Public Data Length (2 bytes) - Indicates the length of
1100   the Public Data field.
1101
1102 o Public Data (variable length) - This is defined only if
1103   the authentication method is public key.  If it is any other
1104   this field MAY include a random data for padding purposes.
1105   However, in this case the field MUST be ignored by the
1106   receiver.
1107
1108   When the authentication method is public key this includes
1109   128 to 4096 bytes of non-zero random data that is used in
1110   the signature process, described subsequently.
1111
1112 o Authentication Data Length (2 bytes) - Indicates the
1113   length of the Authentication Data field.
1114
1115 o Authentication Data (variable length) - Authentication 
1116   method dependent authentication data.
1117 .in 3
1118
1119
1120 If the authentication method is password based, the Authentication
1121 Data field includes the plaintext password.  It is safe to send
1122 plaintext password since the entire payload is encrypted.  In this
1123 case the Public Data Length is set to zero (0), but MAY also include
1124 random data for padding purposes.  It is also RECOMMENDED that maximum
1125 amount of padding is applied to SILC packet when using password based
1126 authentication.  This way it is not possible to approximate the length
1127 of the password from the encrypted packet.
1128
1129 If the authentication method is public key based (or certificate)
1130 the Authentication Data is computed as follows:
1131
1132   HASH = hash(random bytes | ID | public key (or certificate));
1133   Authentication Data = sign(HASH);
1134
1135 The hash() and the sign() are the hash function and the public key
1136 cryptography function selected in the SKE protocol.  The public key
1137 is SILC style public key unless certificates are used.  The ID is the
1138 entity's ID (Client or Server ID) which is authenticating itself.  The
1139 ID is raw ID data.  The random bytes are non-zero random bytes of
1140 length between 128 and 4096 bytes, and will be included into the
1141 Public Data field as is.
1142
1143 The receiver will compute the signature using the random data received
1144 in the payload, the ID associated to the connection and the public key
1145 (or certificate) received in the SKE protocol.  After computing the
1146 receiver MUST verify the signature.  In this case also, the entire
1147 payload is encrypted.
1148
1149
1150 .ti 0
1151 3.10 Algorithms
1152
1153 This section defines all the allowed algorithms that can be used in
1154 the SILC protocol.  This includes mandatory cipher, mandatory public
1155 key algorithm and MAC algorithms.
1156
1157
1158 .ti 0
1159 3.10.1 Ciphers
1160
1161 Cipher is the encryption algorithm that is used to protect the data
1162 in the SILC packets.  See [SILC2] of the actual encryption process and
1163 definition of how it must be done.  SILC has a mandatory algorithm that
1164 must be supported in order to be compliant with this protocol.
1165
1166 The following ciphers are defined in SILC protocol:
1167
1168 .in 6
1169 aes-256-cbc         AES in CBC mode, 256 bit key       (REQUIRED)
1170 aes-192-cbc         AES in CBC mode, 192 bit key       (OPTIONAL)
1171 aes-128-cbc         AES in CBC mode, 128 bit key       (OPTIONAL)
1172 twofish-256-cbc     Twofish in CBC mode, 256 bit key   (OPTIONAL)
1173 twofish-192-cbc     Twofish in CBC mode, 192 bit key   (OPTIONAL)
1174 twofish-128-cbc     Twofish in CBC mode, 128 bit key   (OPTIONAL)
1175 blowfish-128-cbc    Blowfish in CBC mode, 128 bit key  (OPTIONAL)
1176 cast-256-cbc        CAST-256 in CBC mode, 256 bit key  (OPTIONAL)
1177 cast-192-cbc        CAST-256 in CBC mode, 192 bit key  (OPTIONAL)
1178 cast-128-cbc        CAST-256 in CBC mode, 128 bit key  (OPTIONAL)
1179 rc6-256-cbc         RC6 in CBC mode, 256 bit key       (OPTIONAL)
1180 rc6-192-cbc         RC6 in CBC mode, 192 bit key       (OPTIONAL)
1181 rc6-128-cbc         RC6 in CBC mode, 128 bit key       (OPTIONAL)
1182 mars-256-cbc        Mars in CBC mode, 256 bit key      (OPTIONAL)
1183 mars-192-cbc        Mars in CBC mode, 192 bit key      (OPTIONAL)
1184 mars-128-cbc        Mars in CBC mode, 128 bit key      (OPTIONAL)
1185 none                No encryption                      (OPTIONAL)
1186 .in 3
1187
1188
1189 Algorithm none does not perform any encryption process at all and 
1190 thus is not recommended to be used.  It is recommended that no client
1191 or server implementation would accept none algorithms except in special
1192 debugging mode.
1193
1194 Additional ciphers MAY be defined to be used in SILC by using the
1195 same name format as above.
1196
1197
1198 .ti 0
1199 3.10.2 Public Key Algorithms
1200
1201 Public keys are used in SILC to authenticate entities in SILC network
1202 and to perform other tasks related to public key cryptography.  The 
1203 public keys are also used in the SILC Key Exchange protocol [SILC3].
1204
1205 The following public key algorithms are defined in SILC protocol:
1206
1207 .in 6
1208 rsa        RSA  (REQUIRED)
1209 dss        DSS  (OPTIONAL)
1210 .in 3
1211
1212 DSS is described in [Menezes].  The RSA MUST be implemented according
1213 PKCS #1 [PKCS1].  The mandatory PKCS #1 implementation in SILC MUST be
1214 compliant to either PKCS #1 version 1.5 or newer with the following
1215 notes: The signature encoding is always in same format as the encryption
1216 encoding regardless of the PKCS #1 version.  The signature with appendix
1217 (with hash algorithm OID in the data) MUST NOT be used in the SILC.  The
1218 rationale for this is that there is no binding between the PKCS #1 OIDs
1219 and the hash algorithms used in the SILC protocol.  Hence, the encoding
1220 is always in PKCS #1 version 1.5 format.
1221
1222 Additional public key algorithms MAY be defined to be used in SILC.
1223
1224
1225 .ti 0
1226 3.10.3 Hash Functions
1227
1228 Hash functions are used as part of MAC algorithms defined in the next
1229 section.  They are also used in the SILC Key Exchange protocol defined
1230 in the [SILC3].
1231
1232 The following Hash algorithm are defined in SILC protocol:
1233
1234 .in 6
1235 sha1             SHA-1, length = 20      (REQUIRED)
1236 md5              MD5, length = 16        (OPTIONAL)
1237 .in 3
1238
1239
1240 .ti 0
1241 3.10.4 MAC Algorithms
1242
1243 Data integrity is protected by computing a message authentication code
1244 (MAC) of the packet data.  See [SILC2] for details how to compute the
1245 MAC.
1246
1247 The following MAC algorithms are defined in SILC protocol:
1248
1249 .in 6
1250 hmac-sha1-96     HMAC-SHA1, length = 12  (REQUIRED)
1251 hmac-md5-96      HMAC-MD5, length = 12   (OPTIONAL)
1252 hmac-sha1        HMAC-SHA1, length = 20  (OPTIONAL)
1253 hmac-md5         HMAC-MD5, length = 16   (OPTIONAL)
1254 none             No MAC                  (OPTIONAL)
1255 .in 3
1256
1257 The none MAC is not recommended to be used as the packet is not
1258 authenticated when MAC is not computed.  It is recommended that no
1259 client or server would accept none MAC except in special debugging
1260 mode.
1261
1262 The HMAC algorithm is described in [HMAC] and hash algorithms that
1263 are used as part of the HMACs are described in [Scheneir] and in
1264 [Menezes]
1265
1266 Additional MAC algorithms MAY be defined to be used in SILC.
1267
1268
1269
1270
1271 .ti 0
1272 3.10.5 Compression Algorithms
1273
1274 SILC protocol supports compression that may be applied to unencrypted
1275 data.  It is recommended to use compression on slow links as it may
1276 significantly speed up the data transmission.  By default, SILC does not
1277 use compression which is the mode that must be supported by all SILC
1278 implementations.
1279
1280 The following compression algorithms are defined:
1281
1282 .in 6
1283 none        No compression               (REQUIRED)
1284 zlib        GNU ZLIB (LZ77) compression  (OPTIONAL)
1285 .in 3
1286
1287 Additional compression algorithms MAY be defined to be used in SILC.
1288
1289
1290 .ti 0
1291 3.11 SILC Public Key
1292
1293 This section defines the type and format of the SILC public key.  All
1294 implementations MUST support this public key type.  See [SILC3] for
1295 other optional public key and certificate types allowed in the SILC
1296 protocol.  Public keys in SILC may be used to authenticate entities
1297 and to perform other tasks related to public key cryptography.
1298
1299 The format of the SILC Public Key is as follows:
1300
1301
1302 .in 5
1303 .nf
1304                      1                   2                   3
1305  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
1306 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1307 |                        Public Key Length                      |
1308 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1309 |     Algorithm Name Length     |                               |
1310 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1311 |                                                               |
1312 ~                         Algorithm Name                        ~
1313 |                                                               |
1314 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1315 |       Identifier Length       |                               |
1316 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1317 |                                                               |
1318 ~                           Identifier                          ~
1319 |                                                               |
1320 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1321 |                                                               |
1322 ~                           Public Data                         ~
1323 |                                                               |
1324 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1325 .in 3
1326
1327 .ce
1328 Figure 5:  SILC Public Key
1329
1330
1331 .in 6
1332 o Public Key Length (4 bytes) - Indicates the full length
1333   of the public key, not including this field.
1334
1335 o Algorithm Name Length (2 bytes) - Indicates the length
1336   of the Algorithm Length field, not including this field.
1337
1338 o Algorithm name (variable length) - Indicates the name
1339   of the public key algorithm that the key is.  See the
1340   section 3.10.2 Public Key Algorithms for defined names.
1341
1342 o Identifier Length (2 bytes) - Indicates the length of
1343   the Identifier field, not including this field.
1344
1345 o Identifier (variable length) - Indicates the identifier
1346   of the public key.  This data can be used to identify
1347   the owner of the key.  The identifier is of the following
1348   format:
1349
1350      UN   User name
1351      HN   Host name or IP address
1352      RN   Real name
1353      E    EMail address
1354      O    Organization
1355      C    Country
1356
1357
1358   Examples of an identifier:
1359
1360     `UN=priikone, HN=poseidon.pspt.fi, E=priikone@poseidon.pspt.fi'
1361
1362     `UN=sam, HN=dummy.fi, RN=Sammy Sam, O=Company XYZ, C=Finland'
1363
1364   At least user name (UN) and host name (HN) MUST be provided as
1365   identifier.  The fields are separated by commas (`,').  If
1366   comma is in the identifier string it must be written as `\\,',
1367   for example, `O=Company XYZ\\, Inc.'.
1368
1369 o Public Data (variable length) - Includes the actual
1370   public data of the public key.
1371
1372   The format of this field for RSA algorithm is
1373   as follows:
1374
1375      4 bytes            Length of e
1376      variable length    e
1377      4 bytes            Length of n
1378      variable length    n
1379
1380
1381   The format of this field for DSS algorithm is
1382   as follows:
1383
1384      4 bytes            Length of p
1385      variable length    p
1386      4 bytes            Length of q
1387      variable length    q
1388      4 bytes            Length of g
1389      variable length    g
1390      4 bytes            Length of y
1391      variable length    y
1392
1393   The variable length fields are multiple precession
1394   integers encoded as strings in both examples.
1395
1396   Other algorithms must define their own type of this
1397   field if they are used.
1398 .in 3
1399
1400 All fields in the public key are in MSB (most significant byte first)
1401 order.
1402
1403
1404 .ti 0
1405 3.12 SILC Version Detection
1406
1407 The version detection of both client and server is performed at the
1408 connection phase while executing the SILC Key Exchange protocol.  The
1409 version identifier is exchanged between initiator and responder.  The
1410 version identifier is of the following format:
1411
1412 .in 6
1413 SILC-<protocol version>-<software version>
1414 .in 3
1415
1416 The version strings are of the following format:
1417
1418 .in 6
1419 protocol version = <major>.<minor>
1420 software version = <major>[.<minor>[.<build or vendor string>]]
1421 .in 3
1422
1423 Protocol version MAY provide both major and minor version.  Currently
1424 implementations MUST set the protocol version and accept the protocol
1425 version as SILC-1.1-<software version>.  If new protocol version causes
1426 in compatibilities with older version the the <minor> versio number MUST
1427 be incremented.  The <major> is incremented if new protocol version is
1428 fully incompatible.
1429
1430 Software version MAY provide major, minor and build version.  The
1431 software version MAY be freely set and accepted.
1432
1433
1434 Thus, the version strings could be, for example:
1435
1436 .in 6
1437 SILC-1.1-2.0.2
1438 SILC-1.0-1.2
1439 SILC-1.1-1.0.VendorXYZ
1440 .in 3
1441
1442
1443 .ti 0
1444 3.13 Backup Routers
1445
1446 Backup routers may exist in the cell in addition of the primary router.
1447 However, they must not be active routers and act as routers in the cell.
1448 Only one router may be acting as primary router in the cell.  In the case
1449 of failure of the primary router may one of the backup routers become
1450 active.  The purpose of backup routers are in case of failure of the
1451 primary router to maintain working connections inside the cell and outside
1452 the cell and to avoid netsplits.
1453
1454 Backup routers are normal servers in the cell that are prepared to take
1455 over the tasks of the primary router if needed.  They need to have at
1456 least one direct and active connection to the primary router of the cell.
1457 This communication channel is used to send the router information to
1458 the backup router.  When the backup router connects to the primary router
1459 of the cell it MUST present itself as router server in the Connection
1460 Authentication protocol, even though it is normal server as long as the
1461 primary router is available.  Reason for this is that the configuration
1462 needed in the responder end requires usually router connection level
1463 configuration.  The responder, however must understand and treat the
1464 connection as normal server (except when feeding router level data to
1465 the backup router).
1466
1467 Backup router must know everything that the primary router knows to be
1468 able to take over the tasks of the primary router.  It is the primary
1469 router's responsibility to feed the data to the backup router.  If the
1470 backup router does not know all the data in the case of failure some
1471 connections may be lost.  The primary router of the cell must consider
1472 the backup router being actual router server when it feeds the data to
1473 it.
1474
1475 In addition of having direct connection to the primary router of the
1476 cell, the backup router must also have connection to the same router
1477 the primary router of the cell is connected.  However, it must not be
1478 active router connection meaning that the backup router must not use
1479 that channel as its primary route and it must not notify the router
1480 about having connected servers, channels and clients behind it.  It
1481 merely connects to the router.  This sort of connection is later
1482 referred as being passive connection.  Some keepalive actions may be
1483 needed by the router to keep the connection alive.
1484
1485 It is required that other normal servers have passive connections to
1486 the backup router(s) in the cell.  Some keepalive actions may be needed
1487 by the server to keep the connection alive.  After they notice the
1488 failure of the primary router they must start using the connection to
1489 the first backup router as their primary route.
1490
1491 Also, if any other router in the network is using the cell's primary
1492 router as its own primary router, it must also have passive connection
1493 to the cell's backup router.  It too is prepared to switch to use the
1494 backup router as its new primary router as soon as the orignal primary
1495 router becomes unresponsive.
1496
1497 All of the parties of this protocol knows which one is the backup router
1498 of the cell from their local configuration.  Each of the entity must
1499 be configured accordingly and care must be taken when configuring the
1500 backup routers, servers and other routers in the network.
1501
1502 It must be noted that some of the channel messages and private messages
1503 may be lost during the switch to the backup router.  The announcements
1504 assures that the state of the network is not lost during the switch.
1505
1506 It is RECOMMENDED that there would be at least one backup router in
1507 the cell.  It is NOT RECOMMENDED to have all servers in the cell acting
1508 as backup routers as it requires establishing several connections to
1509 several servers in the cell.  Large cells can easily have several
1510 backup routers in the cell.
1511
1512 The order of the backup routers are decided at the configuration phase.
1513 All the parties of this protocol must be configured accordingly to 
1514 understand the order of the backup routers.  It is not required that
1515 the backup server is actually active server in the cell.  Backup router
1516 may be a spare server in the cell that does not accept normal client
1517 connections at all.  It may be reserved purely for the backup purposes.
1518 These, however, are cell management issues.
1519
1520 If also the first backup router is down as well and there is another
1521 backup router in the cell then it will start acting as the primary
1522 router as described above.
1523
1524
1525 .ti 0
1526 3.13.1 Switching to Backup Router
1527
1528 When the primary router of the cell becomes unresponsive, for example
1529 by sending EOF to the connection, all the parties of this protocol MUST
1530 replace the old connection to the primary router with first configured
1531 backup router.  The backup router usually needs to do local modifications
1532 to its database in order to update all the information needed to maintain
1533 working routes.  The backup router must understand that clients that
1534 were orignated from the primary router are now originated from some of
1535 the existing server connections and must update them accordingly.  It
1536 must also remove those clients that were owned by the primary router
1537 since those connections were lost when the primary router became
1538 unresponsive.
1539
1540 All the other parties of the protocol must also update their local
1541 database to understand that the route to the primary router will now go
1542 to the backup router.
1543
1544 The servers connected to the backup router must announce their clients,
1545 channels, channel users, channel user modes and channel modes to the
1546 backup router.  This is to assure that none of the important notify 
1547 packets were lost during the switch to the backup router.  The backup
1548 router must check which of these announced entities it already have
1549 and distribute the new ones to the primary route.
1550
1551 The backup router too must announce its servers, clients, channels
1552 and other information to the new primary router.  The primary router
1553 of the backup router too must announce its informations to the backup
1554 router.  Both must process only the ones they do not know about.  If
1555 any of the announced modes does not match then they are enforced in
1556 normal manner defined later in this specification.
1557
1558
1559 .ti 0
1560 3.13.2 Resuming Primary Router
1561
1562 Usually the primary router is unresponsive only a short period of time
1563 and it is intended that the original router of the cell will reassume
1564 its position as primary router when it comes back online.  The backup
1565 router that is now acting as primary router of the cell must constantly
1566 try to connect to the original primary router of the cell.  It is
1567 RECOMMENDED that it would try to reconnect in 30 second intervals to
1568 the primary router.
1569
1570 When the connection is established to the primary router the backup
1571 resuming protocol is executed.  The protocol is advanced as follows:
1572
1573   1. Backup router sends SILC_PACKET_RESUME_ROUTER packet with type
1574      value 1 the primary router that came back online.  The packet
1575      will indicate the primary router has been replaced by the backup
1576      router.  After sending the packet the backup router will announce
1577      all of its channels, channel users, modes etc. to the primary
1578      router.
1579
1580   2. Backup router sends SILC_PACKET_RESUME_ROUTER packet with type
1581      value 2 to its current primary router to indicate that it will
1582      resign as being primary router.  Then, backup router sends the
1583      SILC_PACKET_RESUME_ROUTER packet with type value 1 to all
1584      connected servers to also indicate that it will resign as being
1585      primary router.
1586
1587   3. Backup router also send SILC_PACKET_RESUME_ROUTER packet with
1588      type value 2 to the router that is using the backup router
1589      currently as its primary router.
1590
1591   4. Any server and router that receives the SILC_PACKET_RESUME_ROUTER
1592      with type value 1 or 2 must reconnect immediately to the
1593      primary router of the cell that came back online.  After they
1594      have created the connection they MUST NOT use that connection
1595      as active primary route but still route all packets to the
1596      backup router.  After the connection is created they MUST send
1597      SILC_PACKET_RESUME_ROUTER with type value 3 back to the
1598      backup router.  The session ID value found in the first packet
1599      MUST be set in this packet.
1600
1601   5. Backup router MUST wait for all packets with type value 3 before
1602      it continues with the protocol.  It knows from the session ID values
1603      set in the packet when it have received all packets.  The session
1604      value should be different in all packets it have send earlier.
1605      After the packets is received the backup router sends the
1606      SILC_PACKET_RESUME_ROUTER packet with type value 4 to the
1607      primary router that came back online.  This packet will indicate 
1608      that the backup router is now ready to resign as being primary
1609      router.  The session ID value in this packet MUST be the same as
1610      in first packet sent to the primary router.  During this time
1611      the backup router should still route all packets it is receiving
1612      from server connections.
1613
1614   6. The primary router receives the packet and send the
1615      SILC_PACKET_RESUME_ROUTER with type value 5 to all connected servers
1616      including the backup router.  It also sends the packet with type
1617      value 6 to its primary router, and to the router that is using
1618      it as its primary router.  The Session ID value in this packet
1619      SHOULD be zero (0).
1620
1621   7. Any server and router that receives the SILC_PACKET_RESUME_ROUTER
1622      with type value 5 or 6 must switch their primary route to the
1623      new primary router and remove the route for the backup router, since
1624      it is not anymore the primary router of the cell.  They must also
1625      update their local database to understand that the clients are
1626      not originated from the backup router but from the locally connected
1627      servers.  After that they MUST announce their channels, channel
1628      users, modes etc. to the primary router.  They must not use the
1629      backup router connection after this and the connection is considered
1630      to be passive connection.  The implementations SHOULD be able
1631      to disable the connection without closing the actual link.
1632
1633 After this protocol is executed the backup router is now again normal
1634 server in the cell that has the backup link to the primary router.  The
1635 primary router feeds the router specific data again to the backup router.
1636 All server connections in the backup router are considered passive
1637 connections.
1638
1639 When the primary router of the cell comes back online and connects
1640 to its primary router, the remote primary router must send the 
1641 SILC_PACKET_RESUME_ROUTER with type value 20 indicating that the
1642 connection is not allowed since the router has been replaced by an
1643 backup router.  The session ID value in this packet SHOULD be zero (0).
1644 When the router receives this packet it must not use the connection
1645 as active connection but to understand that it cannot act as primary
1646 router in the cell.  It must wait that the backup router connects to
1647 it, and the backup resuming protocol is executed.
1648
1649 The following type values has been defined for SILC_PACKET_RESUME_ROUTER
1650 packet:
1651
1652   1    SILC_SERVER_BACKUP_START
1653   2    SILC_SERVER_BACKUP_START_GLOBAL
1654   3    SILC_SERVER_BACKUP_START_CONNECTED
1655   4    SILC_SERVER_BACKUP_START_ENDING
1656   5    SILC_SERVER_BACKUP_START_RESUMED
1657   6    SILC_SERVER_BACKUP_START_GLOBAL
1658   20   SILC_SERVER_BACKUP_START_REPLACED
1659
1660 If any other value is found in the type field the packet must be 
1661 discarded.  The SILC_PACKET_RESUME_ROUTER packet and its payload
1662 is defined in [SILC2].
1663
1664
1665 .ti 0
1666 3.13.3 Discussion on Backup Router Scheme
1667
1668 It is clear that this backup router support is not able to handle all
1669 possible situations arrising in unreliable network environment.  This
1670 scheme for example does not handle situation when the router actually
1671 does not go offline but the network link goes down temporarily.  It would
1672 require some intelligence to figure out when it is best time to switch
1673 to the backup router.  To make it even more complicated it is possible
1674 that the backup router may have not lost the network link to the primary
1675 router.
1676
1677 Other possible situation is when the network link is lost temporarily
1678 between two primary routers in the SILC network.  Unless the routers
1679 notice the link going down they cannot perhaps find alternative routes.
1680 Worst situation is when the link goes down only for a short period of
1681 time, thus causing lag.  Should the routers or servers find alternative
1682 routes if they cannot get response from the router during the lag?
1683 When alternative routes are being found it must be careful not to
1684 mess up existing primary routes between routers in the network.
1685
1686 It is suggested that the current backup router scheme is only temporary
1687 solution and existing backup router protocols are studied further.  It
1688 is also suggested that the backup router specification will be separated
1689 from this SILC specification Internet-Draft and additional specification
1690 is written on the subject.
1691
1692
1693 .ti 0
1694 4 SILC Procedures
1695
1696 This section describes various SILC procedures such as how the 
1697 connections are created and registered, how channels are created and
1698 so on.  The section describes the procedures only generally as details
1699 are described in [SILC2] and [SILC3].
1700
1701
1702 .ti 0
1703 4.1 Creating Client Connection
1704
1705 This section describes the procedure when client connects to SILC server.
1706 When client connects to server the server MUST perform IP address lookup
1707 and reverse IP address lookup to assure that the origin host really is
1708 who it claims to be.  Client, host, connecting to server SHOULD have 
1709 both valid IP address and fully qualified domain name (FQDN).
1710
1711 After that the client and server performs SILC Key Exchange protocol
1712 which will provide the key material used later in the communication.
1713 The key exchange protocol MUST be completed successfully before the
1714 connection registration may continue.  The SILC Key Exchange protocol
1715 is described in [SILC3].
1716
1717 Typical server implementation would keep a list of connections that it
1718 allows to connect to the server.  The implementation would check, for
1719 example, the connecting client's IP address from the connection list
1720 before the SILC Key Exchange protocol has been started.  Reason for
1721 this is that if the host is not allowed to connect to the server there
1722 is no reason to perform the key exchange protocol.
1723
1724 After successful key exchange protocol the client and server performs
1725 connection authentication protocol.  The purpose of the protocol is to
1726 authenticate the client connecting to the server.  Flexible
1727 implementation could also accept the client to connect to the server
1728 without explicit authentication.  However, if authentication is
1729 desired for a specific client it may be based on passphrase or
1730 public key authentication.  If authentication fails the connection
1731 MUST be terminated.  The connection authentication protocol is described
1732 in [SILC3].
1733
1734 After successful key exchange and authentication protocol the client
1735 registers itself by sending SILC_PACKET_NEW_CLIENT packet to the
1736 server.  This packet includes various information about the client
1737 that the server uses to create the client.  Server creates the client
1738 and sends SILC_PACKET_NEW_ID to the client which includes the created
1739 Client ID that the client MUST start using after that.  After that
1740 all SILC packets from the client MUST have the Client ID as the
1741 Source ID in the SILC Packet Header, described in [SILC2].
1742
1743 Client MUST also get the server's Server ID that is to be used as
1744 Destination ID in the SILC Packet Header when communicating with
1745 the server (for example when sending commands to the server).  The
1746 ID may be resolved in two ways.  Client can take the ID from an
1747 previously received packet from server that MUST include the ID,
1748 or to send SILC_COMMAND_INFO command and receive the Server ID as
1749 command reply.
1750
1751 Server MAY choose not to use the information received in the
1752 SILC_PACKET_NEW_CLIENT packet.  For example, if public key or 
1753 certificate were used in the authentication, server MAY use those
1754 informations rather than what it received from client.  This is suitable
1755 way to get the true information about client if it is available.
1756
1757 The nickname of client is initially set to the username sent in the
1758 SILC_PACKET_NEW_CLIENT packet.  User should set the nickname to more
1759 suitable by sending SILC_COMMAND_NICK command.  However, this is not
1760 required as part of registration process.
1761
1762 Server MUST also distribute the information about newly registered
1763 client to its router (or if the server is router, to all routers in
1764 the SILC network).  More information about this in [SILC2].
1765
1766
1767 .ti 0
1768 4.2 Creating Server Connection
1769
1770 This section describes the procedure when server connects to its
1771 router (or when router connects to other router, the cases are
1772 equivalent).  The procedure is very much alike when client connects
1773 to the server thus it is not repeated here.
1774
1775 One difference is that server MUST perform connection authentication
1776 protocol with proper authentication.  A proper authentication is based
1777 on passphrase or public key authentication.
1778
1779 After server and router has successfully performed the key exchange
1780 and connection authentication protocol, the server register itself
1781 to the router by sending SILC_PACKET_NEW_SERVER packet.  This packet
1782 includes the server's Server ID that it has created by itself and
1783 other relevant information about the server.
1784
1785 After router has received the SILC_PACKET_NEW_SERVER packet it
1786 distributes the information about newly registered server to all routers
1787 in the SILC network.  More information about this in [SILC2].
1788
1789 As client needed to resolve the destination ID this MUST be done by the
1790 server that connected to the router, as well.  The way to resolve it is
1791 to get the ID from previously received packet.  The server MAY also 
1792 use SILC_COMMAND_INFO command to resolve the ID.  Server MUST also start
1793 using its own Server ID as Source ID in SILC Packet Header and the
1794 router's Server ID as Destination when communicating with the router.
1795
1796
1797 .ti 0
1798 4.2.1 Announcing Clients, Channels and Servers
1799
1800 After server or router has connected to the remote router, and it already
1801 has connected clients and channels it MUST announce them to the router.
1802 If the server is router server, also all the local servers in the cell
1803 MUST be announced.
1804
1805 All clients are announced by compiling a list of ID Payloads into the
1806 SILC_PACKET_NEW_ID packet.  All channels are announced by compiling a
1807 list of Channel Payloads into the SILC_PACKET_NEW_CHANNEL packet.  Also, 
1808 the channel users on the channels must be announced by compiling a
1809 list of Notify Payloads with the SILC_NOTIFY_TYPE_JOIN notify type into
1810 the SILC_PACKET_NOTIFY packet.  The users' modes on the channel must 
1811 also be announced by compiling list of Notify Payloads with the 
1812 SILC_NOTIFY_TYPE_CUMODE_CHANGE notify type into the SILC_PACKET_NOTIFY
1813 packet.
1814
1815 The router MUST also announce the local servers by compiling list of
1816 ID Payloads into the SILC_PACKET_NEW_ID packet.
1817
1818 Also, clients' modes (user modes in SILC) MUST be announced.  This is
1819 done by compiling a list of Notify Payloads with the 
1820 SILC_NOTIFY_UMODE_CHANGE nofity type into the SILC_PACKET_NOTIFY packet.
1821
1822 Also, channel's topics MUST be announced by compiling a list of Notify
1823 Payloads with the SILC_NOTIFY_TOPIC_SET notify type into the
1824 SILC_PACKET_NOTIFY packet.
1825
1826 The router which receives these lists MUST process them and broadcast
1827 the packets to its primary route.
1828
1829 When processing the announced channels and channel users the router MUST
1830 check whether a channel exists already with the same name.  If channel
1831 exists with the same name it MUST check whether the Channel ID is
1832 different.  If the Channel ID is different the router MUST send the notify
1833 type SILC_NOTIFY_TYPE_CHANNEL_CHANGE to the server to force the channel ID
1834 change to the ID the router has.  If the mode of the channel is different
1835 the router MUST send the notify type SILC_NOTIFY_TYPE_CMODE_CHANGE to the
1836 server to force the mode change to the mode that the router has.
1837
1838 The router MUST also generate new channel key and distribute it to the
1839 channel.  The key MUST NOT be generated if the SILC_CMODE_PRIVKEY mode
1840 is set.
1841
1842 If the channel has channel founder on the router the router MUST send
1843 the notify type SILC_NOTIFY_TYPE_CUMODE_CHANGE to the server to force
1844 the mode change for the channel founder on the server.  The channel 
1845 founder privileges MUST be removed.
1846
1847 The router processing the channels MUST also compile a list of
1848 Notify Payloads with the SILC_NOTIFY_TYPE_JOIN notify type into the
1849 SILC_PACKET_NOTIFY and send the packet to the server.  This way the
1850 server (or router) will receive the clients on the channel that
1851 the router has.
1852
1853
1854 .ti 0
1855 4.3 Joining to a Channel
1856
1857 This section describes the procedure when client joins to a channel.
1858 Client joins to channel by sending command SILC_COMMAND_JOIN to the
1859 server.  If the receiver receiving join command is normal server the
1860 server MUST check its local list whether this channel already exists
1861 locally.  This would indicate that some client connected to the server
1862 has already joined to the channel.  If this is case the client is
1863 joined to the channel, new channel key is created and information about
1864 newly joined channel is sent to the router.  The router is informed
1865 by sending SILC_NOTIFY_TYPE_JOIN notify type.  The notify type MUST
1866 also be sent to the local clients on the channel.  The new channel key
1867 is also sent to the router and to local clients on the channel.
1868
1869 If the channel does not exist in the local list the client's command
1870 MUST be sent to the router which will then perform the actual joining
1871 procedure.  When server receives the reply to the command from the
1872 router it MUST be sent to the client which sent the command originally.
1873 Server will also receive the channel key from the server that it MUST
1874 send to the client which originally requested the join command.  The
1875 server MUST also save the channel key.
1876
1877 If the receiver of the join command is router it MUST first check its
1878 local list whether anyone in the cell has already joined to the channel.
1879 If this is the case the client is joined to the channel and reply is
1880 sent to the client.  If the command was sent by server the command reply
1881 is sent to the server which sent it.  Then the router MUST also create
1882 new channel key and distribute it to all clients on the channel and
1883 all servers that has clients on the channel.  Router MUST also send
1884 the SILC_NOTIFY_TYPE_JOIN notify type to local clients on the channel
1885 and to local servers that has clients on the channel.
1886
1887 If the channel does not exist on the router's local list it MUST
1888 check the global list whether the channel exists at all.  If it does
1889 the client is joined to the channel as described previously.  If
1890 the channel does not exist the channel is created and the client
1891 is joined to the channel.  The channel key is also created and
1892 distributed as previously described.  The client joining to the created
1893 channel is made automatically channel founder and both channel founder
1894 and channel operator privileges is set for the client.
1895
1896 If the router created the channel in the process, information about the
1897 new channel MUST be broadcasted to all routers.  This is done by 
1898 broadcasting SILC_PACKET_NEW_CHANNEL packet to the router's primary
1899 route.  When the router joins the client to the channel it MUST also
1900 send information about newly joined client to all routers in the SILC
1901 network.  This is done by broadcasting the SILC_NOTIFY_TYPE_JOIN notify
1902 type to the router's primary route. 
1903
1904 It is important to note that new channel key is created always when
1905 new client joins to channel, whether the channel has existed previously
1906 or not.  This way the new client on the channel is not able to decrypt
1907 any of the old traffic on the channel.  Client which receives the reply to
1908 the join command MUST start using the received Channel ID in the channel
1909 message communication thereafter.  Client also receives the key for the
1910 channel in the command reply.  Note that the channel key is never
1911 generated if the SILC_CMODE_PRIVKEY mode is set.
1912
1913
1914 .ti 0
1915 4.4 Channel Key Generation
1916
1917 Channel keys are created by router which creates the channel by taking
1918 enough randomness from cryptographically strong random number generator.
1919 The key is generated always when channel is created, when new client
1920 joins a channel and after the key has expired.  Key could expire for
1921 example in an hour.
1922
1923 The key MUST also be re-generated whenever some client leaves a channel.
1924 In this case the key is created from scratch by taking enough randomness
1925 from the random number generator.  After that the key is distributed to
1926 all clients on the channel.  However, channel keys are cell specific thus
1927 the key is created only on the cell where the client, which left the
1928 channel, exists.  While the server or router is creating the new channel
1929 key, no other client may join to the channel.  Messages that are sent
1930 while creating the new key are still processed with the old key.  After
1931 server has sent the SILC_PACKET_CHANNEL_KEY packet MUST client start
1932 using the new key.  If server creates the new key the server MUST also
1933 send the new key to its router.  See [SILC2] on more information about
1934 how channel messages must be encrypted and decrypted when router is
1935 processing them.
1936
1937 When client receives the SILC_PACKET_CHANNEL_KEY packet with the
1938 Channel Key Payload it MUST process the key data to create encryption
1939 and decryption key, and to create the HMAC key that is used to compute
1940 the MACs of the channel messages.  The processing is as follows:
1941
1942   channel_key  = raw key data
1943   HMAC key     = hash(raw key data)
1944
1945 The raw key data is the key data received in the Channel Key Payload.
1946 The hash() function is the hash function used in the HMAC of the channel.
1947 Note that the server MUST also save the channel key.
1948
1949
1950 .ti 0
1951 4.5 Private Message Sending and Reception
1952
1953 Private messages are sent point to point.  Client explicitly destines
1954 a private message to specific client that is delivered to only to that
1955 client.  No other client may receive the private message.  The receiver
1956 of the private message is destined in the SILC Packet Header as any
1957 other packet as well.
1958
1959 If the sender of a private message does not know the receiver's Client
1960 ID, it MUST resolve it from server.  There are two ways to resolve the
1961 client ID from server; it is RECOMMENDED that client implementations
1962 send SILC_COMMAND_IDENTIFY command to receive the Client ID.  Client
1963 MAY also send SILC_COMMAND_WHOIS command to receive the Client ID.
1964 If the sender has received earlier a private message from the receiver
1965 it should have cached the Client ID from the SILC Packet Header.
1966
1967 If server receives a private message packet which includes invalid
1968 destionation Client ID the server MUST send SILC_COMMAND_IDENTIFY
1969 command reply packet destined to the client with error status.
1970
1971 See [SILC2] for description of private message encryption and decryption
1972 process.
1973
1974
1975 .ti 0
1976 4.6 Private Message Key Generation
1977
1978 Private message MAY be protected by the key generated by the client.
1979 The key may be generated and sent to the other client by sending packet
1980 SILC_PACKET_PRIVATE_MESSAGE_KEY which travels through the network
1981 and is secured by session keys.  After that the private message key
1982 is used in the private message communication between those clients.
1983
1984 Other choice is to entirely use keys that are not sent through
1985 the SILC network at all.  This significantly adds security.  This key
1986 would be pre-shared-key that is known by both of the clients.  Both
1987 agree about using the key and starts sending packets that indicate
1988 that the private message is secured using private message key.
1989
1990 The key material used as private message key is implementation issue.
1991 However, SILC_PACKET_KEY_AGREEMENT packet MAY be used to negotiate
1992 the key material.  If the key is normal pre-shared-key or randomly
1993 generated key, and the SILC_PACKET_KEY_AGREEMENT was not used, then
1994 the key material SHOULD be processed as defined in the [SILC3].  In
1995 the processing, however, the HASH, as defined in [SILC3] MUST be 
1996 ignored.  After processing the key material it is employed as defined
1997 in [SILC3], however, the HMAC key material MUST be discarded.
1998
1999 If the key is pre-shared-key or randomly generated the implementations
2000 should use the SILC protocol's mandatory cipher as the cipher.  If the
2001 SKE was used to negotiate key material the cipher was negotiated as well.
2002
2003 .ti 0
2004 4.7 Channel Message Sending and Reception
2005
2006 Channel messages are delivered to group of users.  The group forms a
2007 channel and all clients on the channel receives messages sent to the
2008 channel.
2009
2010 Channel messages are destined to channel by specifying the Channel ID
2011 as Destination ID in the SILC Packet Header.  The server MUST then
2012 distribute the message to all clients on the channel by sending the
2013 channel message destined explicitly to a client on the channel.
2014
2015 See the [SILC2] for description of channel messege routing for router
2016 servers.
2017
2018 See [SILC2] for description of channel message encryption and decryption
2019 process.
2020
2021
2022 .ti 0
2023 4.8 Session Key Regeneration
2024
2025 Session keys MUST be regenerated periodically, say, once in an hour.
2026 The re-key process is started by sending SILC_PACKET_REKEY packet to
2027 other end, to indicate that re-key must be performed.  The initiator
2028 of the connection SHOULD initiate the re-key.
2029
2030 If perfect forward secrecy (PFS) flag was selected in the SILC Key
2031 Exchange protocol [SILC3] the re-key MUST cause new key exchange with
2032 SKE protocol.  In this case the protocol is secured with the old key
2033 and the protocol results to new key material.  See [SILC3] for more
2034 information.  After the SILC_PACKET_REKEY packet is sent the sender
2035 will perform the SKE protocol.
2036
2037 If PFS flag was set the resulted key material is processed as described
2038 in the section Processing the Key Material in [SILC3].  The difference
2039 with re-key in the processing is that the initial data for the hash 
2040 function is just the resulted key material and not the HASH as it
2041 is not computed at all with re-key.  Other than that, the key processing
2042 it equivalent to normal SKE negotiation.
2043
2044 If PFS flag was not set, which is the default case, then re-key is done
2045 without executing SKE protocol.  In this case, the new key is created by
2046 providing the current sending encryption key to the SKE protocol's key
2047 processing function.  The process is described in the section Processing
2048 the Key Material in [SILC3].  The difference in the processing is that
2049 the initial data for the hash function is the current sending encryption
2050 key and not the SKE's KEY and HASH values.  Other than that, the key
2051 processing is equivalent to normal SKE negotiation.
2052
2053 After both parties has regenerated the session key, both MUST send
2054 SILC_PACKET_REKEY_DONE packet to each other.  These packets are still
2055 secured with the old key.  After these packets, the subsequent packets
2056 MUST be protected with the new key.
2057
2058
2059 .ti 0
2060 4.9 Command Sending and Reception
2061
2062 Client usually sends the commands in the SILC network.  In this case
2063 the client simply sends the command packet to server and the server
2064 processes it and replies with command reply packet.
2065
2066 However, if the server is not able to process the command, it is sent 
2067 to the server's router.  This is case for example with commands such
2068 as, SILC_COMMAND_JOIN and SILC_COMMAND_WHOIS commands.  However, there
2069 are other commands as well.  For example, if client sends the WHOIS
2070 command requesting specific information about some client the server must
2071 send the WHOIS command to router so that all clients in SILC network
2072 are searched.  The router, on the other hand, sends the WHOIS command
2073 further to receive the exact information about the requested client.
2074 The WHOIS command travels all the way to the server which owns the client
2075 and it replies with command reply packet.  Finally, the server which
2076 sent the command receives the command reply and it must be able to
2077 determine which client sent the original command.  The server then
2078 sends command reply to the client.  Implementations should have some
2079 kind of cache to handle, for example, WHOIS information.  Servers
2080 and routers along the route could all cache the information for faster
2081 referencing in the future.
2082
2083 The commands sent by server may be sent hop by hop until someone is able
2084 to process the command.  However, it is preferred to destine the command
2085 as precisely as it is possible.  In this case, other routers en route
2086 MUST route the command packet by checking the true sender and true
2087 destination of the packet.  However, servers and routers MUST NOT route
2088 command reply packets to clients coming from other server.  Client
2089 MUST NOT accept command reply packet originated from anyone else but
2090 from its own server.
2091
2092
2093 .ti 0
2094 4.10 Closing Connection
2095
2096 When remote client connection is closed the server MUST send the notify
2097 type SILC_NOTIFY_TYPE_SIGNOFF to its primary router and to all channels
2098 the client was joined.  The server MUST also save the client's information
2099 for a period of time for history purposes.
2100
2101 When remote server or router connection is closed the server or router
2102 MUST also remove all the clients that was behind the server or router
2103 from the SILC Network.  The server or router MUST also send the notify
2104 type SILC_NOTIFY_TYPE_SERVER_SIGNOFF to its primary router and to all
2105 local clients that are joined on the same channels with the remote 
2106 server's or router's clients.
2107
2108
2109 .ti 0
2110 5 Security Considerations
2111
2112 Security is central to the design of this protocol, and these security
2113 considerations permeate the specification.  Common security considerations
2114 such as keeping private keys truly private and using adequate lengths for
2115 symmetric and asymmetric keys must be followed in order to maintain the
2116 security of this protocol.
2117
2118 Special attention must also be paid on the servers and routers that are
2119 running the SILC service.  The SILC protocol's security depends greatly
2120 on the security and the integrity of the servers and administrators that
2121 are running the service.  It is recommended that some form of registration
2122 is required by the server and router administrator prior acceptance to
2123 the SILC Network.  Even though, the SILC protocol is secure in a network
2124 of mutual distrust between clients, servers, routers and adminstrators
2125 of the servers, the client should be able to trust the servers they are
2126 using if they whish to do so.
2127
2128 It however must be noted that if the client requires absolute security
2129 by not trusting any of the servers or routers in the SILC Network, it can
2130 be accomplished by negotiating private keys outside the SILC Network,
2131 either using SKE or some other key exchange protocol, or to use some
2132 other external means for distributing the keys.  This applies for all 
2133 messages, private messages and channel messages.
2134
2135 It is important to note that SILC, like any other security protocol is
2136 not full proof system and cannot secure from insecure environment; the
2137 SILC servers and routers could very well be compromised.  However, to
2138 provide acceptable level of security and usability for end user the
2139 protocol use many times session keys or other keys generated by the
2140 servers to secure the messages.  This is intentional design feature to
2141 allow ease of use for end user.  This way the network is still usable,
2142 and remains encrypted even if the external means of distributing the
2143 keys is not working.  The implementation, however, may like to not
2144 follow this design feature, and always negotiate the keys outside SILC
2145 network.  This is acceptable solution and many times recommended.  The
2146 implementation still must be able to work with the server generated keys.
2147
2148 If this is unacceptable for the client or end user, the private keys
2149 negotiatied outside the SILC Network should always be used.  In the end
2150 it is always implementor's choice whether to negotiate private keys by
2151 default or whether to use the keys generated by the servers.
2152
2153 It is also recommended that router operators in the SILC Network would
2154 form a joint forum to discuss the router and SILC Network management
2155 issues.  Also, router operators along with the cell's server operators
2156 should have a forum to discuss the cell management issues.
2157
2158
2159 .ti 0
2160 6 References
2161
2162 [SILC2]      Riikonen, P., "SILC Packet Protocol", Internet Draft,
2163              April 2001.
2164
2165 [SILC3]      Riikonen, P., "SILC Key Exchange and Authentication 
2166              Protocols", Internet Draft, April 2001.
2167
2168 [SILC4]      Riikonen, P., "SILC Commands", Internet Draft, April 2001.
2169
2170 [IRC]        Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
2171              RFC 1459, May 1993.
2172
2173 [IRC-ARCH]   Kalt, C., "Internet Relay Chat: Architecture", RFC 2810,
2174              April 2000.
2175
2176 [IRC-CHAN]   Kalt, C., "Internet Relay Chat: Channel Management", RFC
2177              2811, April 2000.
2178
2179 [IRC-CLIENT] Kalt, C., "Internet Relay Chat: Client Protocol", RFC
2180              2812, April 2000.
2181
2182 [IRC-SERVER] Kalt, C., "Internet Relay Chat: Server Protocol", RFC
2183              2813, April 2000.
2184
2185 [SSH-TRANS]  Ylonen, T., et al, "SSH Transport Layer Protocol", 
2186              Internet Draft.
2187
2188 [PGP]        Callas, J., et al, "OpenPGP Message Format", RFC 2440,
2189              November 1998.
2190
2191 [SPKI]       Ellison C., et al, "SPKI Certificate Theory", RFC 2693,
2192              September 1999.
2193
2194 [PKIX-Part1] Housley, R., et al, "Internet X.509 Public Key 
2195              Infrastructure, Certificate and CRL Profile", RFC 2459,
2196              January 1999.
2197
2198 [Schneier]   Schneier, B., "Applied Cryptography Second Edition",
2199              John Wiley & Sons, New York, NY, 1996.
2200
2201 [Menezes]    Menezes, A., et al, "Handbook of Applied Cryptography",
2202              CRC Press 1997.
2203
2204 [OAKLEY]     Orman, H., "The OAKLEY Key Determination Protocol",
2205              RFC 2412, November 1998.
2206
2207 [ISAKMP]     Maughan D., et al, "Internet Security Association and
2208              Key Management Protocol (ISAKMP)", RFC 2408, November
2209              1998.
2210
2211 [IKE]        Harkins D., and Carrel D., "The Internet Key Exchange
2212              (IKE)", RFC 2409, November 1998.
2213
2214 [HMAC]       Krawczyk, H., "HMAC: Keyed-Hashing for Message
2215              Authentication", RFC 2104, February 1997.
2216
2217 [PKCS1]      Kalinski, B., and Staddon, J., "PKCS #1 RSA Cryptography
2218              Specifications, Version 2.0", RFC 2437, October 1998.
2219
2220 [RFC2119]    Bradner, S., "Key Words for use in RFCs to Indicate
2221              Requirement Levels", BCP 14, RFC 2119, March 1997.
2222
2223
2224
2225
2226
2227
2228 .ti 0
2229 7 Author's Address
2230
2231 .nf
2232 Pekka Riikonen
2233 Snellmanninkatu 34 A 15
2234 70100 Kuopio
2235 Finland
2236
2237 EMail: priikone@iki.fi
2238
2239 This Internet-Draft expires XXX