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