updates.
[silc.git] / doc / draft-riikonen-silc-spec-01.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 6 October 2000
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-01.txt                         6 October 2000
20 Expires: 6 Jun 2001
21
22 .in 3
23
24 .ce 3
25 Secure Internet Live Conferencing (SILC),
26 Protocol Specification
27 <draft-riikonen-silc-spec-01.txt>
28
29 .ti 0
30 Status of this Memo
31
32 This document is an Internet-Draft and is in full conformance with   
33 all provisions of Section 10 of RFC 2026.  Internet-Drafts are   
34 working documents of the Internet Engineering Task Force (IETF), its   
35 areas, and its working groups.  Note that other groups may also   
36 distribute working documents as Internet-Drafts.   
37
38 Internet-Drafts are draft documents valid for a maximum of six months   
39 and may be updated, replaced, or obsoleted by other documents at any   
40 time.  It is inappropriate to use Internet-Drafts as reference   
41 material or to cite them other than as "work in progress."   
42
43 The list of current Internet-Drafts can be accessed at   
44 http://www.ietf.org/ietf/1id-abstracts.txt   
45
46 The list of Internet-Draft Shadow Directories can be accessed at   
47 http://www.ietf.org/shadow.html   
48
49 The distribution of this memo is unlimited.  
50
51
52 .ti 0
53 Abstract
54
55 This memo describes a Secure Internet Live Conferencing (SILC)
56 protocol which provides secure conferencing services over insecure
57 network channel.  SILC is IRC [IRC] like protocol, however, it is 
58 not equivalent to IRC and does not support IRC.  Strong cryptographic
59 methods are used to protect SILC packets inside SILC network.  Two
60 other Internet Drafts relates very closely to this memo;  SILC Packet
61 Protocol [SILC2] and SILC Key Exchange and Authentication Protocols
62 [SILC3].
63
64
65
66
67
68
69
70
71 .ti 0
72 Table of Contents
73
74 .nf
75 1 Introduction ..................................................  3
76 2 SILC Concepts .................................................  3
77   2.1 SILC Network Topology .....................................  4
78   2.2 Communication Inside a Cell ...............................  5
79   2.3 Communication in the Network ..............................  6
80   2.4 Channel Communication .....................................  7
81   2.5 Router Connections ........................................  7
82 3 SILC Specification ............................................  8
83   3.1 Client ....................................................  8
84       3.1.1 Client ID ...........................................  9
85   3.2 Server .................................................... 10
86       3.2.1 Server's Local ID List .............................. 10
87       3.2.2 Server ID ........................................... 11 
88       3.2.3 SILC Server Ports ................................... 11
89   3.3 Router .................................................... 12
90       3.3.1 Router's Local ID List .............................. 12
91       3.3.2 Router's Global ID List ............................. 13
92       3.3.3 Router's Server ID .................................. 13
93   3.4 Channels .................................................. 14
94       3.4.1 Channel ID .......................................... 15
95   3.5 Operators ................................................. 15
96   3.6 SILC Commands ............................................. 15
97   3.7 SILC Packets .............................................. 16
98   3.8 Packet Encryption ......................................... 16
99       3.8.1 Determination of the Source and the Destination ..... 17
100       3.8.2 Client To Client .................................... 17
101       3.8.3 Client To Channel ................................... 19
102       3.8.4 Server To Server .................................... 19
103   3.9 Key Exchange And Authentication ........................... 20
104   3.10 Algorithms ............................................... 20
105       3.10.1 Ciphers ............................................ 20
106       3.10.2 Public Key Algorithms .............................. 21
107       3.10.3 MAC Algorithms ..................................... 21
108       3.10.4 Compression Algorithms ............................. 22
109   3.11 SILC Public Key .......................................... 22
110   3.12 SILC Version Detection ................................... 24
111 4 SILC Procedures ............................................... 25
112   4.1 Creating Client Connection ................................ 25
113   4.2 Creating Server Connection ................................ 26
114   4.3 Joining to a Channel ...................................... 27
115   4.4 Channel Key Generation .................................... 28
116   4.5 Private Message Sending and Reception ..................... 29
117   4.6 Private Message Key Generation ............................ 29
118   4.7 Channel Message Sending and Reception ..................... 30
119   4.8 Session Key Regeneration .................................. 30
120   4.9 Command Sending and Reception ............................. 30
121 5 SILC Commands ................................................. 31
122   5.1 SILC Commands Syntax ...................................... 31
123   5.2 SILC Commands List ........................................ 33
124   5.3 SILC Command Status Types ................................. 56
125       5.3.1 SILC Command Status Payload ......................... 56
126       5.3.2 SILC Command Status List ............................ 57
127 6 Security Considerations ....................................... 61
128 7 References .................................................... 61
129 8 Author's Address .............................................. 62
130
131
132 .ti 0
133 List of Figures
134
135 .nf
136 Figure 1:  SILC Network Topology
137 Figure 2:  Communication Inside cell
138 Figure 3:  Communication Between Cells
139 Figure 4:  Router Connections
140 Figure 5:  SILC Public Key
141 Figure 6:  SILC Command Status Payload
142
143
144 .ti 0
145 1. Introduction
146
147 This document describes a Secure Internet Live Conferencing (SILC)
148 protocol which provides secure conferencing services over insecure
149 network channel.  SILC is IRC [IRC] like protocol, however, it is 
150 not equivalent to IRC and does not support IRC.
151
152 Strong cryptographic methods are used to protect SILC packets inside
153 SILC network.  Two other Internet Drafts relates very closely to this
154 memo; SILC Packet Protocol [SILC2] and SILC Key Exchange and
155 Authentication Protocols [SILC3].
156
157 The protocol uses extensively packets as conferencing protocol 
158 requires message and command sending.  The SILC Packet Protocol is
159 described in [SILC2] and should be read to fully comprehend this
160 document and protocol.  [SILC2] also describes the packet encryption
161 and decryption in detail.
162
163 The security of SILC protocol and for any security protocol for that
164 matter is based on strong and secure key exchange protocol.  The SILC
165 Key Exchange protocol is described in [SILC3] along with connection
166 authentication protocol and should be read to fully comprehend this
167 document and protocol.
168
169 The SILC protocol has been developed to work on TCP/IP network
170 protocol, although it could be made to work on other network protocols
171 with only minor changes.  However, it is recommended that TCP/IP
172 protocol is used under SILC protocol.  Typical implementation would
173 be made in client-server model.
174
175
176 .ti 0
177 2. SILC Concepts
178
179 This section describes various SILC protocol concepts that forms the 
180 actual protocol, and in the end, the actual SILC network.  The mission
181 of the protocol is to deliver messages from clients to other clients 
182 through routers and servers in secure manner.  The messages may also 
183 be delivered from one client to many clients forming a group, also 
184 known as a channel.
185
186 This section does not focus to security issues, instead basic network 
187 concepts are introduced to make the topology of the SILC network 
188 clear.
189
190
191 .ti 0
192 2.1 SILC Network Topology
193
194 SILC network is a cellular network as opposed to tree style network 
195 topology.  The rationale for this is to have servers that can perform 
196 specific kind of tasks what other servers cannot perform.  This leads 
197 to two kinds of servers; normal SILC servers and SILC routers.
198
199 A difference between normal server and router server is that routers 
200 knows everything about everything in the network.  They also do the 
201 actual routing of the messages to the correct receiver.  Normal servers 
202 knows only about local information and nothing about global information.
203 This makes the network faster as there are less servers that needs to 
204 keep global information up to date at all time.
205
206 This, on the other hand, leads to cellular like network, where routers 
207 are in the center of the cell and servers are connected to the router.
208
209 Following diagram represents SILC network topology.
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227 .in 8
228 .nf
229   ---- ---- ----         ---- ---- ----
230  | S8 | S5 | S4 |       | S7 | S5 | S6 |
231  ----- ---- -----       ----- ---- -----
232 | S7 | S/R1 | S2 | --- | S8 | S/R2 | S4 |
233  ---- ------ ----       ---- ------ ----
234  | S6 | S3 | S1 |       | S1 | S3 | S2 |         ---- ----
235   ---- ---- ----         ---- ---- ----         | S3 | S1 |
236      Cell 1.   \\             Cell 2.  | \\____  ----- -----
237                 |                     |        | S4 | S/R4 |
238     ---- ---- ----         ---- ---- ----       ---- ------
239    | S7 | S4 | S2 |       | S1 | S3 | S2 |      | S2 | S5 |
240    ----- ---- -----       ----- ---- -----       ---- ----
241   | S6 | S/R3 | S1 | --- | S4 | S/R5 | S5 | ____/ Cell 4.
242    ---- ------ ----       ---- ------ ----
243    | S8 | S5 | S3 |       | S6 | S7 | S8 |     ... etc ...
244     ---- ---- ----         ---- ---- ----
245        Cell 3.                Cell 5.
246 .in 3
247
248 .ce
249 Figure 1:  SILC Network Topology
250
251
252 A cell is formed when a server or servers connect to one router.  In
253 SILC network normal server cannot directly connect to other normal
254 server.  Normal server may only connect to SILC router which then
255 routes the messages to the other servers in the cell.  Router servers
256 on the other hand may connect to other routers to form the actual SILC 
257 network, as seen in above figure.  However, router is also normal SILC 
258 server; clients may connect to it the same way as to normal SILC 
259 servers.  Normal server also cannot have active connections to more 
260 than one router.  Normal server cannot be connected to two different 
261 cells.  Router servers, on the other hand, may have as many router to 
262 router connections as needed.
263
264 There are many issues in this network topology that needs to be careful
265 about.  Issues like the size of the cells, the number of the routers in 
266 the SILC network and the capacity requirements of the routers.  These
267 issues should be discussed in the Internet Community and additional
268 documents on the issue will be written.
269
270
271 .ti 0
272 2.2 Communication Inside a Cell
273
274 It is always guaranteed that inside a cell message is delivered to the 
275 recipient with at most two server hops.  Client who is connected to
276 server in the cell and is talking on channel to other client connected 
277 to other server in the same cell, will have its messages delivered from 
278 its local server first to the router of the cell, and from the router 
279 to the other server in the cell.
280
281 Following diagram represents this scenario:
282
283
284 .in 25
285 .nf
286 1 --- S1     S4 --- 5
287          S/R
288  2 -- S2     S3
289      /        |
290     4         3
291 .in 3
292
293
294 .ce
295 Figure 2:  Communication Inside cell
296
297
298 Example:  Client 1. connected to Server 1. message sent to
299           Client 4. connected to Server 2. travels from Server 1.
300           first to Router which routes the message to Server 2.
301           which then sends it to the Client 4.  All the other
302           servers in the cell will not see the routed message.
303
304
305 If client is connected directly to the router, as router is also normal 
306 SILC server, the messages inside the cell are always delivered only with 
307 one server hop.  If clients communicating with each other are connected 
308 to the same server, no router interaction is needed.  This is the optimal
309 situation of message delivery in the SILC network.
310
311
312 .ti 0
313 2.3 Communication in the Network
314
315 If the message is destined to server that does not belong to local cell 
316 the message is routed to the router server to which the destination 
317 server belongs, if the local router is connected to destination router.
318 If there is no direct connection to the destination router, the local
319 router routes the message to its primary route.  Following diagram
320 represents message sending between cells.
321
322
323 .in 16
324 .nf
325 1 --- S1     S4 --- 5            S2 --- 1
326          S/R - - - - - - - - S/R
327  2 -- S2     S3           S1
328      /        |             \\
329     4         3              2
330
331    Cell 1.               Cell 2.
332 .in 3
333
334
335 .ce
336 Figure 3:  Communication Between Cells
337
338
339 Example:  Client 5. connected to Server 4. in Cell 1. message sent
340           to Client 2. connected to Server 1. in Cell 2. travels
341           from Server 4. to Router which routes the message to
342           Router in Cell 2, which then routes the message to 
343           Server 1.  All the other servers and routers in the
344           network will not see the routed message.
345
346
347 The optimal case of message delivery from client point of view is
348 when clients are connected directly to the routers and the messages
349 are delivered from one router to the other router.
350
351
352 .ti 0 
353 2.4 Channel Communication
354
355 Messages may be sent to group of clients as well.  Sending messages to
356 many clients works the same way as sending messages point to point, from
357 message delivery point of view.  Security issues are another matter
358 which are not discussed in this section.
359
360 Router server handles the message routing to multiple recipients.  If 
361 any recipient is not in the same cell as the sender the messages are 
362 routed further.
363
364 Server distributes the channel message to its local clients who are 
365 joined to the channel.  Also, router distributes the message to its 
366 local clients on the channel.
367
368
369 .ti 0
370 2.5 Router Connections
371
372 Router connections play very important role in making the SILC like
373 network topology to work.  For example, sending broadcast packets in
374 SILC network require special connections between routers; routers must
375 be connected in specific way.
376
377 Every router has their primary route which is a connection to another
378 router in the network.  Unless there is only two routers in the network
379 must not routers use each other as their primary routes.  The router
380 connections in the network must form a circular.
381
382 Example with three routers in the network:
383
384
385
386
387
388
389
390 .in 16
391 .nf
392     S/R1 - > - > - > - > - > - > - S/R2
393      \\                               /
394       ^                             v
395        \\ - < -  < - S/R3 - < - < - /
396 .in 3
397
398
399 .ce
400 Figure 4:  Router Connections
401
402
403 Example:  Network with three routers.  Router 1. uses Router 2. as its
404           primary router.  Router 2. uses Router 3. as its primary router,
405           and Router 3. uses Router 1. as its primary router.  There may
406           be other direct connections between the routers but they must
407           not be used as primary routes.
408
409 The above example is applicable to any amount of routers in the network
410 except for two routers.  If there are only two routers in the network both
411 routers must be able to handle situation where they use each other as their
412 primary routes.
413
414 The issue of router connections are very important especially with SILC
415 broadcast packets.  Usually all router wide information in the network is
416 distributed by SILC broadcast packets.
417
418
419 .ti 0
420 3. SILC Specification
421
422 This section describes the SILC protocol.  However, [SILC2] and
423 [SILC3] describes other important protocols that are part of this SILC
424 specification and must be read.
425
426
427 .ti 0
428 3.1 Client
429
430 A client is a piece of software connecting to SILC server.  SILC client 
431 cannot be SILC server.  Purpose of clients is to provide the user 
432 interface of the SILC services for end user.  Clients are distinguished
433 from other clients by unique Client ID.  Client ID is a 128 bit ID that
434 is used in the communication in the SILC network.  The client ID is 
435 based on the nickname selected by the user.  User uses logical nicknames
436 in communication which are then mapped to the corresponding Client ID.
437 Client ID's are low level identifications and must not be seen by the
438 end user.
439
440 Clients provide other information about the end user as well. Information
441 such as the nickname of the user, username and the hostname of the end 
442 user and user's real name.  See section 3.2 Server for information of 
443 the requirements of keeping this information.
444
445 The nickname selected by the user is not unique in the SILC network.
446 There can be 2^8 same nicknames for one IP address. As for comparison to
447 IRC [IRC] where nicknames are unique this is a fundamental difference
448 between SILC and IRC.  This causes the server names to be used along
449 with the nicknames to identify specific users when sending messages.
450 This feature of SILC makes IRC style nickname-wars obsolete as no one
451 owns their nickname; there can always be someone else with the same
452 nickname.  Another difference is that there are no limit of the length
453 of the nickname in the SILC.
454
455
456 .ti 0
457 3.1.1 Client ID
458
459 Client ID is used to identify users in the SILC network.  The Client ID
460 is unique to the extent that there can be 2^128 different Client ID's.
461 Collisions are not expected to happen.  The Client ID is defined as 
462 follows.
463
464 .in 6
465 128 bit Client ID based on IPv4 addresses:
466
467 32 bit  ServerID IP address (bits 1-32)
468  8 bit  Random number
469 88 bit  Truncated MD5 hash value of the nickname
470
471 o Server ID IP address - Indicates the server where this
472   client is coming from.  The IP address hence equals the
473   server IP address where to the client has connected.
474
475 o Random number - Random number to further randomize the
476   Client ID.  This makes it possible to have 2^8 same
477   nicknames from the same server IP address.
478
479 o MD5 hash - MD5 hash value of the nickname is truncated
480   taking 88 bits from the start of the hash value.  This
481   hash value is used to search the user's Client ID from
482   the ID lists.
483
484 .in 3
485 Collisions could occur when more than 2^8 clients using same nickname
486 from the same server IP address is connected to the SILC network.  
487 Server must be able to handle this situation by refusing to accept 
488 anymore of that nickname.
489
490 Another possible collision may happen with the truncated hash value of
491 the nickname.  It could be possible to have same truncated hash value for
492 two different nicknames.  However, this is not expected to happen nor
493 cause any problems if it would occur.  Nicknames are usually logical and
494 it is unlikely to have two distinct logical nicknames produce same
495 truncated hash value.
496
497
498 .ti 0
499 3.2 Server
500
501 Servers are the most important parts of the SILC network.  They form the
502 basis of the SILC, providing a point to which clients may connect to.
503 There are two kinds of servers in SILC; normal servers and router servers.
504 This section focus on the normal server and router server is described
505 in the section 3.3 Router.
506
507 Normal servers may not directly connect to other normal server.  Normal
508 servers may only directly connect to router server.  If the message sent
509 by the client is destined outside the local server it is always sent to
510 the router server for further routing.  Server may only have one active
511 connection to router on same port.  Normal server may not connect to other
512 cell's router except in situations where its cell's router is unavailable.
513
514 Servers and routers in the SILC network are considered to be trusted.
515 With out a doubt, servers that are set to work on ports above 1023 are
516 not considered to be trusted.  Also, the service provider acts important
517 role in the server's trustworthy.
518
519
520 .ti 0
521 3.2.1 Server's Local ID List
522
523 Normal server keeps various information about the clients and their end
524 users connected to it.  Every normal server must keep list of all locally
525 connected clients, Client ID's, nicknames, usernames and hostnames and
526 user's real name.  Normal servers only keeps local information and it
527 does not keep any global information.  Hence, normal servers knows only
528 about their locally connected clients.  This makes servers efficient as
529 they don't have to worry about global clients.  Server is also responsible
530 of creating the Client ID's for their clients.
531
532 Normal server also keeps information about locally created channels and
533 their Channel ID's.
534
535
536 Hence, local list for normal server includes:
537
538 .in 6
539 server list        - Router connection
540    o Server name
541    o Server IP address
542    o Server ID
543    o Sending key
544    o Receiving key
545    o Public key
546
547
548
549
550 client list        - All clients in server
551    o Nickname
552    o Username@host
553    o Real name
554    o Client ID
555    o Sending key
556    o Receiving key
557
558 channel list       - All channels in server
559    o Channel name
560    o Channel ID
561    o Client ID's on channel
562    o Client ID modes on channel
563    o Channel key
564 .in 3
565
566
567
568 .ti 0
569 3.2.2 Server ID
570
571 Servers are distinguished from other servers by unique 64 bit Server ID.
572 The Server ID is used in the SILC to route messages to correct servers.
573 Server ID's also provide information for Client ID's, see section 3.1.1
574 Client ID.  Server ID is defined as follows.
575
576 .in 6
577 64 bit Server ID based on IPv4 addresses:
578
579 32 bit  IP address of the server
580 16 bit  Port
581 16 bit  Random number
582
583 o IP address of the server - This is the real IP address of
584   the server.
585
586 o Port - This is the port the server is bound to.
587
588 o Random number - This is used to further randomize the Server ID.
589
590 .in 3
591 Collisions are not expected to happen in any conditions.  The Server ID
592 is always created by the server itself and server is responsible of
593 distributing it to the router.
594
595
596 .ti 0
597 3.2.3 SILC Server Ports
598
599 Following ports has been assigned by IANA for the SILC protocol:
600
601 .in 10
602 silc            706/tcp    SILC
603 silc            706/udp    SILC
604 .in 3
605
606 If there are needs to create new SILC networks in the future the port
607 numbers must be officially assigned by the IANA.
608
609 Server on network above privileged ports (>1023) should not be trusted
610 as they could have been set up by untrusted party.
611
612
613 .ti 0
614 3.3 Router
615
616 Router server in SILC network is responsible for keeping the cell together
617 and routing messages to other servers and to other routers.  Router server
618 is also a normal server thus clients may connect to it as it would be
619 just normal SILC server.
620
621 However, router servers has a lot of important tasks that normal servers
622 do not have.  Router server knows everything about everything in the SILC.
623 They know all clients currently on SILC, all servers and routers and all
624 channels in SILC.  Routers are the only servers in SILC that care about
625 global information and keeping them up to date at all time.  And, this
626 is what they must do.
627
628
629 .ti 0
630 3.3.1 Router's Local ID List
631
632 Router server as well must keep local list of connected clients and
633 locally created channels.  However, this list is extended to include all
634 the informations of the entire cell, not just the server itself as for
635 normal servers.
636
637 However, on router this list is a lot smaller since routers do not keep
638 information about user's nickname, username and hostname and real name
639 since these are not needed by the router.  Router keeps only information
640 that it needs.
641
642
643 Hence, local list for router includes:
644
645 .in 6
646 server list        - All servers in the cell
647    o Server name
648    o Server ID
649    o Router's Server ID
650    o Sending key
651    o Receiving key
652
653 client list        - All clients in the cell
654    o Client ID
655
656
657 channel list       - All channels in the cell
658    o Channel ID
659    o Client ID's on channel
660    o Client ID modes on channel
661    o Channel key
662 .in 3
663
664
665 Note that locally connected clients and other information include all the
666 same information as defined in section section 3.2.1 Server's Local ID
667 List.
668
669
670 .ti 0
671 3.3.2 Router's Global ID List
672
673 Router server must also keep global list.  Normal servers do not have
674 global list as they know only about local information.  Global list
675 includes all the clients on SILC, their Client ID's, all created channels
676 and their Channel ID's and all servers and routers on SILC and their
677 Server ID's.  That is said, global list is for global information and the
678 list must not include the local information already on the router's local
679 list.
680
681 Note that the global list does not include information like nicknames,
682 usernames and hostnames or user's real names.  Router does not keep
683 these informations as they are not needed by the router.  This 
684 information is available from the client's server which maybe queried
685 when needed.
686
687 Hence, global list includes:
688
689 .in 6
690 server list        - All servers in SILC
691    o Server name
692    o Server ID
693    o Router's Server ID
694
695
696 client list        - All clients in SILC
697    o Client ID
698
699 channel list       - All channels in SILC
700    o Channel ID
701    o Client ID's on channel
702    o Client ID modes on channel
703 .in 3
704
705
706 .ti 0
707 3.3.3 Router's Server ID
708
709 Router's Server ID's are equivalent to normal Server ID's.  As routers
710 are normal servers as well same types of ID's applies for routers as well.
711 Thus, see section 3.2.2 Server ID.  Server ID's for routers are always
712 created by the remote router where the router is connected to.
713
714
715 .ti 0
716 3.4 Channels
717
718 A channel is a named group of one or more clients which will all receive
719 messages addressed to that channel.  The channel is created when first
720 client requests JOIN command to the channel, and the channel ceases to
721 exist when the last client has left it.  When channel exists, any client
722 can reference it using the name of the channel.
723
724 Channel names are unique although the real uniqueness comes from 64 bit
725 Channel ID that unifies each channel.  However, channel names are still
726 unique and no two global channels with same name may exist.  Channel name
727 is a string which begins with `#' character.  There is no limit on the
728 length of the channel name.  Channel names may not contain any spaces
729 (`  '), any non-printable ASCII characters, commas (`,') and wildcard
730 characters.
731
732 Channels can have operators that can administrate the channel and
733 operate all of its modes.  Following operators on channel exist on SILC
734 network.
735
736 .in 6
737 o Channel founder - When channel is created the joining client becomes
738   channel founder.  Channel founder is channel operator with some more
739   privileges.  Basically, channel founder can fully operate the channel
740   and all of its modes.  The privileges are limited only to the particular
741   channel.  There can be only one channel founder per channel.  Channel
742   founder supersedes channel operator's privileges.
743
744   Channel founder privileges cannot be removed by any other operator on
745   channel.  When channel founder leaves the channel there is no channel
746   founder on the channel.  Channel founder also cannot be removed by
747   force from the channel.
748
749 o Channel operator - When client joins to channel that has not existed
750   previously it will become automatically channel operator (and channel
751   founder discussed above).  Channel operator is able administrate the
752   channel, set some modes on channel, remove a badly behaving client from
753   the channel and promote other clients to become channel operator.
754   The privileges are limited only to the particular channel.
755
756   Normal channel user may be promoted (opped) to channel operator
757   gaining channel operator privileges.  Channel founder or other channel
758   operator may also demote (deop) channel operator to normal channel
759   user.
760 .in 3
761
762
763 .ti 0
764 3.4.1 Channel ID
765
766 Channels are distinguished from other channels by unique Channel ID.
767 The Channel ID is a 64 bit ID and collisions are not expected to happen
768 in any conditions.  Channel names are just for logical use of channels.
769 The Channel ID is created by the server where the channel is created.
770 The Channel ID is defined as follows.
771
772 .in 6
773 64 bit Channel ID based on IPv4 addresses:
774
775 32 bit  Router's Server ID IP address (bits 1-32)
776 16 bit  Router's Server ID port (bits 33-48)
777 16 bit  Random number
778
779 o Router's Server ID IP address - Indicates the IP address of 
780   the router of the cell where this channel is created.  This is 
781   taken from the router's Server ID.  This way SILC router knows 
782   where this channel resides in the SILC network.
783
784 o Router's Server ID port - Indicates the port of the channel on 
785   the server.  This is taken from the router's Server ID.
786
787 o Random number - To further randomize the Channel ID.  This makes
788   sure that there are no collisions.  This also means that
789   in a cell there can be 2^16 channels.
790 .in 3
791
792
793 .ti 0
794 3.5 Operators
795
796 Operators are normal users with extra privileges to their server or
797 router.  Usually these people are SILC server and router administrators
798 that take care of their own server and clients on them.  The purpose of
799 operators is to administrate the SILC server or router.  However, even
800 an operator with highest privileges is not able to enter invite-only
801 channel, to gain access to the contents of a encrypted and authenticated
802 packets traveling in the SILC network or to gain channel operator
803 privileges on public channels without being promoted.  They have the
804 same privileges as everyone else except they are able to administrate
805 their server or router.
806
807
808 .ti 0
809 3.6 SILC Commands
810
811 Commands are very important part on SILC network especially for client
812 which uses commands to operate on the SILC network.  Commands are used
813 to set nickname, join to channel, change modes and many other things.
814
815 Client usually sends the commands and server replies by sending a reply
816 packet to the command.  Server may also send commands usually to serve
817 the original client's request.  However, server may not send command
818 to client and there are some commands that server must not send.  Server
819 is also able to send the forwarded command packets.  For example, 
820 SILC_COMMAND_JOIN is always forwarded packet.  See [SILC2] for more
821 about packet forwarding.
822
823 Note that the command reply is usually sent only after client has sent
824 the command request but server is allowed to send command reply packet
825 to client even if client has not requested the command.  Client may,
826 however, choose ignore the command reply, but should not.
827
828 It is expected that some of the commands may be miss-used by clients
829 resulting various problems on the server side.  Every implementation
830 should assure that commands may not be executed more than once, say,
831 in two (2) seconds.  This should be sufficient to prevent the miss-use
832 of commands.
833
834 SILC commands are described in section 5 SILC Commands.
835
836
837 .ti 0
838 3.7 SILC Packets
839
840 Packets are naturally the most important part of the protocol and the
841 packets are what actually makes the protocol.  Packets in SILC network
842 are always encrypted using, usually, the shared secret session key
843 or some other key, for example, channel key, when encrypting channel
844 messages.  The SILC Packet Protocol is a wide protocol and is described
845 in [SILC2].  This document does not define or describe details of
846 SILC packets.
847
848
849
850 .ti 0
851 3.8 Packet Encryption
852
853 All packets passed in SILC network must be encrypted.  This section
854 defines how packets must be encrypted in the SILC network.  The detailed
855 description of the actual encryption process of the packets are
856 described in [SILC2].
857
858 Client and its server shares secret symmetric session key which is
859 established by the SILC Key Exchange Protocol, described in [SILC3]. 
860 Every packet sent from client to server, with exception of packets for
861 channels, are encrypted with this session key.
862
863 Channels has their own key that are shared by every client on the channel.
864 However, the channel keys are cell specific thus one cell does not know
865 the channel key of the other cell, even if that key is for same channel.
866 Channel key is also known by the routers and all servers that has clients
867 on the channel.  However, channels may have channel private keys that
868 are entirely local setting for client.  All clients on the channel must
869 know the channel private key before hand to be able to talk on the
870 channel.  In this case, no server or router knows the key for channel.
871
872 Server shares secret symmetric session key with router which is
873 established by the SILC Key Exchange Protocol.  Every packet passed from
874 server to router, with exception of packets for channels, are encrypted
875 with the shared session key.  Same way, router server shares secret
876 symmetric key with its primary route.  However, every packet passed
877 from router to other router, including packets for channels, are
878 encrypted with the shared session key.  Every router connection has
879 their own session keys.
880
881
882 .ti 0
883 3.8.1 Determination of the Source and the Destination
884
885 The source and the destination of the packet needs to be determined
886 to be able to route the packets to correct receiver.  This information
887 is available in the SILC Packet Header which is included in all packets
888 sent in SILC network.  The SILC Packet Header is described in [SILC2].
889
890 The header is always encrypted with the session key who is next receiver
891 of the packet along the route.  The receiver of the packet, for example
892 a router along the route, is able to determine the sender and the
893 destination of the packet by decrypting the SILC Packet Header and
894 checking the ID's attached to the header.  The ID's in the header will
895 tell to where the packet needs to be sent and where it is coming from.
896
897 The header in the packet does not change during the routing of the
898 packet.  The original sender, for example client, assembles the packet
899 and the packet header and server or router between the sender and the
900 receiver must not change the packet header.
901
902 Note that the packet and the packet header may be encrypted with
903 different keys.  For example, packets to channels are encrypted with
904 the channel key, however, the header is encrypted with the session key
905 as described above.  However, the header and the packet may be encrypted
906 with same key.  This is case, for example, with command packets.
907
908
909 .ti 0
910 3.8.2 Client To Client
911
912 Process of message delivery and encryption from client to another
913 client is as follows.
914
915 Example:  Private message from client to another client on different
916           servers.  Clients do not share private message delivery
917           keys; normal session keys are used.
918
919 o Client 1. sends encrypted packet to its server.  The packet is
920   encrypted with the session key shared between client and its
921   server.
922
923 o Server determines the destination of the packet and decrypts
924   the packet.  Server encrypts the packet with session key shared
925   between the server and its router, and sends the packet to the
926   router.
927
928 o Router determines the destination of the packet and decrypts
929   the packet.  Router encrypts the packet with session key 
930   shared between the router and the destination server, and sends
931   the packet to the server.
932
933 o Server determines the client to which the packet is destined
934   to and decrypts the packet.  Server encrypts the packet with
935   session key shared between the server and the destination client,
936   and sends the packet to the client.
937
938 o Client 2. decrypts the packet.
939
940
941 Example:  Private message from client to another client on different
942           servers.  Clients has established secret shared private
943           message delivery key with each other and that is used in 
944           the message encryption.
945
946 o Client 1. sends encrypted packet to its server.  The packet is
947   encrypted with the private message delivery key shared between
948   clients.
949
950 o Server determines the destination of the packet and sends the 
951   packet to the router.
952
953 o Router determines the destination of the packet and sends the
954   packet to the server.
955
956 o Server determines the client to which the packet is destined
957   to and sends the packet to the client.
958
959 o Client 2. decrypts the packet with the secret shared key.
960
961
962 If clients share secret key with each other the private message
963 delivery is much simpler since servers and routers between the
964 clients do not need to decrypt and re-encrypt the packet.
965
966 The process for clients on same server is much simpler as there are
967 no need to send the packet to the router.  The process for clients 
968 on different cells is same as above except that the packet is routed 
969 outside the cell.  The router of the destination cell routes the 
970 packet to the destination same way as described above.
971
972
973 .ti 0
974 3.8.3 Client To Channel
975
976 Process of message delivery from client on channel to all the clients
977 on the channel.
978
979 Example:  Channel of four users; two on same server, other two on
980           different cells.  Client sends message to the channel.
981
982 o Client 1. encrypts the packet with channel key and sends the
983   packet to its server.
984
985 o Server determines local clients on the channel and sends the
986   packet to the Client on the same server.  Server then sends
987   the packet to its router for further routing.
988
989 o Router determines local clients on the channel, if found
990   sends packet to the local clients.  Router determines global
991   clients on the channel and sends the packet to its primary
992   router or fastest route.
993
994 o (Other router(s) do the same thing and sends the packet to
995    the server(s))
996
997 o Server determines local clients on the channel and sends the
998   packet to the client.
999
1000 o All clients receiving the packet decrypts the packet.
1001
1002
1003 .ti 0
1004 3.8.4 Server To Server
1005
1006 Server to server packet delivery and encryption is described in above
1007 examples. Router to router packet delivery is analogous to server to
1008 server.  However, some packets, such as channel packets, are processed
1009 differently.  These cases are described later in this document and
1010 more in detail in [SILC2].
1011
1012
1013 .ti 0
1014 3.9 Key Exchange And Authentication
1015
1016 Key exchange is done always when for example client connects to server
1017 but also when server and router and router and router connects to each
1018 other.  The purpose of key exchange protocol is to provide secure key
1019 material to be used in the communication.  The key material is used to
1020 derive various security parameters used to secure SILC packets.  The
1021 SILC Key Exchange protocol is described in detail in [SILC3].
1022
1023 Authentication is done after key exchange protocol has been successfully
1024 completed.  The purpose of authentication is to authenticate for example
1025 client connecting to the server.  However, Usually clients are accepted
1026 to connect to server without explicit authentication.  Servers are
1027 required use authentication protocol when connecting.  The authentication
1028 may be based on passphrase (pre-shared-secret) or public key.  The
1029 connection authentication protocol is described in detail in [SILC3].
1030
1031
1032 .ti 0
1033 3.9.1 Authentication Payload
1034
1035 Authentication payload is used separately from the SKE and the Connection
1036 authentication protocol.  It is used during the session to authenticate
1037 with the remote.  For example, the client can authenticate itself to the
1038 server to be server operator.  In this case, Authentication Payload is
1039 used.
1040
1041 The format of the Authentication Payload is as follows:
1042
1043
1044 .in 5
1045 .nf
1046                      1                   2                   3
1047  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
1048 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1049 |        Payload Length         |     Authentication Method     |
1050 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1051 |      Public Data Length       |                               |
1052 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1053 |                                                               |
1054 ~                           Public Data                         ~
1055 |                                                               |
1056 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1057 |   Authentication Data Length  |                               |
1058 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1059 |                                                               |
1060 ~                       Authentication Data                     ~
1061 |                                                               |
1062 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+|
1063 .in 3
1064  
1065 .ce
1066 Figure 5:  Authentication Payload
1067
1068
1069 .in 6
1070 o Payload Length (2 bytes) - Length of the entire payload.
1071
1072 o Authentication Type (2) - The method of the authentication.
1073   The authentication methods are defined in [SILC2] in the
1074   Connection Auth Request Payload.  The NONE authentication
1075   method is not recommended.
1076
1077 o Public Data Length (2 bytes) - Indicates the length of
1078   the Public Data field.
1079
1080 o Public Data (variable length) - This is defined only if
1081   the authentication method is public key.  If it is any other
1082   this field does not exist and the Public Data Length field
1083   is set to zero (0).
1084
1085   When the authentication method is public key this includes
1086   128 to 4096 bytes of non-zero random data that is used in
1087   the signature process, described subsequently.
1088
1089 o Authentication Data Length (2 bytes) - Indicates the
1090   length of the Authentication Data field.
1091
1092 o Authentication Data (variable length) - Authentication 
1093   method dependent authentication data.
1094 .in 3
1095
1096
1097 If the authentication method is password based, the Authentication
1098 Data field includes the plaintext password.  It is safe to send
1099 plaintext password since the entire payload is encrypted.
1100
1101 If the authentication method is public key based (or certificate)
1102 the Authentication Data is computed as follows:
1103
1104   HASH = hash(random bytes | ID | public key (or certificate));
1105   Authentication Data = sign(HASH);
1106
1107 The hash() and the sign() are the hash funtion and the public key
1108 cryptography function selected in the SKE protocol.  The public key
1109 is SILC style public key unless certificates are used.  The ID is the
1110 entity's ID (Client or Server ID) who is authenticating itself.  The ID
1111 is raw ID data.  The random bytes are non-zero random bytes of length
1112 between 128 and 4096 bytes, and will be included into the Public Data
1113 field as is.
1114
1115 The receiver will compute the signature using the random data received
1116 in the payload, the ID associated to the connection and the public key
1117 (or certificate) received in the SKE protocol.  After computing the
1118 receiver must verify the signature.  In this case also, the entire
1119 payload is encrypted.
1120
1121
1122 .ti 0
1123 3.10 Algorithms
1124
1125 This section defines all the allowed algorithms that can be used in
1126 the SILC protocol.  This includes mandatory cipher, mandatory public
1127 key algorithm and MAC algorithms.
1128
1129
1130 .ti 0
1131 3.10.1 Ciphers
1132
1133 Cipher is the encryption algorithm that is used to protect the data
1134 in the SILC packets.  See [SILC2] of the actual encryption process and
1135 definition of how it must be done.  SILC has a mandatory algorithm that
1136 must be supported in order to be compliant with this protocol.
1137
1138 Following ciphers are defined in SILC protocol:
1139
1140 .in 6
1141 aes-cbc         AES in CBC mode       (mandatory)
1142 twofish-cbc     Twofish in CBC mode   (optional)
1143 blowfish-cbc    Blowfish in CBC mode  (optional)
1144 rc6-cbc         RC6 in CBC mode       (optional)
1145 rc5-cbc         RC5 in CBC mode       (optional)
1146 mars-cbc        Mars in CBC mode      (optional)
1147 none            No encryption         (optional)
1148 .in 3
1149
1150
1151 All algorithms must use minimum of 128 bit key, by default.  Several
1152 algorithms, however, supports longer keys and it is recommended to use
1153 longer keys if they are available.
1154
1155 Algorithm none does not perform any encryption process at all and 
1156 thus is not recommended to be used.  It is recommended that no client
1157 or server implementation would accept none algorithms except in special
1158 debugging mode.
1159
1160 Additional ciphers may be defined to be used in SILC by using the
1161 same name format as above.
1162
1163
1164 .ti 0
1165 3.10.2 Public Key Algorithms
1166
1167 Public keys are used in SILC to authenticate entities in SILC network
1168 and to perform other tasks related to public key cryptography.  The 
1169 public keys are also used in the SILC Key Exchange protocol [SILC3].
1170
1171 Following public key algorithms are defined in SILC protocol:
1172
1173 .in 6
1174 rsa        RSA  (mandatory)
1175 dss        DSS  (optional)
1176 .in 3
1177
1178 DSS is described in [Menezes].  The RSA must be implemented according
1179 PKCS #1 [PKCS1].  The mandatory PKCS #1 implementation in SILC must be
1180 compliant to either PKCS #1 version 1.5 or newer with the following
1181 notes: The signature encoding is always in same format as the encryption
1182 encoding regardles of the PKCS #1 version.  The signature with appendix
1183 (with hash algorithm OID in the data) must not be used in the SILC.  The
1184 rationale for this is that there is no binding between the PKCS #1 OIDs
1185 and the hash algorithms used in the SILC protocol.  Hence, the encoding
1186 is always in PKCS #1 version 1.5 format.
1187
1188 Additional public key algorithms may be defined to be used in SILC.
1189
1190
1191 .ti 0
1192 3.10.3 MAC Algorithms
1193
1194 Data integrity is protected by computing a message authentication code
1195 (MAC) of the packet data.  See [SILC2] for details how to compute the
1196 MAC.
1197
1198 Following MAC algorithms are defined in SILC protocol:
1199
1200 .in 6
1201 hmac-sha1        HMAC-SHA1, length = 20  (mandatory)
1202 hmac-md5         HMAC-MD5, length = 16   (optional)
1203 none             No MAC                  (optional)
1204 .in 3
1205
1206 The none MAC is not recommended to be used as the packet is not
1207 authenticated when MAC is not computed.  It is recommended that no
1208 client or server would accept none MAC except in special debugging
1209 mode.
1210
1211 The HMAC algorithm is described in [HMAC] and hash algorithms that
1212 are used as part of the HMACs are described in [Scheneir] and in
1213 [Menezes]
1214
1215 Additional MAC algorithms may be defined to be used in SILC.
1216
1217
1218 .ti 0
1219 3.10.4 Compression Algorithms
1220
1221 SILC protocol supports compression that may be applied to unencrypted
1222 data.  It is recommended to use compression on slow links as it may
1223 significantly speed up the data transmission.  By default, SILC does not
1224 use compression which is the mode that must be supported by all SILC
1225 implementations.
1226
1227 Following compression algorithms are defined:
1228
1229 .in 6
1230 none        No compression               (mandatory)
1231 zlib        GNU ZLIB (LZ77) compression  (optional)
1232 .in 3
1233
1234 Additional compression algorithms may be defined to be used in SILC.
1235
1236
1237 .ti 0
1238 3.11 SILC Public Key
1239
1240 This section defines the type and format of the SILC public key.  All
1241 implementations must support this public key type.  See [SILC3] for
1242 other optional public key and certificate types allowed in SILC
1243 protocol.  Public keys in SILC may be used to authenticate entities
1244 and to perform other tasks related to public key cryptography.
1245
1246 The format of the SILC Public Key is as follows:
1247
1248
1249 .in 5
1250 .nf
1251                      1                   2                   3
1252  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
1253 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1254 |                        Public Key Length                      |
1255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1256 |     Algorithm Name Length     |                               |
1257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1258 |                                                               |
1259 ~                         Algorithm Name                        ~
1260 |                                                               |
1261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1262 |       Identifier Length       |                               |
1263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
1264 |                                                               |
1265 ~                           Identifier                          ~
1266 |                                                               |
1267 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1268 |                                                               |
1269 ~                           Public Data                         ~
1270 |                                                               |
1271 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1272 .in 3
1273
1274 .ce
1275 Figure 5:  SILC Public Key
1276
1277
1278 .in 6
1279 o Public Key Length (4 bytes) - Indicates the full length
1280   of the public key, not including this field.
1281
1282 o Algorithm Name Length (2 bytes) - Indicates the length
1283   of the Algorithm Length field, not including this field.
1284
1285 o Algorithm name (variable length) - Indicates the name
1286   of the public key algorithm that the key is.  See the
1287   section 3.10.2 Public Key Algorithms for defined names.
1288
1289 o Identifier Length (2 bytes) - Indicates the length of
1290   the Identifier field, not including this field.
1291
1292 o Identifier (variable length) - Indicates the identifier
1293   of the public key.  This data can be used to identify
1294   the owner of the key.  The identifier is of following
1295   format:
1296
1297      UN   User name
1298      HN   Host name or IP address
1299      RN   Real name
1300      E    EMail address
1301      O    Organization
1302      C    Country
1303
1304
1305   Examples of an identifier:
1306
1307     `UN=priikone, HN=poseidon.pspt.fi, E=priikone@poseidon.pspt.fi'
1308
1309     `UN=sam, HN=dummy.fi, RN=Sammy Sam, O=Company XYZ, C=Finland'
1310
1311   At least user name (UN) and host name (HN) must be provided as
1312   identifier.  The fields are separated by commas (`,').  If
1313   comma is in the identifier string it must be written as `\\,',
1314   for example, `O=Company XYZ\\, Inc.'.
1315
1316 o Public Data (variable length) - Includes the actual
1317   public data of the public key.
1318
1319   The format of this field for RSA algorithm is
1320   as follows:
1321
1322      4 bytes            Length of e
1323      variable length    e
1324      4 bytes            Length of n
1325      variable length    n
1326
1327
1328   The format of this field for DSS algorithm is
1329   as follows:
1330
1331      4 bytes            Length of p
1332      variable length    p
1333      4 bytes            Length of q
1334      variable length    q
1335      4 bytes            Length of g
1336      variable length    g
1337      4 bytes            Length of y
1338      variable length    y
1339
1340   The variable length fields are multiple precession
1341   integers encoded as strings in both examples.
1342
1343   Other algorithms must define their own type of this
1344   field if they are used.
1345 .in 3
1346
1347 All fields in the public key are in MSB (most significant byte first)
1348 order.
1349
1350
1351 .ti 0
1352 3.12 SILC Version Detection
1353
1354 The version detection of both client and server is performed at the
1355 connection phase while executing the SILC Key Exchange protocol.  The
1356 version identifier is exchanged between initiator and responder.  The
1357 version identifier is of following format:
1358
1359 .in 6
1360 SILC-<protocol version>-<software version>
1361 .in 3
1362
1363 The version strings are of following format:
1364
1365 .in 6
1366 protocol version = <major>.<minor>
1367 software version = <major>[.<minor>[.<build>]]
1368 .in 3
1369
1370 Protocol version may provide both major and minor version.  Currently
1371 implementations must set the protocol version and accept the protocol
1372 version as SILC-1.0-<sotware version>. 
1373
1374 Software version may provide major, minor and build version.  The
1375 software version may be freely set and accepted.
1376
1377
1378 Thus, the version string could be, for example:
1379
1380 .in 6
1381 SILC-1.0-1.2
1382 .in 3
1383
1384
1385 .ti 0
1386 4 SILC Procedures
1387
1388 This section describes various SILC procedures such as how the 
1389 connections are created and registered, how channels are created and
1390 so on.  The section describes the procedures only generally as details
1391 are described in [SILC2] and [SILC3].
1392
1393
1394 .ti 0
1395 4.1 Creating Client Connection
1396
1397 This section describes the procedure when client connects to SILC server.
1398 When client connects to server the server must perform IP address lookup
1399 and reverse IP address lookup to assure that the origin host really is
1400 who it claims to be.  Client, host, connecting to server must have 
1401 both valid IP address and fully qualified domain name (FQDN).
1402
1403 After that client and server performs SILC Key Exchange protocol which
1404 will provide the key material used later in the communication.  The
1405 key exchange protocol must be completed successfully before the connection
1406 registration may continue.  The SILC Key Exchange protocol is described
1407 in [SILC3].
1408
1409 Typical server implementation would keep a list of connections that it
1410 allows to connect to the server.  The implementation would check, for
1411 example, the connecting client's IP address from the connection list
1412 before the SILC Key Exchange protocol has been started.  Reason for
1413 this is that if the host is not allowed to connect to the server there
1414 is no reason to perform a key exchange protocol.
1415
1416 After successful key exchange protocol the client and server performs
1417 connection authentication protocol.  The purpose of the protocol is to
1418 authenticate the client connecting to the server.  Flexible
1419 implementation could also accept the client to connect to the server
1420 without explicit authentication.  However, if authentication is
1421 desired for a specific client it may be based on passphrase or
1422 public key authentication.  If authentication fails the connection
1423 must be terminated.  The connection authentication protocol is described
1424 in [SILC3].
1425
1426 After successful key exchange and authentication protocol the client
1427 registers itself by sending SILC_PACKET_NEW_CLIENT packet to the
1428 server.  This packet includes various information about the client
1429 that the server uses to create the client.  Server creates the client
1430 and sends SILC_PACKET_NEW_ID to the client which includes the created
1431 Client ID that the client must start using after that.  After that
1432 all SILC packets from the client must have the Client ID as the
1433 Source ID in the SILC Packet Header, described in [SILC2].
1434
1435 Client must also get the server's Server ID that is to be used as
1436 Destination ID in the SILC Packet Header when communicating with
1437 the server (for example when sending commands to the server).  The
1438 ID may be resolved in two ways.  Client can take the ID from an
1439 previously received packet from server that must include the ID,
1440 or to send SILC_COMMAND_INFO command and receive the Server ID as
1441 command reply.
1442
1443 Server may choose not to use the information received in the
1444 SILC_PACKET_NEW_CLIENT packet.  For example, if public key or 
1445 certificate were used in the authentication, server may use those
1446 informations rather than what it received from client.  This is suitable
1447 way to get the true information about client if it is available.
1448
1449 The nickname of client is initially set to the username sent in the
1450 SILC_PACKET_NEW_CLIENT packet.  User should set the nickname to more
1451 suitable by sending SILC_COMMAND_NICK command.  However, this is not
1452 required as part of registration process.
1453
1454 Server must also distribute the information about newly registered
1455 client to its router (or if the server is router, to all routers in
1456 the SILC network).  More information about this in [SILC2].
1457
1458
1459 .ti 0
1460 4.2 Creating Server Connection
1461
1462 This section descibres the procedure when server connects to its
1463 router (or when router connects to other router, the cases are
1464 equivalent).  The procedure is very much alike when client connects
1465 to the server thus it is not repeated here.
1466
1467 One difference is that server must perform connection authentication
1468 protocol with proper authentication.  Proper authentication is based
1469 on passphrase or public key authentication.
1470
1471 After server and router has successfully performed the key exchange
1472 and connection authentication protocol, the server register itself
1473 to the router by sending SILC_PACKET_NEW_SERVER packet.  This packet
1474 includes the server's Server ID that it has created by itself and
1475 other relevant information about the server.
1476
1477 After router has received the SILC_PACKET_NEW_SERVER packet it
1478 distributes the information about newly registered server to all routers
1479 in the SILC network.  More information about this in [SILC2].
1480
1481 As client needed to resolve the destination ID this must be done by the
1482 server that connected to the router, as well.  The way to resolve it is
1483 to get the ID from previously received packet.  Server must also start
1484 using its own Server ID as Source ID in SILC Packet Header and the
1485 router's Server ID as Destination when communicating with the router.
1486
1487 If the server has already connected clients and locally created
1488 channels the server must distribute these informations to the router.
1489 The distribution is done by sending packet SILC_PACKET_NEW_CHANNEL.
1490 See [SILC2] for more information on this.
1491
1492
1493 .ti 0
1494 4.3 Joining to a Channel
1495
1496 This section describes the procedure when client joins to a channel.
1497 Client may join to channel by sending command SILC_COMMAND_JOIN to the
1498 server.  If the receiver receiving join command is normal server the
1499 server must check its local list whether this channel already exists
1500 locally.  This would indicate that some client connected to the server
1501 has already joined to the channel.  If this is case the client is
1502 joined to the client, new channel key is created and information about
1503 newly joined channel is sent to the router.  The new channel key is
1504 also distributed to the router and to all clients on the channel.
1505
1506 If the channel does not exist in the local list the command must be
1507 forwarded to the router which will then perform the actual joining
1508 procedure.  When server receives the reply to the command from the
1509 router it must be distributed to the client who sent the command
1510 originally.  Server will also receive the channel key from the server
1511 that it must distribute to the client who originally requested the
1512 join command.  The server must also save the channel key.
1513
1514 If the receiver of the join command is router it must first check its
1515 local list whether anyone in the cell has already joined to the channel.
1516 If this is the case the client is joined to the channel and reply is
1517 sent to the client.  If the command was sent by server the command reply
1518 is sent to the server who sent it.  Then the router must also create
1519 new channel key and distribute it to all clients on the channel and
1520 all servers that has clients on the channel.
1521
1522 If the channel does not exist on the router's local list it must
1523 check the global list whether the channel exists at all.  If it does
1524 the client is joined to the channel as described previously.  If
1525 the channel does not exist the channel is created and the client
1526 is joined to the channel.  The channel key is also created and
1527 distributed as previously described.  The client joining to the created
1528 channel is made automatically channel founder and both channel founder
1529 and channel operator privileges is set for the client.
1530
1531 When the router joins the client to the channel it must send 
1532 information about newly joined client to all routers in the SILC 
1533 network.  Also, if the channel was created in the process, information
1534 about newly created channel must also be distributed to all routers.
1535 The distribution of newly created channel is done by sending packet
1536 SILC_PACKET_NEW_CHANNEL.
1537
1538 It is important to note that new channel key is created always when
1539 new client joins to channel, whether the channel has existed previously
1540 or not.  This way the new client on the channel is not able to decrypt
1541 any of the old traffic on the channel.  Client who receives the reply to
1542 the join command must start using the received Channel ID in the channel
1543 message communication thereafter.  Client also receives the key for the
1544 channel in the command reply.
1545
1546 If client wants to know the other clients currently on the channel
1547 the client must send SILC_COMMAND_USERS command to receive a list of
1548 channel users.  Server implementation, however, may send command reply
1549 packet to SILC_COMMAND_USERS command after client has joined to the
1550 channel even if the client has not sent the command.  Server should also
1551 send SILC_NOTIFY_TYPE_JOIN to all clients on the channel about a new
1552 client on the channel.
1553
1554
1555 .ti 0
1556 4.4 Channel Key Generation
1557
1558 Channel keys are created by router who creates the channel by taking
1559 enough randomness from cryptographically strong random number generator.
1560 The key is generated always when channel is created, when new client
1561 joins a channel and after the key has expired.  Key could expire for
1562 example in an hour.
1563
1564 The key must also be re-generated whenever some client leaves a channel.
1565 In this case the key is created from scratch by taking enough randomness
1566 from the random number generator.  After that the key is distributed to
1567 all clients on the channel.  However, channel keys are cell specific thus
1568 the key is created only on the cell where the client, who left the
1569 channel, exists.  While the server or router is creating the new channel
1570 key, no other client may join to the channel.  Messages that are sent
1571 while creating the new key are still processed with the old key.  After
1572 server has sent the SILC_PACKET_CHANNEL_KEY packet must client start
1573 using the new key.  If server creates the new key the server must also
1574 send the new key to its router.  See [SILC2] on more information about
1575 how channel messages must be encrypted and decrypted when router is
1576 processing them.
1577
1578
1579 .ti 0
1580 4.5 Private Message Sending and Reception
1581
1582 Private messages are sent point to point.  Client explicitly destines
1583 a private message to specific client that is delivered to only to that
1584 client.  No other client may receive the private message.  The receiver
1585 of the private message is destined in the SILC Packet Header as any
1586 other packet as well.
1587
1588 If the sender of a private message does not know the receiver's Client
1589 ID, it must resolve it from server.  There are two ways to resolve the
1590 client ID from server; it is recommended that client implementations
1591 send SILC_COMMAND_IDENTIFY command to receive the Client ID.  Client
1592 may also send SILC_COMMAND_WHOIS command to receive the Client ID.
1593 If the sender has received earlier a private message from the receiver
1594 it should have cached the Client ID from the SILC Packet Header.
1595
1596 Receiver of a private message should not explicitly trust the nickname
1597 that it receives in the Private Message Payload, described in [SILC2].
1598 Implementations could resolve the nickname from server, as described
1599 previously, and compare the received Client ID and the SILC Packet
1600 Header's Client ID.  The nickname in the payload is merely provided
1601 to be displayed for end user.
1602
1603 See [SILC2] for description of private message encryption and decryption
1604 process.
1605
1606
1607 .ti 0
1608 4.6 Private Message Key Generation
1609
1610 Private message may be protected by key generated by client.  The key
1611 may be generated and sent to the other client by sending packet
1612 SILC_PACKET_PRIVATE_MESSAGE_KEY which travels through the network
1613 and is secured by session keys.  After that the private message key
1614 is used in the private message communication between those clients.
1615 See more information about how this works technically in [SILC2].
1616
1617 Other choice is to entirely use keys that are not sent through
1618 the SILC network at all.  This significantly adds security.  This key
1619 would be pre-shared-key that is known by both of the clients.  Both
1620 agree about using the key and starts sending packets that indicate
1621 that the private message is secured using private message key.  This
1622 is the technical aspect mentioned previously that is described
1623 in [SILC2].
1624
1625 If the private message keys are not set to be used, which is the
1626 case by default in SILC, the private messages are secured by using
1627 normal session keys established by SILC Key Exchange protocol.
1628
1629
1630
1631
1632 .ti 0
1633 4.7 Channel Message Sending and Reception
1634
1635 Channel messages are delivered to group of users.  The group forms a
1636 channel and all clients on the channel receives messages sent to the
1637 channel.
1638
1639 Channel messages are destined to channel by specifying the Channel ID
1640 as Destination ID in the SILC Packet Header.  The server must then
1641 distribute the message to all clients on the channel by sending the
1642 channel message destined explicitly to a client on the channel.
1643
1644 See [SILC2] for description of channel message encryption and decryption
1645 process.
1646
1647
1648 .ti 0
1649 4.8 Session Key Regeneration
1650
1651 Session keys should be regenerated periodically, say, once in an hour.
1652 The re-key process is started by sending SILC_PACKET_REKEY packet to
1653 other end, to indicate that re-key must be performed.
1654
1655 If perfect forward secrecy (PFS) flag was selected in the SILC Key
1656 Exchange protocol [SILC3] the re-key must cause new key exchange with
1657 SKE protocol.  In this case the protocol is secured with the old key
1658 and the protocol results to new key material.  See [SILC3] for more
1659 information.  After the SILC_PACKET_REKEY packet is sent the sender
1660 will perform the SKE protocol.
1661
1662 If PFS flag was not set, which is the default case, then re-key is done
1663 without executing SKE protocol.  In this case, the new key is created by
1664 hashing the old key with hash function selected earlier in the SKE
1665 protocol.  If the digest length of the hash function is too short for the
1666 key, then the key is distributed as described in section Processing the
1667 Key Material in [SILC3].  After both parties has regenerated the session
1668 key, both send SILC_PACKET_REKEY_DONE packet to each other.  These packets
1669 are still secured with the old key.  After these packets, following
1670 packets must be protected with the new key.
1671
1672
1673 .ti 0
1674 4.9 Command Sending and Reception
1675
1676 Client usually sends the commands in the SILC network.  In this case
1677 the client simply sends the command packet to server and the server
1678 processes it and replies with command reply packet.
1679
1680 However, if the server is not able to process the command, it is sent 
1681 to the server's router.  This is case for example with commands such
1682 as, SILC_COMMAND_JOIN and SILC_COMMAND_WHOIS commands.  However, there
1683 are other commands as well.  For example, if client sends the WHOIS
1684 command requesting specific information about some client the server must
1685 send the WHOIS command to router so that all clients in SILC network
1686 are searched.  The router, on the other hand, sends the WHOIS command
1687 further to receive the exact information about the requested client.
1688 The WHOIS command travels all the way to the server who owns the client
1689 and it replies with command reply packet.  Finally, the server who
1690 sent the command receives the command reply and it must be able to
1691 determine which client sent the original command.  The server then
1692 sends command reply to the client.  Implementations should have some
1693 kind of cache to handle, for example, WHOIS information.  Servers
1694 and routers along the route could all cache the information for faster
1695 referencing in the future.
1696
1697 The commands sent by server may be sent hop by hop until someone is able
1698 to process the command.  However, it is preferred to destine the command
1699 as precisely as it is possible.  In this case, other routers en route
1700 must route the command packet by checking the true sender and true
1701 destination of the packet.  However, servers and routers must not route
1702 command reply packets to clients coming from other server.  Client
1703 must not accept command reply packet originated from anyone else but
1704 from its own server.
1705
1706
1707 .ti 0
1708 5 SILC Commands
1709
1710 .ti 0
1711 5.1 SILC Commands Syntax
1712
1713 This section briefly describes the syntax of the command notions
1714 in this document.  Every field in command is separated from each
1715 other by whitespaces (` ') indicating that each field is independent
1716 argument and each argument must have own Command Argument Payload.
1717 The number of maximum arguments are defined with each command
1718 separately.  The Command Argument Payload is described in [SILC2].
1719
1720 Every command defines specific number for each argument.  Currently,
1721 they are defined in ascending order; first argument has number one 
1722 (1), second has number two (2) and so on.  This number is set into the
1723 Argument Type field in the Command Argument Payload.  This makes it
1724 possible to send the arguments in free order as the number must be
1725 used to identify the type of the argument.  This makes is it also
1726 possible to have multiple optional arguments in commands and in
1727 command replies.  The number of argument is marked in parentheses
1728 before the actual argument.
1729
1730
1731
1732 .in 6
1733 Example:  Arguments:  (1) <nickname> (2) <username@host>
1734 .in 3
1735    
1736
1737 Every command replies with Status Payload.  This payload tells the
1738 sender of the command whether the command was completed successfully or
1739 whether there was an error.  If error occured the payload includes the
1740 error type.  In the next section the Status Payload is not described 
1741 as it is common to all commands and has been described here.  Commands 
1742 may reply with other arguments as well.  These arguments are command 
1743 specific and are described in the next section.
1744
1745 Example command:
1746 .in 6
1747
1748 EXAMPLE_COMMAND
1749
1750 .in 8
1751 Max Arguments:  3
1752     Arguments:  (1) <nickname>[@<server>]  (2) <message>
1753                 (3) [<count>]
1754
1755 The command has maximum of 3 arguments.  However, only first
1756 and second arguments are mandatory.
1757
1758 First argument <nickname> is mandatory but may have optional
1759 <nickname@server> format as well.  Second argument is mandatory
1760 <message> argument.  Third argument is optional <count> argument.
1761
1762 The numbers in parentheses are the argument specific numbers
1763 that specify the type of the argument in Command Argument Payload.
1764 The receiver always knows that, say, argument number two (2) is
1765 <message> argument, regardless of the ordering of the arguments in
1766 the Command Payload.
1767
1768 Reply messages to the command:
1769
1770 Max Arguments:  4
1771     Arguments:  (1) <Status Payload>  (2) [<channel list>]
1772                 (3) <idle time>       (4) [<away message>]
1773
1774 This command may reply with maximum of 4 arguments.  However,
1775 only the first and third arguments are mandatory.  The numbers
1776 in the parentheses have the same meaning as in the upper
1777 command sending specification.
1778
1779 Every command reply with <Status Payload>, it is mandatory 
1780 argument for all command replies and for this reason it is not
1781 described in the command reply descriptions.
1782
1783
1784
1785 Status messages:
1786
1787     SILC_STATUS_OK
1788     SILC_STATUS_ERR_TOO_MANY_TARGETS
1789     SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
1790     SILC_STATUS_ERR_NO_SUCH_NICK
1791
1792 Every command reply also defines set of status message that it
1793 may return inside the <Status Payload>.  All status messages
1794 are defined in the section 5.3 SILC Command Status Types.
1795
1796 .in 3
1797 Every command that has some kind of ID as argument (for example
1798 <Client ID>) are actually ID Payloads, defined in [SILC2] that includes
1799 the type of the ID, length of the ID and the actual ID data.  This
1800 way variable length ID's can be sent as arguments.
1801
1802
1803 .ti 0
1804 5.2 SILC Commands List
1805
1806 This section lists all SILC commands, however, it is expected that a
1807 implementation and especially client implementation has many more
1808 commands that has only local affect.  These commands are official
1809 SILC commands that has both client and server sides and cannot be
1810 characterized as local commands.
1811
1812 List of all defined commands in SILC follows.
1813
1814 .in 0
1815    0    SILC_COMMAND_NONE
1816
1817         None.  This is reserved command and must not be sent.
1818
1819
1820    1    SILC_COMMAND_WHOIS
1821
1822         Max Arguments:  3328
1823             Arguments:  (1) [<nickname>[@<server>]]  (2) [<count>]
1824                         (3) [<Client ID>]            (n) [...]
1825
1826         Whois command is used to query various information about specific
1827         user.  The user maybe requested by their nickname and server name.
1828         The query may find multiple matching users as there are no unique
1829         nicknames in the SILC.  The <count> option maybe given to narrow
1830         down the number of accepted results.  If this is not defined there
1831         are no limit of accepted results.  The query may also be narrowed
1832         down by defining the server name of the nickname.
1833
1834         It is also possible to search the user by Client ID.  If <Client ID>
1835         is provided server must use it as the search value instead of
1836         the <nickname>.  One of the arguments must be given.  It is also
1837         possible to define multiple Client ID's to search multiple users
1838         sending only one WHOIS command.  In this case the Client ID's are
1839         appended as normal arguments.  The server replies in this case
1840         with only one reply message for all requested users.
1841
1842         To prevent miss-use of this service wildcards in the nickname
1843         or in the servername are not permitted.  It is not allowed
1844         to request all users on some server.  The WHOIS requests must 
1845         be based on specific nickname request.
1846
1847         The WHOIS request must be always forwarded to router by server
1848         so that all users are searched.  However, the server still must
1849         search its locally connected clients.  The router must send
1850         this command to the server who owns the requested client.  That
1851         server must reply to the command.  Server should not send whois
1852         replies to the client until it has received the reply from its
1853         router.
1854
1855         Reply messages to the command:
1856
1857         Max Arguments:  7
1858             Arguments:  (1) <Status Payload>       (2) <Client ID> 
1859                         (3) <nickname>[@<server>]  (4) <username@host> 
1860                         (5) <real name>            (6) [<channel list>] 
1861                         (7) [<idle time>]
1862
1863         This command may reply with several command reply messages to
1864         form a list of results.  In this case the status payload will
1865         include STATUS_LIST_START status in the first reply and
1866         STATUS_LIST_END in the last reply to indicate the end of the
1867         list.  If there are only one reply the status is set to normal
1868         STATUS_OK.
1869
1870         The command replies include the Client ID of the nickname,
1871         nickname and servername, username and hostname and users real
1872         name.  Client should process these replies only after the last
1873         reply has been received with the STATUS_LIST_END status.  If the
1874         <count> option were defined in the query there will be only
1875         <count> many replies from the server.
1876
1877         Status messages:
1878
1879             SILC_STATUS_OK
1880             SILC_STATUS_LIST_START
1881             SILC_STATUS_LIST_END
1882             SILC_STATUS_ERR_NO_SUCH_NICK
1883             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
1884             SILC_STATUS_ERR_WILDCARDS
1885             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
1886             SILC_STATUS_ERR_TOO_MANY_PARAMS
1887
1888
1889
1890
1891    2    SILC_COMMAND_WHOWAS
1892
1893         Max Arguments:  2
1894             Arguments:  (1) <nickname>[@<server>]  (2) [<count>]
1895
1896         Whowas.  This command is used to query history information about
1897         specific user.  The user maybe requested by their nickname and 
1898         server name.  The query may find multiple matching users as there
1899         are no unique nicknames in the SILC.  The <count> option maybe
1900         given to narrow down the number of accepted results.  If this
1901         is not defined there are no limit of accepted results.  The query
1902         may also be narrowed down by defining the server name of the 
1903         nickname.
1904
1905         To prevent miss-use of this service wildcards in the nickname
1906         or in the servername are not permitted.  The WHOWAS requests must 
1907         be based on specific nickname request.
1908
1909         The WHOWAS request must be always forwarded to router by server
1910         so that all users are searched.  However, the server still must
1911         search its locally connected clients.
1912
1913         Reply messages to the command:
1914
1915         Max Arguments:  3
1916             Arguments:  (1) <Status Payload>  (2) <nickname>[@<server>]
1917                         (3) <username@host>
1918
1919         This command may reply with several command reply messages to form
1920         a list of results.  In this case the status payload will include
1921         STATUS_LIST_START status in the first reply and STATUS_LIST_END in 
1922         the last reply to indicate the end of the list.  If there are only 
1923         one reply the status is set to normal STATUS_OK.
1924
1925         The command replies with nickname and username and hostname.
1926         Every server must keep history for some period of time of its
1927         locally connected clients.
1928
1929         Status messages:
1930
1931             SILC_STATUS_OK
1932             SILC_STATUS_LIST_START
1933             SILC_STATUS_LIST_END
1934             SILC_STATUS_ERR_NO_SUCH_NICK
1935             SILC_STATUS_ERR_WILDCARDS
1936             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
1937             SILC_STATUS_ERR_TOO_MANY_PARAMS
1938
1939
1940    3    SILC_COMMAND_IDENTIFY
1941
1942         Max Arguments:  3328
1943             Arguments:  (1) [<nickname>[@<server>]]  (2) [<count>]
1944                         (3) [<Client ID>]            (n) [...]
1945
1946         Identify.  Identify command is almost analogous to WHOIS command,
1947         except that it does not return as much information.  Only relevant
1948         information such as Client ID is returned.  This is usually used
1949         to get the Client ID of a client used in the communication with
1950         the client.
1951
1952         The query may find multiple matching users as there are no unique 
1953         nicknames in the SILC.  The <count> option maybe given to narrow 
1954         down the number of accepted results.  If this is not defined there 
1955         are no limit of accepted results.  The query may also be narrowed 
1956         down by defining the server name of the nickname.
1957
1958         It is also possible to search the user by Client ID.  If <Client ID>
1959         is provided server must use it as the search value instead of
1960         the <nickname>.  One of the arguments must be given.  It is also
1961         possible to define multiple Client ID's to search multiple users
1962         sending only one IDENTIFY command.  In this case the Client ID's are
1963         appended as normal arguments.  The server replies in this case
1964         with only one reply message for all requested users.
1965
1966         To prevent miss-use of this service wildcards in the nickname
1967         or in the servername are not permitted.  It is not allowed
1968         to request all users on some server.  The IDENTIFY requests must 
1969         be based on specific nickname request.
1970
1971         Implementations may not want to give interface access to this
1972         command as it is hardly a command that would be used by an end user.
1973         However, it must be implemented as it is used with private message
1974         sending.
1975
1976         The IDENTIFY must be always forwarded to router by server so that
1977         all users are searched.  However, server must still search its
1978         locally connected clients.
1979
1980         Reply messages to the command:
1981
1982         Max Arguments:  4
1983             Arguments:  (1) <Status Payload>         (2) <Client ID>
1984                         (3) [<nickname>[@<server>]]  (4) [<username@host>]
1985
1986         This command may reply with several command reply messages to form
1987         a list of results.  In this case the status payload will include
1988         STATUS_LIST_START status in the first reply and STATUS_LIST_END in 
1989         the last reply to indicate the end of the list.  If there are only 
1990         one reply the status is set to normal STATUS_OK.
1991
1992         The command replies with Client ID of the nickname and if more
1993         information is available it may reply with nickname and username
1994         and hostname.  If the <count> option were defined in the query
1995         there will be only <count> many replies from the server.
1996
1997         Status messages:
1998
1999             SILC_STATUS_OK
2000             SILC_STATUS_LIST_START
2001             SILC_STATUS_LIST_END
2002             SILC_STATUS_ERR_NO_SUCH_NICK
2003             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2004             SILC_STATUS_ERR_WILDCARDS
2005             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2006             SILC_STATUS_ERR_TOO_MANY_PARAMS
2007
2008
2009    4    SILC_COMMAND_NICK
2010
2011         Max Arguments:  1
2012             Arguments:  (1) <nickname>
2013
2014         Set/change nickname.  This command is used to set nickname for
2015         user.  There is no limit of the length of the nickname in SILC.
2016         Nickname must not include any spaces (` '), non-printable
2017         characters, commas (`,') and any wildcard characters.  Note:
2018         nicknames in SILC are case-sensitive which must be taken into
2019         account when searching clients by nickname.
2020
2021         When nickname is changed new Client ID is generated.  Server must
2022         distribute SILC_NOTIFY_TYPE_NICK_CHANGE to local clients on the
2023         channels (if any) the client is joined on.  Then it must send
2024         SILC_PACKET_REPLACE_ID to its primary route to replace the old
2025         Client ID with the new one.
2026
2027         Reply messages to the command:
2028
2029         Max Arguments:  2
2030             Arguments:  (1) <Status Payload>  (2) <New ID Payload>
2031
2032         This command is replied always with New ID Payload that is
2033         generated by the server every time user changes their nickname.
2034         Client receiving this payload must start using the received
2035         Client ID as its current valid Client ID.  The New ID Payload
2036         is described in [SILC2].
2037
2038         Status messages:
2039
2040             SILC_STATUS_OK
2041             SILC_STATUS_ERR_WILDCARDS
2042             SILC_STATUS_ERR_NICKNAME_IN_USE
2043             SILC_STATUS_ERR_BAD_NICKNAME
2044             SILC_STATUS_ERR_NOT_REGISTERED
2045             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2046             SILC_STATUS_ERR_TOO_MANY_PARAMS
2047
2048
2049    5    SILC_COMMAND_LIST
2050
2051         Max Arguments:  2
2052             Arguments:  (1) [<Channel ID>] [<server>]
2053
2054         The list command is used to list channels and their topics on
2055         current server.  If the <Channel ID> parameter is used, only the
2056         status of that channel is displayed.  Secret channels are not
2057         listed at all.  Private channels are listed with status indicating
2058         that the channel is private.
2059
2060         If the <server> argument is specified the specified server's
2061         channels are listed.  In this case the command must be sent to
2062         the server who owns the channel that was requested.
2063
2064         Reply messages to the command:
2065
2066         Max Arguments:  4
2067             Arguments:  (1) <Status Payload>  (2) <Channel ID>
2068                         (3) <channel>         (4) <topic>
2069
2070         This command may reply with several command reply messages to form
2071         a list of results.  In this case the status payload will include
2072         STATUS_LIST_START status in the first reply and STATUS_LIST_END in 
2073         the last reply to indicate the end of the list.  If there are only 
2074         one reply the status is set to normal STATUS_OK.
2075
2076         This command replies with Channel ID, name and the topic of the
2077         channel.  If the channel is private channel the <topic> includes
2078         "*private*" string.
2079
2080         Status messages:
2081
2082             SILC_STATUS_OK
2083             SILC_STATUS_LIST_START
2084             SILC_STATUS_LIST_END
2085             SILC_STATUS_ERR_WILDCARDS
2086             SILC_STATUS_ERR_NOT_REGISTERED
2087             SILC_STATUS_ERR_TOO_MANY_PARAMS
2088             SILC_STATUS_ERR_NO_SUCH_CHANNEL
2089             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
2090             SILC_STATUS_ERR_NO_SUCH_SERVER
2091
2092
2093    6    SILC_COMMAND_TOPIC
2094
2095         Max Arguments:  2
2096             Arguments:  (1) <Channel ID>  (2) [<topic>]]
2097
2098         This command is used to change or view the topic of a channel.
2099         The topic for channel <Channel ID> is returned if there is no
2100         <topic> given.  If the <topic> parameter is present, the topic
2101         for that channel will be changed, if the channel modes permit
2102         this action.
2103
2104         Reply messages to the command:
2105
2106         Max Arguments:  2
2107             Arguments:  (1) <Status Payload>  (2) <Channel ID> 
2108                         (3) [<topic>]
2109
2110         The command may reply with the topic of the channel if it is
2111         set.
2112
2113         Status messages:
2114
2115             SILC_STATUS_OK
2116             SILC_STATUS_ERR_NOT_ON_CHANNEL
2117             SILC_STATUS_ERR_WILDCARDS
2118             SILC_STATUS_ERR_NOT_REGISTERED
2119             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2120             SILC_STATUS_ERR_NO_SUCH_CHANNEL
2121             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
2122             SILC_STATUS_ERR_NO_CHANNEL_ID
2123             SILC_STATUS_ERR_BAD_CHANNEL_ID
2124             SILC_STATUS_ERR_TOO_MANY_PARAMS
2125             SILC_STATUS_ERR_NO_CHANNEL_PRIV
2126
2127
2128    7    SILC_COMMAND_INVITE
2129
2130         Max Arguments:  2
2131             Arguments:  (1) <Client ID>  (2) <Channel ID>
2132
2133         This command is used to invite other clients to join to the
2134         channel.  The <Client ID> argument is the target client's ID that
2135         is being invited.  The <Channel ID> is the Channel ID of the
2136         requested channel.  The sender of this command must be on the
2137         channel.  This command must fail if the requested channel does
2138         not exist, the requested client is already on the channel or if
2139         the channel is invite only channel and the caller of this command
2140         does not have at least channel operator privileges.
2141
2142         Reply messages to the command:
2143
2144         Max Arguments:  2
2145             Arguments:  (1) <Status Payload>
2146
2147         This command replies only with Status Payload.
2148
2149         Status messages:
2150
2151             SILC_STATUS_OK
2152             SILC_STATUS_ERR_NOT_REGISTERED
2153             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2154             SILC_STATUS_ERR_TOO_MANY_PARAMS
2155             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2156             SILC_STATUS_ERR_NO_CLIENT_ID
2157             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
2158             SILC_STATUS_ERR_NO_CHANNEL_ID
2159             SILC_STATUS_ERR_NOT_ON_CHANNEL
2160             SILC_STATUS_ERR_USER_ON_CHANNEL
2161
2162
2163    8    SILC_COMMAND_QUIT
2164
2165         Max Arguments:  1
2166             Arguments:  (1) [<quit message>]
2167
2168         This command is used by client to end SILC session.  The server
2169         must close the connection to a client which sends this command.
2170         if <quit message> is given it will be sent to other clients on
2171         channel if the client is on channel when quitting.
2172
2173         Reply messages to the command:
2174
2175         This command does not reply anything.
2176
2177
2178     9   SILC_COMMAND_KILL
2179
2180         Max Arguments:  2
2181             Arguments:  (1) <Client ID>  (2) [<comment>]
2182
2183         This command is used by SILC operators to remove a client from
2184         SILC network.  The removing has temporary effects and client may
2185         reconnect to SILC network.  The <Client ID> is the client to be
2186         removed from SILC.  The <comment> argument may be provided to 
2187         give to the removed client some information why it was removed
2188         from the network.
2189
2190         Reply messages to the command:
2191
2192         Max Arguments:  1
2193             Arguments:  (1) <Status Payload>
2194
2195         This command replies only with Status Payload.
2196
2197         Status messages:
2198
2199             SILC_STATUS_OK
2200             SILC_STATUS_ERR_WILDCARDS
2201             SILC_STATUS_ERR_NOT_REGISTERED
2202             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2203             SILC_STATUS_ERR_TOO_MANY_PARAMS
2204             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2205             SILC_STATUS_ERR_NO_CLIENT_ID
2206             SILC_STATUS_ERR_NO_ROUTER_PRIV
2207
2208
2209    10   SILC_COMMAND_INFO
2210
2211         Max Arguments:  1
2212             Arguments:  (1) [<server>]
2213
2214         This command is used to fetch various information about a server.
2215         If <server> argument is specified the command must be sent to
2216         the requested server.
2217
2218         Reply messages to the command:
2219
2220         Max Arguments:  3
2221             Arguments:  (1) <Status Payload>  (2) <Server ID>
2222                         (3) <string>
2223
2224         This command replies with the Server ID of the server and a
2225         string which tells the information about the server.
2226
2227         Status messages:
2228
2229             SILC_STATUS_OK
2230             SILC_STATUS_ERR_WILDCARDS
2231             SILC_STATUS_ERR_NOT_REGISTERED
2232             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2233             SILC_STATUS_ERR_TOO_MANY_PARAMS
2234             SILC_STATUS_ERR_NO_SUCH_SERVER
2235
2236
2237    11   SILC_COMMAND_CONNECT
2238
2239         Max Arguments:  2
2240             Arguments:  (1) <Server ID>  
2241                         (2) [<remote server/router>[ <port>]]
2242
2243         This command is used by operators to force a server to try to
2244         establish a new connection to another router (if the connecting
2245         server is normal server) or server (if the connecting server is
2246         router server).  Operator may specify the server/router to be
2247         connected by setting <remote server> argument.  The separator
2248         between <remote server address> and <port> is whitespace (` ').
2249
2250         Reply messages to the command:
2251
2252         Max Arguments:  1
2253             Arguments:  (1) <Status Payload>
2254
2255         This command replies only with Status Payload.
2256
2257
2258
2259         Status messages:
2260
2261             SILC_STATUS_OK
2262             SILC_STATUS_ERR_WILDCARDS
2263             SILC_STATUS_ERR_NOT_REGISTERED
2264             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2265             SILC_STATUS_ERR_TOO_MANY_PARAMS
2266             SILC_STATUS_ERR_NO_SUCH_SERVER_ID
2267             SILC_STATUS_ERR_NO_SERVER_PRIV
2268             SILC_STATUS_ERR_NO_ROUTER_PRIV
2269
2270
2271    12   SILC_COMMAND_PING
2272
2273         Max Arguments:  1
2274             Arguments:  (1) <Server ID>
2275
2276         This command is used by client and server to test the communication
2277         channel to its server if one suspects that the communication is not
2278         working correctly.  The <Server ID> is the ID of the server the
2279         sender is connected to.
2280
2281         Reply messages to the command:
2282
2283         Max Arguments:  1
2284             Arguments:  (1) <Status Payload>
2285
2286         This command replies only with Status Payload.  Server returns
2287         SILC_STATUS_OK in Status Payload if pinging was successful.
2288
2289
2290
2291         Status messages:
2292
2293             SILC_STATUS_OK
2294             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2295             SILC_STATUS_ERR_TOO_MANY_PARAMS
2296             SILC_STATUS_ERR_NO_SERVER_ID
2297             SILC_STATUS_ERR_NO_SUCH_SERVER
2298             SILC_STATUS_ERR_NOT_REGISTERED
2299
2300
2301    13   SILC_COMMAND_OPER
2302
2303         Max Arguments:  2
2304             Arguments:  (1) <username>  (2) <authentication data>
2305
2306         This command is used by normal client to obtain server operator
2307         privileges on some server or router.  Note that router operator
2308         has router privileges that supersedes the server operator
2309         privileges and this does not obtain those privileges.  Client
2310         must use SILCOPER command to obtain router level privileges.
2311
2312         The <username> is the username set in the server configurations
2313         as operator.  The <authentication data> is the data that the
2314         client is authenticated against.  It may be passphrase prompted
2315         for user on client's screen or it may be public key
2316         authentication data (data signed with private key), or 
2317         certificate.
2318
2319         Reply messages to the command:
2320
2321         Max Arguments:  1
2322             Arguments:  (1) <Status Payload>
2323
2324         This command replies only with Status Payload.
2325
2326         Status messages:
2327
2328             SILC_STATUS_OK
2329             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2330             SILC_STATUS_ERR_TOO_MANY_PARAMS
2331             SILC_STATUS_ERR_NOT_REGISTERED
2332             SILC_STATUS_ERR_BAD_PASSWORD
2333             SILC_STATUS_ERR_AUTH_FAILED
2334
2335
2336    14   SILC_COMMAND_JOIN
2337
2338         Max Arguments:  4
2339             Arguments:  (1) <channel>       (2) <Client ID>
2340                         (3) [<passphrase>]  (4) [<cipher>]
2341
2342         Join to channel/create new channel.  This command is used to
2343         join to a channel.  If the channel does not exist the channel is
2344         created.  If server is normal server this command must be forwarded
2345         to router who will create the channel.  The channel may be protected
2346         with passphrase.  If this is the case the passphrase must be sent
2347         along the join command.
2348
2349         The name of the <channel> must not include any spaces (` '),
2350         non-printable characters, commas (`,') or any wildcard characters.
2351
2352         The second argument <Client ID> is the Client ID of the client who
2353         is joining to the client.  When client sends this command to the
2354         server the <Client ID> must be the client's own ID.
2355
2356         Cipher to be used to secure the traffic on the channel may be
2357         requested by sending the name of the requested <cipher>.  This
2358         is used only if the channel does not exist and is created.  If
2359         the channel already exists the cipher set previously for the
2360         channel will be used to secure the traffic.
2361
2362         The server must check whether the user is allowed to join to
2363         the requested channel.  Various modes set to the channel affect
2364         the ability of the user to join the channel.  These conditions
2365         are:
2366
2367             o  The user must be invited to the channel if the channel
2368                is invite-only channel.
2369
2370             o  The Client ID/nickname/username/hostname must not match
2371                any active bans.
2372
2373             o  The correct passphrase must be provided if passphrase 
2374                is set to the channel.
2375
2376             o  The user count limit, if set, must not be reached.
2377
2378         Reply messages to the command:
2379
2380         Max Arguments:  9
2381             Arguments:  (1) <Status Payload>  (2) <channel> 
2382                         (3) <Channel ID>      (4) <channel mode mask>
2383                         (5) <created>         (6) <Channel Key Payload>
2384                         (7) [<ban mask>]      (8) [<invite list>]
2385                         (9) [<topic>]
2386
2387         This command replies with the channel name requested by the
2388         client, channel ID of the channel and topic of the channel
2389         if it exists.  It also replies with the channel mode mask
2390         which tells all the modes set on the channel.  If the
2391         channel is created the mode mask is zero (0).  If ban mask
2392         and/or invite list is set they are sent as well.
2393
2394         Client receives the channel key in the reply message as well
2395         inside <Channel Key Payload>.
2396
2397         Status messages:
2398
2399             SILC_STATUS_OK
2400             SILC_STATUS_ERR_WILDCARDS
2401             SILC_STATUS_ERR_NOT_REGISTERED
2402             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2403             SILC_STATUS_ERR_TOO_MANY_PARAMS
2404             SILC_STATUS_ERR_BAD_PASSWORD
2405             SILC_STATUS_ERR_CHANNEL_IS_FULL
2406             SILC_STATUS_ERR_NOT_INVITED
2407             SILC_STATUS_ERR_BANNED_FROM_CHANNEL
2408             SILC_STATUS_ERR_BAD_CHANNEL
2409             SILC_STATUS_ERR_USER_ON_CHANNEL
2410
2411
2412    15   SILC_COMMAND_MOTD
2413
2414         Max Arguments:  1
2415             Arguments:  (1) <server>
2416
2417         This command is used to query the Message of the Day of the server.
2418
2419         Reply messages to the command:
2420
2421         Max Arguments:  2
2422             Arguments:  (1) <Status Payload>  (2) [<motd>]
2423
2424         This command replies with the motd message if it exists.
2425
2426         Status messages:
2427
2428             SILC_STATUS_OK
2429             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2430             SILC_STATUS_ERR_TOO_MANY_PARAMS
2431             SILC_STATUS_ERR_NOT_REGISTERED
2432             SILC_STATUS_ERR_NO_SUCH_SERVER
2433
2434
2435    16   SILC_COMMAND_UMODE
2436
2437         Max Arguments:  2
2438             Arguments:  (1) <Client ID>  (2) <client mode mask>
2439
2440         This command is used by client to set/unset modes for itself.
2441         However, there are some modes that the client may not set itself,
2442         but they will be set by server.  However, client may unset any
2443         mode.  Modes may be masked together ORing them thus having
2444         several modes set.  Client must keep its client mode mask
2445         locally so that the mode setting/unsetting would work without
2446         problems.  Client may change only its own modes.
2447
2448         Following client modes are defined:
2449
2450            0x0000    SILC_UMODE_NONE
2451
2452               No specific mode for client.  This is the initial
2453               setting when new client is created.  The client is
2454               normal client now.
2455
2456
2457            0x0001    SILC_UMODE_SERVER_OPERATOR
2458
2459               Marks the user as server operator.  Client cannot
2460               set this mode itself.  Server sets this mode to the
2461               client when client attains the server operator
2462               privileges by SILC_COMMAND_OPER command.  Client
2463               may unset the mode itself.
2464
2465
2466            0x0002    SILC_UMODE_ROUTER_OPERATOR
2467
2468               Marks the user as router (SILC) operator.  Client
2469               cannot this mode itself.  Router sets this mode to
2470               the client when client attains the router operator
2471               privileges by SILC_COMMAND_SILCOPER command.  Client
2472               may unset the mode itself.
2473
2474         Reply messages to the command:
2475
2476         Max Arguments:  2
2477             Arguments:  (1) <Status Payload>  (2) <client mode mask>
2478
2479         This command replies with the changed client mode mask that
2480         the client is required to keep locally.
2481
2482
2483         Status messages:
2484
2485             SILC_STATUS_OK
2486             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2487             SILC_STATUS_ERR_TOO_MANY_PARAMS
2488             SILC_STATUS_ERR_NOT_REGISTERED
2489             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2490             SILC_STATUS_ERR_BAD_CLIENT_ID
2491             SILC_STATUS_ERR_NOT_YOU
2492             SILC_STATUS_ERR_UNKNOWN_MODE
2493             SILC_STATUS_ERR_NO_RECIPIENT
2494             SILC_STATUS_ERR_NO_CLIENT_ID
2495
2496
2497    17   SILC_COMMAND_CMODE
2498
2499         Max Arguments:  7
2500             Arguments:  (1) <Channel ID>    (2) <channel mode mask>
2501                         (3) [<user limit>]  (4) [<passphrase>]
2502                         (5) [<ban mask>]    (6) [<invite list>]
2503                         (7) [<cipher>[:<key len>]]
2504
2505         This command is used by client to set or change channel flags on
2506         a channel.  Channel has several modes that set various properties
2507         of a channel.  Modes may be masked together by ORing them thus
2508         having several modes set.  The <Channel ID> is the ID of the
2509         target channel.  The client changing channel mode must be on
2510         the same channel and poses sufficient privileges to be able to
2511         change the mode.
2512
2513         When the mode is changed SILC_NOTIFY_TYPE_CMODE_CHANGE notify
2514         type is distributed to the channel.
2515
2516         Following channel modes are defined:
2517
2518            0x0000    SILC_CMODE_NONE
2519
2520               No specific mode on channel.  This is the default when
2521               channel is created.  This means that channel is just plain
2522               normal channel.
2523
2524
2525            0x0001    SILC_CMODE_PRIVATE
2526
2527               Channel is private channel.  Private channels are shown
2528               in the channel list listed with SILC_COMMAND_LIST command
2529               with indication that the channel is private.  Also,
2530               client on private channel will no be detected to be on
2531               the channel as the channel is not shown in the client's
2532               currently joined channel list.  Channel founder and 
2533               channel operator may set/unset this mode.
2534
2535               Typical implementation would use [+|-]p on user interface
2536               to set/unset this mode.
2537
2538
2539            0x0002    SILC_CMODE_SECRET
2540
2541               Channel is secret channel.  Secret channels are not shown
2542               in the list listed with SILC_COMMAND_LIST command.  Secret
2543               channels can be considered to be invisible channels.
2544               Channel founder and channel operator may set/unset this
2545               mode.
2546
2547               Typical implementation would use [+|-]s on user interface
2548               to set/unset this mode.
2549
2550
2551            0x0004    SILC_CMODE_PRIVKEY
2552
2553               Channel uses private channel key to protect the traffic
2554               on the channel.  When this mode is set the client will be
2555               responsible to set the key it wants to use to encrypt and
2556               decrypt the traffic on channel.  Server generated channel
2557               keys are not used at all.  This mode provides additional
2558               security as clients on channel may agree to use private
2559               channel key that even servers do not know.  Naturally,
2560               this requires that every client on the channel knows
2561               the key before hand (it is considered to be pre-shared-
2562               key).  This specification does not define how the private
2563               channel key is set as it is entirely local setting on
2564               client end.
2565
2566               As it is local setting it is possible to have several
2567               private channel keys on one channel.  In this case several
2568               clients can talk on same channel but only those clients
2569               that share the key with the message sender will be able
2570               to hear the talking.  Client should not display those
2571               message for the end user that it is not able to decrypt
2572               when this mode is set.
2573
2574               Only channel founder may set/unset this mode.  If this
2575               mode is unset the server will distribute new channel
2576               key to all clients on the channel which will be used
2577               thereafter.
2578
2579               Typical implementation would use [+|-]k on user interface
2580               to set/unset this mode.
2581
2582
2583            0x0008    SILC_CMODE_INVITE
2584
2585               Channel is invite only channel.  Client may join to this
2586               channel only if it is invited to the channel.  Channel
2587               founder and channel operator may set/unset this mode.
2588
2589               Typical implementation would use [+|-]i on user interface
2590               to set/unset this mode.
2591
2592
2593            0x0010    SILC_CMODE_TOPIC
2594
2595               The topic of the channel may only be set by client that
2596               is channel founder or channel operator.  Normal clients
2597               on channel will not be able to set topic when this mode
2598               is set.  Channel founder and channel operator may set/
2599               unset this mode.
2600
2601               Typical implementation would use [+|-]t on user interface
2602               to set/unset this mode.
2603
2604
2605            0x0020    SILC_CMODE_ULIMIT
2606
2607               User limit has been set to the channel.  New clients
2608               may not join to the channel when the limit set is
2609               reached.  Channel founder and channel operator may set/
2610               unset the limit.  The <user limit> argument is the
2611               number of limited users.
2612
2613               Typical implementation would use [+|-]l on user interface
2614               to set/unset this mode.
2615
2616
2617            0x0040    SILC_CMODE_PASSPHRASE
2618
2619               Passphrase has been set to the channel.  Client may
2620               join to the channel only if it is able to provide the
2621               correct passphrase.  Setting passphrases to channel
2622               is entirely safe as all commands are protected in the
2623               SILC network.  Only channel founder may set/unset
2624               the passphrase.  The <passphrase> argument is the
2625               set passphrase.
2626
2627               Typical implementation would use [+|-]a on user interface
2628               to set/unset this mode.
2629
2630
2631            0x0080    SILC_CMODE_BAN
2632
2633               Ban mask has been set to the channel.  The ban mask
2634               may be used to ban specific clients to join the channel.
2635               The <ban mask> argument is the set ban mask.  When
2636               unsetting a ban mask the mask must be provided as
2637               argument.  Channel founder and channel operator may
2638               set/unset this mode.  Channel founder may not be
2639               added to the ban list.  <ban mask> is comma (`,') separated
2640               list of banned clients in following format:
2641
2642                 [<nickname>!][<username>]@[<hostname>]
2643
2644               Wildcards maybe used when banning clients.
2645
2646               Typical implementation would use [+|-]b on user interface
2647               to set/unset this mode.
2648
2649
2650            0x0100    SILC_CMODE_INVITE_LIST
2651
2652               Invite list has been set to the channel.  The invite list
2653               can be used to mark the clients that is able to join
2654               channel without being invited when the channel is set to
2655               be invite-only channel.  The <invite list> argument is the
2656               set invite mask.  When unsetting entry from the invite list
2657               the entry must be provided as argument.  Channel founder and
2658               channel operator may set/unset this mode.  The <invite list>
2659               is command (`,') separated list of invited clients in following
2660               format:
2661
2662                 [<nickname>!][<username>]@[<hostname>]
2663
2664               Wildcards maybe used when setting the invite list.
2665
2666               Typical implementation would use [+|-]I on user interface
2667               to set/unset this mode.
2668
2669         
2670            0x0200    SILC_CMODE_CIPHER
2671
2672               Sets specific cipher to be used to protect channel
2673               traffic.  The <cipher> argument is the requested cipher.
2674               When set or unset the server must re-generate new
2675               channel key.  If <key len> argument is specified with
2676               <cipher> argument the new key is generated of <key len>
2677               length in bits.  Only channel founder may set the cipher of 
2678               the channel.  When unset the new key is generated using
2679               default cipher for the channel.
2680
2681               Typical implementation would use [+|-]c on user interface
2682               to set/unset this mode.
2683
2684
2685         To make the mode system work, client must keep the channel mode
2686         mask locally so that the mode setting and unsetting would work
2687         without problems.  The client receives the initial channel mode
2688         mask when it joins to the channel.  When the mode changes on
2689         channel the server distributes the changed channel mode mask to
2690         all clients on the channel by sending SILC_COMMAND_CMODE command
2691         reply packet.
2692
2693
2694         Reply messages to the command:
2695
2696         Max Arguments:  2
2697             Arguments:  (1) <Status Payload>  (2) <channel mode mask>
2698
2699         This command replies with the changed channel mode mask that
2700         client is required to keep locally.
2701
2702         Status messages:
2703
2704             SILC_STATUS_OK
2705             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2706             SILC_STATUS_ERR_TOO_MANY_PARAMS
2707             SILC_STATUS_ERR_NOT_REGISTERED
2708             SILC_STATUS_ERR_NOT_ON_CHANNEL
2709             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
2710             SILC_STATUS_ERR_BAD_CHANNEL_ID
2711             SILC_STATUS_ERR_NO_CHANNEL_ID
2712             SILC_STATUS_ERR_NO_CHANNEL_PRIV
2713             SILC_STATUS_ERR_UNKNOWN_MODE
2714             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2715
2716
2717    19   SILC_COMMAND_CUMODE
2718
2719         Max Arguments:  3
2720             Arguments:  (1) <Channel ID>  (2) <mode mask>
2721                         (3) <Client ID>
2722
2723         This command is used by client to change channel user modes on
2724         channel.  Users on channel may have some special modes and this
2725         command is used by channel operators to set or change these modes.
2726         The <Channel ID> is the ID of the target channel.  The <mode mask>
2727         is OR'ed mask of modes.  The <Client ID> is the target client.
2728         The client changing channel user modes must be on the same channel
2729         as the target client and poses sufficient privileges to be able to
2730         change the mode.
2731
2732         When the mode is changed SILC_NOTIFY_TYPE_CUMODE_CHANGE notify
2733         type is distributed to the channel.
2734
2735         Following channel modes are defined:
2736
2737            0x0000    SILC_CUMODE_NONE
2738
2739               No specific mode.  This is the normal situation for client.
2740               Also, this is the mode set when removing all modes from client.
2741
2742
2743            0x0001    SILC_CUMODE_FOUNDER
2744
2745               The client is channel founder of the channel.  This mode
2746               cannot be set by other client, it is set by the server when
2747               the channel was founded (created).  The mode is provided 
2748               because client may remove the founder rights from itself.
2749
2750
2751            0x0002    SILC_CUMODE_OPERATOR
2752
2753               Sets channel operator privileges on the channel for a
2754               client on the channel.  Channel founder and channel operator
2755               may set/unset (promote/demote) this mode.
2756
2757
2758         Reply messages to the command:
2759
2760         Max Arguments:  3
2761             Arguments:  (1) <Status Payload>  (2) <channel user mode mask>
2762                         (3) <Client ID>
2763
2764         This command replies with the changed channel user mode mask that
2765         client is required to keep locally.  The <Client ID> is the target
2766         client.
2767
2768         Status messages:
2769
2770             SILC_STATUS_OK
2771             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2772             SILC_STATUS_ERR_TOO_MANY_PARAMS
2773             SILC_STATUS_ERR_NOT_REGISTERED
2774             SILC_STATUS_ERR_NOT_ON_CHANNEL
2775             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
2776             SILC_STATUS_ERR_BAD_CHANNEL_ID
2777             SILC_STATUS_ERR_NO_CHANNEL_ID
2778             SILC_STATUS_ERR_NO_CHANNEL_PRIV
2779             SILC_STATUS_ERR_UNKNOWN_MODE
2780             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2781
2782
2783    19   SILC_COMMAND_KICK
2784
2785         Max Arguments:  3
2786             Arguments:  (1) <channel>  (2) <Client ID>  
2787                         (3) [<comment>]
2788
2789         This command is used by channel operators to remove a client from
2790         channel.  The <channel> argument is the channel the client to be
2791         removed is on currently.  Note that the "kicker" must be on the same
2792         channel.  If <comment> is provided it will be sent to the removed
2793         client.
2794
2795         Reply messages to the command:
2796
2797         Max Arguments:  1
2798             Arguments:  (1) <Status Payload>
2799
2800         This command replies only with Status Payload.
2801
2802         Status messages:
2803
2804             SILC_STATUS_OK
2805             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2806             SILC_STATUS_ERR_TOO_MANY_PARAMS
2807             SILC_STATUS_ERR_NOT_REGISTERED
2808             SILC_STATUS_ERR_NO_SUCH_CHANNEL
2809             SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
2810             SILC_STATUS_ERR_NO_CHANNEL_PRIV
2811             SILC_STATUS_ERR_NO_CLIENT_ID
2812
2813
2814    20   SILC_COMMAND_RESTART
2815
2816         Max Arguments:  0
2817             Arguments:  None
2818
2819         This command may only be used by server operator to force a
2820         server to restart itself.
2821
2822         Reply messages to the command:
2823
2824         Max Arguments:  1
2825             Arguments:  (1) <Status Payload>
2826
2827         This command replies only with Status Payload.
2828
2829         Status messages:
2830
2831             SILC_STATUS_OK
2832             SILC_STATUS_ERR_NOT_REGISTERED
2833             SILC_STATUS_ERR_NO_SERVER_PRIV
2834
2835
2836
2837
2838
2839    21   SILC_COMMAND_CLOSE
2840
2841         Max Arguments:  1
2842             Arguments:  (1) <Server ID>
2843
2844         This command is used only by operator to close connection to a
2845         remote site.  The <Server ID> argument is the ID of the remote
2846         site and must be valid.
2847
2848         Reply messages to the command:
2849
2850         Max Arguments:  1
2851             Arguments:  (1) <Status Payload>
2852
2853         This command replies only with Status Payload.
2854
2855         Status messages:
2856
2857             SILC_STATUS_OK
2858             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2859             SILC_STATUS_ERR_TOO_MANY_PARAMS
2860             SILC_STATUS_ERR_NOT_REGISTERED
2861             SILC_STATUS_ERR_NO_SUCH_SERVER
2862             SILC_STATUS_ERR_NO_SERVER_PRIV
2863             SILC_STATUS_ERR_NO_SUCH_SERVER_ID
2864
2865
2866    22   SILC_COMMAND_DIE
2867
2868         Max Arguments:  0
2869             Arguments:  None
2870
2871         This command is used only by operator to shutdown the server.
2872         All connections to the server will be closed and the server is
2873         shutdown.
2874
2875         Reply messages to the command:
2876
2877
2878
2879         Max Arguments:  1
2880             Arguments:  (1) <Status Payload>
2881
2882         This command replies only with Status Payload.
2883
2884         Status messages:
2885
2886             SILC_STATUS_OK
2887             SILC_STATUS_ERR_NOT_REGISTERED
2888             SILC_STATUS_ERR_NO_SERVER_PRIV
2889
2890
2891    23   SILC_COMMAND_SILCOPER
2892
2893         Max Arguments:  2
2894             Arguments:  (1) <username>  (2) <authentication data>
2895
2896         This command is used by normal client to obtain router operator
2897         privileges (also known as SILC operator) on some router.  Note
2898         that router operator has router privileges that supersedes the
2899         server operator privileges.
2900
2901         The <username> is the username set in the server configurations
2902         as operator.  The <authentication data> is the data that the
2903         client is authenticated against.  It may be passphrase prompted
2904         for user on client's screen or it may be public key
2905         authentication data (data signed with private key), or 
2906         certificate.
2907
2908         Difference between router operator and server operator is that
2909         router operator is able to handle cell level properties while
2910         server operator (even on router server) is able to handle only
2911         local properties, such as, local connections and normal server
2912         administration.
2913
2914         Reply messages to the command:
2915
2916         Max Arguments:  1
2917             Arguments:  (1) <Status Payload>
2918
2919         This command replies only with Status Payload.
2920
2921         Status messages:
2922
2923             SILC_STATUS_OK
2924             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2925             SILC_STATUS_ERR_TOO_MANY_PARAMS
2926             SILC_STATUS_ERR_NOT_REGISTERED
2927             SILC_STATUS_ERR_BAD_PASSWORD
2928             SILC_STATUS_ERR_AUTH_FAILED
2929
2930
2931    24   SILC_COMMAND_LEAVE
2932
2933         Max Arguments:  1
2934             Arguments:  (1) <Channel ID>
2935
2936         This command is used by client to leave a channel the client is
2937         joined to.  After a client has leaved the channel the server
2938         must create new key for the channel and distribute to all clients
2939         still currently on the channel.
2940
2941         Reply messages to the command:
2942
2943         Max Arguments:  1
2944             Arguments:  (1) <Status Payload>
2945
2946         This command replies only with Status Payload.
2947
2948         Status messages:
2949
2950             SILC_STATUS_OK
2951             SILC_STATUS_ERR_NOT_REGISTERED
2952             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2953             SILC_STATUS_ERR_TOO_MANY_PARAMS
2954             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
2955             SILC_STATUS_ERR_BAD_CHANNEL_ID
2956             SILC_STATUS_ERR_NO_CHANNEL_ID
2957
2958
2959    25   SILC_COMMAND_USERS
2960
2961         Max Arguments:  1
2962             Arguments:  (1) <Channel ID>
2963
2964         This command is used to list user names currently on the requested
2965         channel; argument <Channel ID>.  The server must resolve the
2966         user names and send a comma (`,') separated list of user names
2967         on the channel.  Server or router may resolve the names by sending
2968         SILC_COMMAND_WHOIS commands.
2969
2970         If the requested channel is a private or secret channel, this
2971         command must not send the list of users, as private and secret
2972         channels cannot be seen by outside.  In this case the returned
2973         name list may include a indication that the server could not 
2974         resolve the names of the users on the channel.  Also, in this case
2975         Client ID's or client modes are not sent either.
2976
2977         Reply messages to the command:
2978
2979         Max Arguments:  5
2980             Arguments:  (1) <Status Payload>  (2) <Channel ID>
2981                         (3) <list count>      (4) <Client ID list>
2982                         (5) <client mode list>
2983
2984         This command replies with the Channel ID of the requested channel
2985         Client ID list of the users on the channel and list of their modes.
2986         The Client ID list has Client ID's of all users in the list.  The 
2987         <Client ID list> is formed by adding Client ID's one after another.
2988         The <client mode list> is formed by adding client's user modes on
2989         the channel one after another (4 bytes (32 bits) each).  The <list 
2990         count> of length of 4 bytes (32 bits), tells the number of entries
2991         in the lists.  Both lists must have equal number of entries.
2992
2993         Status messages:
2994
2995             SILC_STATUS_OK
2996             SILC_STATUS_ERR_NOT_REGISTERED
2997             SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
2998             SILC_STATUS_ERR_TOO_MANY_PARAMS
2999             SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
3000             SILC_STATUS_ERR_BAD_CHANNEL_ID
3001             SILC_STATUS_ERR_NO_CHANNEL_ID
3002             SILC_STATUS_ERR_NOT_ON_CHANNEL
3003
3004
3005    26 - 199
3006
3007         Currently undefined commands.
3008
3009
3010    200 - 254
3011
3012         These commands are reserved for private use and will not be defined
3013         in this document.
3014
3015
3016    255  SILC_COMMAND_MAX   
3017
3018         Reserved command.  This must not be sent.
3019 .in 3
3020
3021
3022 .ti 0
3023 5.3 SILC Command Status Types
3024
3025 .ti 0
3026 5.3.1 SILC Command Status Payload
3027
3028 Command Status Payload is sent in command reply messages to indicate
3029 the status of the command.  The payload is one of argument in the
3030 command thus this is the data area in Command Argument Payload described
3031 in [SILC2].  The payload is only 2 bytes of length.  Following diagram
3032 represents the Command Status Payload (field is always in MSB order).
3033
3034
3035
3036
3037
3038 .in 21
3039 .nf
3040                      1
3041  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
3042 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3043 |        Status Message         |
3044 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3045 .in 3
3046
3047 .ce
3048 Figure 6:  SILC Command Status Payload
3049
3050
3051 .in 6
3052 o Status Message (2 bytes) - Indicates the status message.
3053   All Status messages are described in the next section.
3054 .in 3
3055
3056
3057 .ti 0
3058 5.3.2 SILC Command Status List
3059
3060 Command Status messages are returned in the command reply messages
3061 to indicate whether the command were executed without errors.  If error
3062 has occured the status tells which error occured.  Status payload only
3063 sends numeric reply about the status.  Receiver of the payload must
3064 convert the numeric values into human readable error messages.  The
3065 list of status messages below has an example human readable error
3066 messages that client may display for the user.
3067
3068 List of all defined command status messages following.
3069
3070 .in 0
3071    Generic status messages:
3072
3073    0    SILC_STATUS_OK
3074
3075         Ok status.  Everything went Ok.  The status payload maybe
3076         safely ignored in this case.
3077
3078    1    SILC_STATUS_LIST_START
3079
3080         Start of the list.  There will be several command replies and
3081         this reply is the start of the list.
3082
3083    2    SILC_STATUS_LIST_ITEM
3084
3085         Item in the list.  This is one of the item in the list but not the
3086         first or last one.
3087
3088    3    SILC_STATUS_LIST_END
3089
3090         End of the list.  There were several command replies and this
3091         reply is the last of the list.  There won't be other replies
3092         belonging to this list after this one.
3093
3094    4 - 9
3095
3096         Currently undefined and has been reserved for the future.
3097
3098
3099    Error status message:
3100
3101    10   SILC_STATUS_ERR_NO_SUCH_NICK
3102
3103         "No such nickname".  Requested nickname does not exist.
3104
3105    11   SILC_STATUS_ERR_NO_SUCH_CHANNEL
3106
3107         "No such channel".  Requested channel name does not exist.
3108
3109    12   SILC_STATUS_ERR_NO_SUCH_SERVER
3110
3111         "No such server".  Requested server name does not exist.
3112
3113    13   SILC_STATUS_ERR_TOO_MANY_TARGETS
3114
3115         "Duplicate recipients. No message delivered".  Message were
3116         tried to be sent to recipient which has several occurrences in 
3117         the recipient list.
3118
3119    14   SILC_STATUS_ERR_NO_RECIPIENT
3120
3121         "No recipient given".  Command required recipient which was
3122         not provided.
3123
3124    15   SILC_STATUS_ERR_UNKNOWN_COMMAND
3125
3126         "Unknown command".  Command sent to server is unknown by the
3127         server.
3128
3129    16   SILC_STATUS_ERR_WILDCARDS
3130
3131         "Wildcards cannot be used".  Wildcards were provided but they
3132         weren't permitted.
3133
3134    17   SILC_STATUS_ERR_NO_CLIENT_ID
3135
3136         "No Client ID given".  Client ID were expected as command
3137         parameter but were not found.
3138
3139    18   SILC_STATUS_ERR_NO_CHANNEL_ID
3140
3141         "No Channel ID given".  Channel ID were expected as command
3142         parameter but were not found.
3143
3144    19   SILC_STATUS_ERR_NO_SERVER_ID
3145
3146         "No Serve ID given".  Server ID were expected as command
3147         parameter but were not found.
3148
3149    20   SILC_STATUS_ERR_BAD_CLIENT_ID
3150
3151         "Bad Client ID".  Client ID provided were erroneous.
3152
3153    21   SILC_STATUS_ERR_BAD_CHANNEL_ID
3154
3155         "Bad Channel ID".  Channel ID provided were erroneous.
3156
3157    22   SILC_STATUS_ERR_NO_SUCH_CLIENT_ID
3158
3159         "No such Client ID".  Client ID provided does not exist.
3160
3161    23   SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID
3162
3163         "No such Channel ID".  Channel ID provided does not exist.
3164
3165    24   SILC_STATUS_ERR_NICKNAME_IN_USE
3166
3167         "Nickname already exists".  Nickname created could not be 
3168         registered because number of same nicknames were already set to
3169         maximum.  This is not expected to happen in real life but is
3170         possible to occur.
3171
3172    25   SILC_STATUS_ERR_NOT_ON_CHANNEL
3173
3174         "You are not on that channel".  The command were specified for
3175         channel user is not currently on.
3176
3177    26   SILC_STATUS_ERR_USER_NOT_ON_CHANNEL
3178
3179         "They are not on channel".  The requested target client is not
3180         on requested channel.
3181
3182    27   SILC_STATUS_ERR_USER_ON_CHANNEL
3183
3184         "User already on channel".  User were invited on channel they
3185         already are on.
3186
3187    28   SILC_STATUS_ERR_NOT_REGISTERED
3188
3189         "You have not registered".  User executed command that requires
3190         the client to be registered on the server before it may be
3191         executed.
3192
3193    29   SILC_STATUS_ERR_NOT_ENOUGH_PARAMS
3194
3195         "Not enough parameters".  Command requires more parameters
3196         than provided.
3197
3198    30   SILC_STATUS_ERR_TOO_MANY_PARAMS
3199
3200         "Too many parameters".  Too many parameters were provided
3201         for the command.
3202
3203    31   SILC_STATUS_ERR_PERM_DENIED
3204
3205         "Your host is not among the privileged".  The client tried to
3206         register on server that does not allow this host to connect.
3207
3208    32   SILC_STATUS_ERR_BANNED_FROM_SERVER
3209
3210         "You are banned from this server".  The client tried to register
3211         on server that has explicitly denied this host to connect.
3212
3213    33   SILC_STATUS_ERR_BAD_PASSWORD
3214
3215         "Cannot join channel. Incorrect password".  Password provided for 
3216         channel were not accepted.
3217
3218    34   SILC_STATUS_ERR_CHANNEL_IS_FULL
3219
3220         "Cannot join channel. Channel is full".  The channel is full
3221         and client cannot be joined to it.
3222
3223    35   SILC_STATUS_ERR_NOT_INVITED
3224
3225         "Cannot join channel. You have not been invited".  The channel
3226         is invite only channel and client has not been invited.
3227
3228    36   SILC_STATUS_ERR_BANNED_FROM_CHANNEL
3229
3230         "Cannot join channel. You have been banned".  The client has
3231         been banned from the channel.
3232
3233    37   SILC_STATUS_ERR_UNKNOWN_MODE
3234
3235         "Unknown mode".  Mode provided by the client were unknown to
3236         the server.
3237
3238    38   SILC_STATUS_ERR_NOT_YOU
3239
3240         "Cannot change mode for other users".  User tried to change
3241         someone else's mode.
3242
3243    39   SILC_STATUS_ERR_NO_CHANNEL_PRIV
3244
3245         "Permission denied. You are not channel operator".  Command may 
3246         be executed only by channel operator.
3247
3248    40   SILC_STATUS_ERR_NO_SERVER_PRIV
3249
3250         "Permission denied. You are not server operator".  Command may
3251         be executed only by server operator.
3252
3253    41   SILC_STATUS_ERR_NO_ROUTER_PRIV
3254
3255         "Permission denied. You are not SILC operator".  Command may be
3256         executed only by router (SILC) operator.
3257
3258    42   SILC_STATUS_ERR_BAD_NICKNAME
3259
3260         "Bad nickname".  Nickname requested contained illegal characters
3261         or were malformed.
3262
3263    43   SILC_STATUS_ERR_BAD_CHANNEL
3264
3265         "Bad channel name".  Channel requested contained illegal characters
3266         or were malformed.
3267
3268    44   SILC_STATUS_ERR_AUTH_FAILED
3269
3270         "Authentication failed".  The authentication data sent as 
3271         argument were wrong and thus authentication failed.
3272 .in 3
3273
3274
3275 .ti 0
3276 6 Security Considerations
3277
3278 Security is central to the design of this protocol, and these security
3279 considerations permeate the specification.  Common security considerations
3280 such as keeping private keys truly private and using adequate lengths for
3281 symmetric and asymmetric keys must be followed in order to maintain the
3282 security of this protocol.
3283
3284
3285 .ti 0
3286 7 References
3287
3288 [SILC2]      Riikonen, P., "SILC Packet Protocol", Internet Draft,
3289              June 2000.
3290
3291 [SILC3]      Riikonen, P., "SILC Key Exchange and Authentication 
3292              Protocols", Internet Draft, June 2000.
3293
3294 [IRC]        Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
3295              RFC 1459, May 1993.
3296
3297 [SSH-TRANS]  Ylonen, T., et al, "SSH Transport Layer Protocol", 
3298              Internet Draft.
3299
3300 [PGP]        Callas, J., et al, "OpenPGP Message Format", RFC 2440,
3301              November 1998.
3302
3303 [SPKI]       Ellison C., et al, "SPKI Certificate Theory", RFC 2693,
3304              September 1999.
3305
3306 [PKIX-Part1] Housley, R., et al, "Internet X.509 Public Key 
3307              Infrastructure, Certificate and CRL Profile", RFC 2459,
3308              January 1999.
3309
3310 [Schneier]   Schneier, B., "Applied Cryptography Second Edition",
3311              John Wiley & Sons, New York, NY, 1996.
3312
3313 [Menezes]    Menezes, A., et al, "Handbook of Applied Cryptography",
3314              CRC Press 1997.
3315
3316 [OAKLEY]     Orman, H., "The OAKLEY Key Determination Protocol",
3317              RFC 2412, November 1998.
3318
3319 [ISAKMP]     Maughan D., et al, "Internet Security Association and
3320              Key Management Protocol (ISAKMP)", RFC 2408, November
3321              1998.
3322
3323 [IKE]        Harkins D., and Carrel D., "The Internet Key Exchange
3324              (IKE)", RFC 2409, November 1998.
3325
3326 [HMAC]       Krawczyk, H., "HMAC: Keyed-Hashing for Message
3327              Authentication", RFC 2104, February 1997.
3328
3329
3330
3331 .ti 0
3332 8 Author's Address
3333
3334 .nf
3335 Pekka Riikonen
3336 Kasarmikatu 11 A4
3337 70110 Kuopio
3338 Finland
3339
3340 EMail: priikone@poseidon.pspt.fi
3341
3342 This Internet-Draft expires 6 Jun 2001