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