Initial revision
[silc.git] / doc / draft-riikonen-silc-ke-auth-00.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 27 June 2000
12 .ds CH Key Exchange and Authentication
13 .na
14 .hy 0
15 .in 0
16 .nf
17 Network Working Group                                      P. Riikonen
18 Internet-Draft
19 draft-riikonen-silc-ke-auth-00.txt                        27 June 2000
20 Expires: 27 Jan 2001
21
22 .in 3
23
24 .ce
25 SILC Key Exchange and Authentication Protocols
26
27 .ti 0
28 Status of this Memo
29
30 This document is an Internet-Draft.  Internet-Drafts are working
31 documents of the Internet Engineering Task Force (IETF), its areas,
32 and its working groups.  Note that other groups may also distribute
33 working documents as Internet-Drafts.
34
35 Internet-Drafts are draft documents valid for a maximum of six
36 months and may be updated, replaced, or obsoleted by other 
37 documents at any time. It is inappropriate to use Internet-Drafts  
38 as reference material or to cite them other than as 
39 ``work in progress.''
40
41 To learn the current status of any Internet-Draft, please check the
42 ``1id-abstracts.txt'' listing contained in the Internet-Drafts
43 Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
44 munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
45 ftp.isi.edu (US West Coast).
46
47 The distribution of this memo is unlimited.
48
49
50 .ti 0
51 Abstract
52
53 This memo describes two protocols used in the Secure Internet Live
54 Conferencing (SILC) protocol specified in the Secure Internet Live
55 Conferencing, Protocol Specification internet-draft [SILC1].  The
56 SILC Key Exchange (SKE) protocol provides secure key exchange between
57 two parties resulting into shared secret key material.  The protocol
58 is based on Diffie Hellman key exchange algorithm and its functionality
59 is derived from several key exchange protocols.  SKE uses best parts
60 of the SSH2 Key Exchange protocol, Station-To-Station (STS) protocol
61 and the OAKLEY Key Determination protocol [OAKLEY].
62
63 The SILC Connection Authentication protocol provides user level
64 authentication used when creating connections in SILC network.  The
65 protocol is transparent to the authentication data which means that it
66 can be used to authenticate the user with, for example, passphrase
67 (pre-shared- secret) or public key (and certificate).
68
69
70
71 .ti 0
72 Table of Contents
73
74 .nf
75 1 Introduction ..................................................  2
76 2 SILC Key Exchange Protocol ....................................  3
77   2.1 Key Exchange Payloads .....................................  3
78       2.1.1 Key Exchange Start Payload ..........................  4
79       2.1.2 Key Exchange 1 Payload ..............................  7
80       2.1.3 Key Exchange 2 Payload ..............................  9
81   2.2 Key Exchange Procedure .................................... 10
82   2.3 Processing the Key Material ............................... 12
83   2.4 SILC Key Exchange Groups .................................. 13
84       2.4.1 diffie-hellman-group1 ............................... 13
85       2.4.2 diffie-hellman-group2 ............................... 14
86   2.5 Key Exchange Status Types ................................. 14
87 3 SILC Connection Authentication Protocol ....................... 16
88   3.1 Connection Auth Payload ................................... 17
89   3.2 Connection Authentication Types ........................... 18
90       3.2.1 Passphrase Authentication ........................... 18
91       3.2.2 Public Key Authentication ........................... 18
92   3.3 Connection Authentication Status Types .................... 19
93 4 Security Considerations ....................................... 19
94 5 References .................................................... 19
95 6 Author's Address .............................................. 20
96
97
98 .ti 0
99 List of Figures
100
101 .nf
102 Figure 1:  Key Exchange Start Payload
103 Figure 2:  Key Exchange 1 Payload
104 Figure 3:  Key Exchange 2 Payload
105 Figure 4:  Connection Auth Payload
106
107
108 .ti 0
109 1 Introduction
110
111 This memo describes two protocols used in the Secure Internet Live
112 Conferencing (SILC) protocol specified in the Secure Internet Live
113 Conferencing, Protocol Specification internet-draft [SILC1].  The
114 SILC Key Exchange (SKE) protocol provides secure key exchange between
115 two parties resulting into shared secret key material.  The protocol
116 is based on Diffie Hellman key exchange algorithm and its functionality
117 is derived from several key exchange protocols.  SKE uses best parts
118 of the SSH2 Key Exchange protocol, Station-To-Station (STS) protocol
119 and the OAKLEY Key Determination protocol.
120
121 The SILC Connection Authentication protocol provides user level
122 authentication used when creating connections in SILC network.  The
123 protocol is transparent to the authentication data which means that it
124 can be used to authenticate the user with, for example, passphrase
125 (pre-shared- secret) or public key (and certificate).
126
127 The basis of secure SILC session requires strong and secure key exchange
128 protocol and authentication.  The authentication protocol is entirely
129 secured and no authentication data is ever sent in the network without
130 encrypting and authenticating it first.  Thus, authentication protocol
131 may be used only after the key exchange protocol has been successfully
132 completed.
133
134 This document refers constantly to other SILC protocol specification
135 Internet Drafts that are a must read for those who wants to understand
136 the function of these protocols.  The most important references are
137 the Secure Internet Live Conferencing, Protocol Specification [SILC1]
138 and SILC Packet Protocol [SILC2] Internet Drafts.
139
140 The protocol is intended to be used with the SILC protocol thus it
141 does not define own framework that could be used.  The framework is
142 provided by the SILC protocol.
143
144
145 .ti 0
146 2 SILC Key Exchange Protocol
147
148 SILC Key Exchange Protocol (SKE) is used to exchange shared secret
149 between connecting entities.  The result of this protocol is a key
150 material used to secure the communication channel.  The protocol uses
151 Diffie-Hellman key exchange algorithm and its functionality is derived
152 from several key exchange protocols.  SKE uses best parts of the SSH2
153 Key Exchange protocol, Station-To-Station (STS) protocol and the OAKLEY
154 Key Determination protocol.  The protocol does not claim any conformance
155 to any of these protocols, they were merely used as a reference when
156 designing this protocol.
157
158 The purpose of SILC Key Exchange protocol is to create session keys to
159 be used in current SILC session.  The keys are valid only for some period
160 of time (usually an hour) or at most until the session ends.  These keys
161 are used to protect packets like commands, command replies and other
162 communication between two entities.  If connection is server to server
163 connection, the keys are used to protect all traffic between those
164 servers.  In client connections usually all the packets are protected
165 with this key except channel messages; channels has their own keys and 
166 they are not exchanged with this protocol.
167
168
169 .ti 0
170 2.1 Key Exchange Payloads
171
172 During the key exchange procedure public data is sent between initiator
173 and responder.  This data is later used in the key exchange procedure.
174 There are several payloads used in the key exchange.  As for all SILC
175 packets, SILC Packet Header, described in [SILC2], is at the start of all
176 packets, the same is done with these payloads as well.  All fields in
177 all payloads are always in MSB (most significant byte first) order.
178 Following descriptions of these payloads.
179
180
181 .ti 0
182 2.1.1 Key Exchange Start Payload
183
184 Key exchange between two entities always begins with a
185 SILC_PACKET_KEY_EXCHANGE packet containing Key Exchange Start Payload.
186 When performing key exchange between client and server, the client sends
187 Key Exchange Start Payload to server filled with all security properties
188 that the client supports.  Server then checks if it supports the security
189 properties.
190
191 It then sends a Key Exchange Start Payload to client filled with security
192 properties it selected from the payload client originally sent.  The
193 payload sent by server must include only one chosen property per list.
194
195 When performing key exchange between server and server, the server who
196 is contacting sends the Key Exchange Start Payload with security property
197 list it supports to the other server.  The contacted party then chooses
198 the preferred properties same way as previously described.  It then
199 replies with the properties it wanted same way as previously described.
200
201 The Key Exchange Start Payload is used to tell connecting entities what
202 security properties and algorithms should be used in the communication.
203 If perfect forward secrecy (PFS) is not desired (PFS is undefined by
204 default) Key Exchange Start Payload is sent only once per session, thus,
205 for example, re-keying will not cause sending of a new payload.  If PFS
206 is desired, re-keying will always cause new key exchange thus causes
207 sending of a new Key Exchange Start Payload.
208
209 When performing first key exchange this payload is never encrypted, as
210 there are no existing keys to encrypt it with.  If performing re-keying
211 (PFS was selected) this payload is encrypted with the existing key and
212 encryption algorithm.
213
214 Cookie is also send in this payload.  Cookie is used to uniform the
215 payload so that none of the key exchange parties cannot determine this
216 payload before hand.  The cookie must be returned to the original sender
217 by the responder.
218
219 Following diagram represents the Key Exchange Start Payload.  The lists
220 mentioned below are always comma (`,') separated and the list must
221 not include spaces (` ').
222
223
224
225
226
227
228
229 .in 5
230 .nf
231                      1                   2                   3
232  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
233 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
234 |   RESERVED    |     Flags     |         Payload Length        |
235 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
236 |                                                               |
237 +                                                               +  
238 |                                                               |
239 +                            Cookie                             +
240 |                                                               |
241 +                                                               +
242 |                                                               |
243 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
244 |   Key Exchange Grp Length     |                               |
245 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
246 |                                                               |
247 ~                      Key Exchange Groups                      ~
248 |                                                               |
249 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
250 |        PKCS Alg Length        |                               |
251 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
252 |                                                               |
253 ~                         PKCS Algorithms                       ~
254 |                                                               |
255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
256 |     Encryption Alg Length     |                               |
257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
258 |                                                               |
259 ~                      Encryption Algorithms                    ~
260 |                                                               |
261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
262 |       Hash Alg Length         |                               |
263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
264 |                                                               |
265 ~                        Hash Algorithms                        ~
266 |                                                               |
267 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
268 |    Compression Alg Length     |                               |
269 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
270 |                                                               |
271 ~                     Compression Algorithms                    ~
272 |                                                               |
273 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
274 .in 3
275
276 .ce
277 Figure 1:  Key Exchange Start Payload
278
279
280
281 .in 6
282 o RESERVED (1 byte) - Reserved field.  Sender fills this with
283   zeroes (0).
284
285 o Flags (1 byte) - Indicates flags to be used in the key
286   exchange.  Several flags can be set at once by ORing the
287   flags together.  Following flags are reserved for this field.
288
289      No flags              0x00
290
291        In this case the field is ignored.
292
293      No Reply              0x01
294
295        If set the receiver of the payload does not reply to 
296        the packet.
297
298      PFS                   0x02
299
300        Perfect Forward Secrecy (PFS) to be used in the
301        key exchange protocol.  If not set, re-keying
302        is performed using the old key.  When PFS is used, 
303        re-keying and creating new keys for any particular 
304        purpose will cause new key exchange.
305
306        Rest of the flags are reserved for the future and
307        must not be set.
308
309 o Payload Length (2 bytes) - Length of the entire Key Exchange
310   Start payload.
311
312 o Cookie (16 bytes) - Cookie that uniforms this payload so
313   that each of the party cannot determine the payload before
314   hand.
315
316 o Key Exchange Grp Length (2 bytes) - The length of the
317   key exchange group list, including this field as well.
318
319 o Key Exchange Group (variable length) - The list of
320   key exchange groups.  See the section 2.1.2 SILC Key Exchange
321   Groups for definitions of these groups.
322
323 o PKCS Alg Length (2 bytes) - The length of the PKCS algorithms
324   list, including this field as well.
325
326 o PKCS Algorithms (variable length) - The list of PKCS 
327   algorithms.
328
329 o Encryption Alg Length (2 bytes) - The length of the encryption
330   algorithms list, including this field as well.
331
332 o Encryption Algorithms (variable length) - The list of
333   encryption algorithms.
334
335 o Hash Alg Length (2 bytes) - The length of the Hash algorithms
336   list, including this field as well.
337
338 o Hash Algorithms (variable length) - The list of Hash algorithms.
339
340 o Compression Alg Length (2 bytes) - The length of the
341   compression algorithms list, including this field as well.
342
343 o Compression Algorithms (variable length) - The list of 
344   compression algorithms.
345 .in 3
346
347
348 .ti 0
349 2.1.2 Key Exchange 1 Payload
350
351 Key Exchange 1 Payload is used to deliver computed public data from 
352 initiator to responder.  This data is used to compute the shared secret,
353 later by all parties.  Key Exchange 1 Payload is only sent after the 
354 SILC_PACKET_KEY_EXCHANGE packet and the Key Exchange Start Payload has
355 been processed by all the parties.
356
357 This payload sends the initiator's public key to the responder.  Responder
358 may need the public key in which case it should be checked to be trusted
359 by the responder.
360  
361 The payload may only be sent with SILC_PACKET_KEY_EXCHANGE_1 packet.
362 It must not be sent in any other packet type.  Following diagram 
363 represent the Key Exchange 1 Payload.
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380 .in 5
381 .nf
382                      1                   2                   3
383  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
384 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
385 |       Public Key Length       |        Public Key Type        |
386 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
387 |                                                               |
388 ~            Public Key of the Host (or certificate)            ~
389 |                                                               |
390 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
391 |      Public Data Length       |                               |
392 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
393 |                                                               |
394 ~                 Public Data (e = g ^ x mod p)                 ~
395 |                                                               |
396 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
397 .in 3
398
399 .ce
400 Figure 2:  Key Exchange 1 Payload
401
402
403 .in 6
404 o Public Key Length (2 bytes) - The length of the public key
405   (or certificate), including this field and public key type
406   field as well.
407
408 o Public Key Type (2 bytes) - The public key (or certificate) 
409   type.  This field indicates the type of the public key in 
410   the packet.  Following types are defined:
411
412      1    SILC style public key (mandatory)
413      2    SSH2 style public key (optional)
414      3    X.509 Version 3 certificate (optional)
415      4    OpenPGP certificate (optional)
416      5    SPKI certificate (optional)
417
418   The only required type to support is type number 1.  See 
419   [SILC1] for the SILC public key specification.  See
420   SSH public key specification in [SSH-TRANS].  See X.509v3
421   certificate specification in [PKIX-Part1].  See OpenPGP
422   certificate specification in [PGP].  See SPKI certificate
423   specification in [SPKI].  If this field includes zero (0)
424   or unsupported type number the protocol must be aborted
425   sending SILC_PACKET_FAILURE message.
426
427 o Public Data Length (2 bytes) - The length of the public
428   data computed by the responder, including this field
429   as well.
430
431 o Public Data (variable length) - The public data to be
432   sent to the responder.  See section 2.2 Key Exchange 
433   Procedure for detailed description how this field is
434   computed.  This value is binary encoded.
435 .in 3
436
437
438 .ti 0
439 2.1.3 Key Exchange 2 Payload
440
441 Key Exchange 2 Payload is used to deliver public key, computed public
442 data and signature from responder to initiator.  Initiator uses these
443 public parts of the key exchange protocol to compute the shared secret.
444
445 The payload may only be sent with SILC_PACKET_KEY_EXCHANGE_2 packet.
446 It must not be sent in any other packet type.  Following diagram 
447 represent the Key Exchange 2 Payload.
448
449
450
451 .in 5
452 .nf
453                      1                   2                   3
454  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
455 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
456 |       Public Key Length       |        Public Key Type        |
457 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
458 |                                                               |
459 ~            Public Key of the Host (or certificate)            ~
460 |                                                               |
461 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
462 |       Public Data Length      |                               |
463 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
464 |                                                               |
465 ~                 Public Data (f = g ^ y mod p)                 ~
466 |                                                               |
467 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
468 |        Signature Length       |                               |
469 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
470 |                                                               |
471 ~                        Signature Data                         ~
472 |                                                               |
473 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
474 .in 3
475
476 .ce
477 Figure 3:  Key Exchange 2 Payload
478
479
480
481 .in 6
482 o Public Key Length (2 bytes) - The length of the public key
483   (or certificate), including this field and public key type
484   field as well.
485
486 o Public Key Type (2 bytes) - The public key (or certificate) 
487   type.  This field indicates the type of the public key in 
488   the packet.  See previous sections for defined public key
489   types.
490
491 o Public Key of the host (variable length) - The public
492   key of the sender (or its certificate).  This is verified
493   by the receiver of the packet.  The type of this field
494   is indicated by previous Public Key Type field.
495
496 o Public Data Length (2 bytes) - The length of the public
497   data computed by the responder, including this field
498   as well.
499
500 o Public Data (variable length) - The public data computed
501   by the responder.  See section 2.2 Key Exchange Procedure
502   for detailed description how this field is computed.  This
503   value is binary encoded.
504
505 o Signature Length (2 bytes) - The length of the signature,
506   including the length of this field as well.
507
508 o Signature Data (variable length) - The signature signed
509   by the responder.  The receiver of this signature must
510   verify it.  The verification is done using the public
511   key received in this same payload.  See section 2.2
512   Key Exchange Procedure for detailed description how
513   to produce the signature.
514
515
516 .ti 0
517 2.2 Key Exchange Procedure
518
519 The key exchange begins by sending SILC_PACKET_KEY_EXCHANGE packet with
520 Key Exchange Start Payload to select the security properties to be used
521 in the key exchange and later in the  communication.
522
523 After Key Exchange Start Payload has been processed by both of the
524 parties the protocol proceeds as follows:
525
526
527 Setup:  p is a large and public safe prime.  This is one of the
528         Diffie Hellman groups.  q is order of subgroup (largest
529         prime factor of p).  g is a generator and is defined
530         along with the Diffie Hellman group.
531
532     1.  Initiator generates a random number x, where 1 < x < q, 
533         and computes e = g ^ x mod p.  The result e is then 
534         encoded into Key Exchange 1 Payload and sent
535         to the responder.
536
537
538     2.  Responder generates a random number y, where 1 < y < q,
539         and computes f = g ^ y mod p.  It then computes the
540         shared secret KEY = e ^ y mod p, and, a hash value 
541         HASH = hash(Key Exchange Start Payload data | Host public 
542         key (or certificate) | e | f | KEY).  It then signs
543         the HASH value with its private key resulting a signature
544         SIGN.  
545
546         It then encodes its public key (or certificate), f and 
547         SIGN into Key Exchange 2 Payload and sends it to the 
548         initiator.
549
550
551     3.  Initiator verifies that the public key provided in
552         the payload is authentic, or if certificates are used
553         it verifies the certificate.  Initiator may accept
554         the public key without verifying it, however, doing
555         so may result to insecure key exchange (accepting the
556         public key without verifying may be desirable for 
557         practical reasons on many environments.  For long term
558         use this is never desirable, in which case certificates
559         would be the preferred method to use).
560
561         Initiator then computes the shared secret KEY = 
562         f ^ x mod p, and, a hash value HASH in the same way as
563         responder did in phase 2.  It then verifies the 
564         signature SIGN from the payload with the hash value
565         HASH using the received public key.
566
567
568 If any of these phases is to fail SILC_PACKET_FAILURE is sent to
569 indicate that the key exchange protocol failed.  Any other packets must
570 not be sent or accepted during the key exchange except the
571 SILC_PACKET_KEY_EXCHANGE_*, SILC_PACKET_DISCONNECT, SILC_PACKET_FAILURE
572 and/or SILC_PACKET_SUCCESS packets.
573
574 The result of this protocol is a shared secret key material KEY and
575 a hash value HASH.  The key material itself is not fit to be used as 
576 a key, it needs to be processed further to derive the actual keys to be
577 used.  The key material is also used to produce other security parameters
578 later used in the communication.  See section 2.3 Processing the Key
579 Material for detailed description how to process the key material.
580
581 After the keys are processed the protocol is ended by sending the
582 SILC_PACKET_SUCCESS packet.  Both entities send this packet to 
583 each other.  After this both parties will start using the new keys.
584
585
586
587 .ti 0
588 2.3 Processing the Key Material
589
590 Key Exchange protocol produces secret shared key material KEY.  This
591 key material is used to derive the actual keys used in the encryption
592 of the communication channel.  The key material is also used to derive
593 other security parameters used in the communication.  Key Exchange
594 protocol produces a hash value HASH as well.  This is used in the key
595 deriving process as a session identifier.
596
597 Keys are derived from the key material as follows:
598
599 .in 6
600 Sending Initial Vector (IV)     = hash(0 | KEY | HASH)
601 Receiving Initial Vector (IV)   = hash(1 | KEY | HASH)
602 Sending Encryption Key          = hash(2 | KEY | HASH)
603 Receiving Encryption Key        = hash(3 | KEY | HASH)
604 HMAC Key                        = hash(4 | KEY | HASH)
605 .in 3
606
607
608 The Initial Vector (IV) is used in the encryption when doing for
609 example CBC mode.  As many bytes as needed are taken from the start of
610 the hash output for IV.  Sending IV is for sending key and receiving IV
611 is for receiving key.  For receiving party, the receiving IV is actually
612 sender's sending IV, and, the sending IV is actually sender's receiving
613 IV.  Initiator uses IV's as they are (sending IV for sending and
614 receiving IV for receiving).
615
616 The Encryption Keys are derived as well from the hash().  If the hash()
617 output is too short for the encryption algorithm more key material is
618 produced in following manner:
619
620 .in 6
621 K1 = hash(2 | KEY | HASH)
622 K2 = hash(KEY | K1)
623 K3 = hash(KEY | K1 | K2)  ...
624
625 Sending Encryption Key = K1 | K2 | K3 ...
626
627
628 K1 = hash(3 | KEY | HASH)
629 K2 = hash(KEY | K1)
630 K3 = hash(KEY | K1 | K2)  ...
631
632 Receiving Encryption Key = K1 | K2 | K3 ...
633 .in 3
634
635
636 The key is distributed by hashing the previous hash with the original
637 key material.  The final key is a concatenation of the hash values.
638 For Receiving Encryption Key the procedure is equivalent.  Sending key
639 is used only for encrypting data to be sent.  The receiving key is used
640 only to decrypt received data.  For receiving party, the receive key is
641 actually sender's sending key, and, the sending key is actually sender's
642 receiving key.  Initiator uses generated keys as they are (sending key
643 for sending and receiving key for sending).
644
645 The HMAC key is used to create MAC values to packets in the communication
646 channel.  As many bytes as needed are taken from the start of the hash
647 output.
648
649 These procedures are performed by all parties of the key exchange
650 protocol.  This must be done before the protocol has been ended by
651 sending the SILC_PACKET_SUCCESS packet.
652
653
654 .ti 0
655 2.4 SILC Key Exchange Groups
656
657 Following groups may be used in the SILC Key Exchange protocol.  The 
658 first group diffie-hellman-group1 is mandatory, other groups maybe 
659 negotiated to be used in the connection with Key Exchange Start Payload
660 and SILC_PACKET_KEY_EXCHANGE packet.  However, the first group must be
661 proposed in the Key Exchange Start Payload regardless of any other
662 requested group (however, it doesn't have to be the first on the list).
663
664
665 .ti 0
666 2.4.1 diffie-hellman-group1
667
668 The length of this group is 1024 bits.  This is mandatory group.
669 The prime is 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }.
670
671 Its decimal value is
672
673 .in 6
674 179769313486231590770839156793787453197860296048756011706444
675 423684197180216158519368947833795864925541502180565485980503
676 646440548199239100050792877003355816639229553136239076508735
677 759914822574862575007425302077447712589550957937778424442426
678 617334727629299387668709205606050270810842907692932019128194
679 467627007
680 .in 3
681
682 Its hexadecimal value is
683
684 .in 6
685 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
686 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
687 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
688 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED
689 EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381
690 FFFFFFFF FFFFFFFF
691 .in 3
692
693
694 The generator used with this prime is g = 2. The group order q is
695 (p - 1) / 2.
696
697 This group was taken from the OAKLEY specification.
698
699
700 .ti 0
701 2.4.2 diffie-hellman-group2
702
703 The length of this group is 1536 bits.  This is optional group.
704 The prime is 2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 }.
705
706 Its decimal value is
707
708 .in 6
709 241031242692103258855207602219756607485695054850245994265411
710 694195810883168261222889009385826134161467322714147790401219
711 650364895705058263194273070680500922306273474534107340669624
712 601458936165977404102716924945320037872943417032584377865919
713 814376319377685986952408894019557734611984354530154704374720
714 774996976375008430892633929555996888245787241299381012913029
715 459299994792636526405928464720973038494721168143446471443848
716 8520940127459844288859336526896320919633919
717 .in 3
718
719 Its hexadecimal value is
720
721 .in 6
722 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
723 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
724 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
725 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED
726 EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE45B3D
727 C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8 FD24CF5F
728 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D
729 670C354E 4ABC9804 F1746C08 CA237327 FFFFFFFF FFFFFFFF
730 .in 3
731
732 The generator used with this prime is g = 2. The group order q is
733 (p - 1) / 2.
734
735 This group was taken from the OAKLEY specification.
736
737
738 .ti 0
739 2.5 Key Exchange Status Types
740
741 This section defines all key exchange protocol status types that may be
742 returned in the SILC_PACKET_SUCCESS or SILC_PACKET_FAILURE packets to
743 indicate the status of the protocol.  Implementations may map the
744 status types to human readable error message.  All types except the
745 SILC_SKE_STATUS_OK type must be sent in SILC_PACKET_FAILURE packet.
746 Following status types are defined:
747
748 .in 6
749 0   SILC_SKE_STATUS_OK
750
751     Protocol were exeucted succesfully.
752
753
754 1   SILC_SKE_STATUS_ERROR
755
756     Unknown error occured.  No specific error type is defined.
757
758
759 2   SILC_SKE_STATUS_BAD_PAYLOAD
760
761     Provided KE payload were malformed or included bad fields.
762
763
764 3   SILC_SKE_STATUS_UNSUPPORTED_GROUP
765
766     None of the provided groups were supported.
767
768
769 4   SILC_SKE_STATUS_UNSUPPORTED_CIPHER
770
771     None of the provided ciphers were supported.
772
773
774 5   SILC_SKE_STATUS_UNSUPPORTED_PKCS
775
776     None of the provided public key algorithms were supported.
777
778
779 6   SILC_SKE_STATUS_UNSUPPORTED_HASH_FUNCTION
780
781     None of the provided hash functions were supported.
782
783
784 7   SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY
785
786     Provided public key type is not supported.
787
788
789 8   SILC_SKE_STATUS_INCORRECT_SIGNATURE
790
791     Provided signature was incorrect.
792 .in 3
793
794
795
796
797
798 .ti 0
799 3 SILC Connection Authentication Protocol
800
801 Purpose of Connection Authentication protocol is to authenticate the
802 connecting party with server.  Usually connecting party is client but
803 server may connect to server as well.  Its other purpose is to provide
804 information for the server about which type of connection this is.
805 The type defines whether this is client, server or router connection.
806 Server uses this information to create the ID for the connection.  After
807 the authentication protocol has been successfully completed 
808 SILC_PACKET_NEW_ID must be sent to the connecting party by the server.
809 See section New ID Payload in [SILC2] for detailed description for this
810 packet's payload.
811
812 Server must verify the authentication data received and if it is to fail
813 the authentication must be failed by sending SILC_PACKET_FAILURE packet.
814 If everything checks out fine the protocol is ended by server by sending
815 SILC_PACKET_SUCCESS packet.
816
817 The protocol is executed after the SILC Key Exchange protocol.  It must
818 not be executed in any other time.  As it is performed after key exchange
819 protocol all traffic in the connection authentication protocol is
820 encrypted with the exchanged keys.
821
822 The protocol is started by the connecting party by sending
823 SILC_PACKET_CONNECTION_AUTH packet with Connection Auth Payload,
824 described in the next section.  This payload must include the
825 authentication data.  Authentication data is set according
826 authentication method that must be known by both parties. If connecting
827 party does not know what is the mandatory authentication method it must
828 request it from the server by sending SILC_PACKET_CONNECTION_AUTH_REQUEST
829 packet.  This packet is not part of this protocol and is described in
830 section Connection Auth Request Payload in [SILC2].  However, if
831 connecting party already knows the mandatory authentication method
832 sending the request is not necessary.
833
834 See [SILC1] and section Connection Auth Request Payload in [SILC2] also
835 for the list of different authentication methods.  Authentication method
836 may also be NONE, in which case the server does not require
837 authentication at all.  However, in this case the protocol still must be
838 executed; the authentication data just is empty indicating no
839 authentication is required.
840
841 If authentication method is passphrase the authentication data is
842 plaintext passphrase.  As the payload is entirely encrypted it is safe
843 to have plaintext passphrase.  3.2.1 Passphrase Authentication for
844 more information.
845
846
847 If authentication method is public key authentication the authentication
848 data is signature of the hash value HASH plus Key Exchange Start Payload,
849 established by the SILC Key Exchange protocol.  This signature must then
850 be verified by the server.  See section 3.2.2 Public Key Authentication
851 for more information.
852
853 The connecting party of this protocol must wait after successful execution
854 of this protocol for the SILC_PACKET_NEW_ID packet where it will receive
855 the ID it will be using in the SILC network.  Connecting party cannot
856 start normal SILC session (sending messages or commands) until it has
857 received its ID.  The ID's are always created by the server except
858 for server to server connection where servers create their own ID's.
859
860
861
862 .ti 0
863 3.1 Connection Auth Payload
864
865 Client sends this payload to authenticate itself to the server.  Server
866 connecting to another server also sends this payload.  Server receiving
867 this payload must verify all the data in it and if something is to fail
868 the authentication must be failed by sending SILC_PACKET_FAILURE packet.
869
870 The payload may only be sent with SILC_PACKET_CONNECTION_AUTH packet.
871 It must not be sent in any other packet type.  Following diagram 
872 represent the Connection Auth Payload.
873
874
875 .in 5
876 .nf
877                      1                   2                   3
878  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
879 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
880 |        Payload Length         |        Connection Type        |
881 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
882 |                                                               |
883 ~                     Authentication Data                       ~
884 |                                                               |
885 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
886 .in 3
887  
888 .ce
889 Figure 4:  Connection Auth Payload
890
891
892 .in 6
893 o Payload Length (2 bytes) - Length of the entire Connection 
894   Auth Payload.
895
896 o Connection Type (2 bytes) - Indicates the type of the 
897   connection.  See section Connection Auth Request Payload
898   in [SILC2] for the list of connection types.  This field must 
899   include valid connection type or the packet must be discarded 
900   and authentication must be failed. 
901
902 o Authentication Data (variable length) - The actual 
903   authentication data.  Contents of this depends on the 
904   authentication method known by both parties.  If no
905   authentication is required this field does not exist.
906 .in 3
907
908
909 .ti 0
910 3.2 Connection Authentication Types
911
912 SILC supports two authentication types to be used in the connection
913 authentication protocol; passphrase or public key based authentication.
914 Following sections defines the authentication methods.  See [SILC2]
915 for defined numerical authentication method types.
916
917
918 .ti 0
919 3.2.1 Passphrase Authentication
920
921 Passphrase authentication or pre-shared-key base authentication is 
922 simply an authentication where the party that wants to authenticate 
923 itself to the other end sends the passphrase that is required by
924 the other end, for example server.
925
926 If the passphrase matches with the one in the server's end the
927 authentication is successful.  Otherwise SILC_PACKET_FAILURE must be
928 sent to the sender and the protocol execution fails.
929
930 This is required authentication method to be supported by all SILC
931 implementations.
932
933
934 .ti 0
935 3.2.2 Public Key Authentication
936
937 Public key authentication may be used if passphrase based authentication
938 is not desired.  The public key authentication works by sending a
939 signature as authentication data to the other end, say, server.  The
940 server must then verify the signature by the public key of the sender,
941 which the server has received earlier in SKE protocol.
942
943 The signature is computed using the private key of the sender by signing
944 the HASH value provided by the SKE protocol previously, and the Key
945 Exchange Start Payload from SKE protocol that was sent to the server.
946 The server must verify the data, thus it must keep the HASH and the
947 Key Exchange Start Payload saved during SKE and authentication protocols.
948
949 If the verified signature matches the sent signature, the authentication
950 were successful and SILC_PACKET_SUCCESS is sent.  If it failed the protocol
951 execution is stopped and SILC_PACKET_FAILURE is sent.
952
953 This is required authentication method to be supported by all SILC
954 implementations.
955
956
957 .ti 0
958 3.3 Connection Authentication Status Types
959
960 This section defines all connection authentication status types that
961 may be returned in the SILC_PACKET_SUCCESS or SILC_PACKET_FAILURE packets
962 to indicate the status of the protocol.  Implementations may map the
963 status types to human readable error message.  All types except the
964 SILC_AUTH_STATUS_OK type must be sent in SILC_PACKET_FAILURE packet.
965 Following status types are defined:
966
967 0   SILC_AUTH_OK
968
969     Protocol was executed succesfully.
970
971
972 1   SILC_AUTH_FAILED
973
974     Authentication failed.
975
976
977 .ti 0
978 4 Security Considerations
979
980 Security is central to the design of this protocol, and these security
981 considerations permeate the specification.
982
983
984 .ti 0
985 5 References
986
987 [SILC1]      Riikonen, P., "Secure Internet Live Conferencing (SILC),
988              Protocol Specification", Internet Draft, June 2000.
989
990 [SILC2]      Riikonen, P., "SILC Packet Protocol", Internet Draft,
991              June 2000.
992
993 [IRC]        Oikarinen, J., and Reed D., "Internet Relay Chat Protocol",
994              RFC 1459, May 1993.
995
996 [SSH-TRANS]  Ylonen, T., et al, "SSH Transport Layer Protocol", 
997              Internet Draft.
998
999 [PGP]        Callas, J., et al, "OpenPGP Message Format", RFC 2440,
1000              November 1998.
1001
1002 [SPKI]       Ellison C., et al, "SPKI Certificate Theory", RFC 2693,
1003              September 1999.
1004
1005 [PKIX-Part1] Housley, R., et al, "Internet X.509 Public Key 
1006              Infrastructure, Certificate and CRL Profile", RFC 2459,
1007              January 1999.
1008
1009 [Schneier]   Schneier, B., "Applied Cryptography Second Edition",
1010              John Wiley & Sons, New York, NY, 1996.
1011
1012 [Menezes]    Menezes, A., et al, "Handbook of Applied Cryptography",
1013              CRC Press 1997.
1014
1015 [OAKLEY]     Orman, H., "The OAKLEY Key Determination Protocol",
1016              RFC 2412, November 1998.
1017
1018 [ISAKMP]     Maughan D., et al, "Internet Security Association and
1019              Key Management Protocol (ISAKMP)", RFC 2408, November
1020              1998.
1021
1022 [IKE]        Harkins D., and Carrel D., "The Internet Key Exhange
1023              (IKE)", RFC 2409, November 1998.
1024
1025 [HMAC]       Krawczyk, H., "HMAC: Keyed-Hashing for Message
1026              Authentication", RFC 2104, February 1997.
1027
1028
1029 .ti 0
1030 6 Author's Address
1031
1032 .nf
1033 Pekka Riikonen
1034 Kasarmikatu 11 A4
1035 70110 Kuopio
1036 Finland
1037
1038 EMail: priikone@poseidon.pspt.fi