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