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