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