idnits 2.17.1 draft-jaganathan-rc4-hmac-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 16. -- Found old boilerplate from RFC 3978, Section 5.5 on line 767. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 778. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 785. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 791. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == The page length should not exceed 58 lines per page, but there was 1 longer page, the longest (page 17) being 69 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (July 30, 2006) is 6451 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Informational ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '14' on line 221 -- Looks like a reference, but probably isn't: '16' on line 266 -- Looks like a reference, but probably isn't: '8' on line 518 -- Looks like a reference, but probably isn't: '0' on line 537 -- Looks like a reference, but probably isn't: '2' on line 539 -- Looks like a reference, but probably isn't: '4' on line 535 -- Looks like a reference, but probably isn't: '1' on line 538 -- Looks like a reference, but probably isn't: '3' on line 540 == Unused Reference: 'RFC2119' is defined on line 684, but no explicit reference was found in the text == Unused Reference: 'MANTIN01' is defined on line 708, but no explicit reference was found in the text ** Obsolete normative reference: RFC 1320 (Obsoleted by RFC 6150) Summary: 4 errors (**), 0 flaws (~~), 5 warnings (==), 16 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force K. Jaganathan 3 Internet-Draft L. Zhu 4 Intended status: Informational J. Brezak 5 Expires: January 31, 2007 Microsoft Corporation 6 July 30, 2006 8 The RC4-HMAC Kerberos Encryption Types Used by Microsoft Windows 9 draft-jaganathan-rc4-hmac-03.txt 11 Status of this Memo 13 By submitting this Internet-Draft, each author represents that any 14 applicable patent or other IPR claims of which he or she is aware 15 have been or will be disclosed, and any of which he or she becomes 16 aware will be disclosed, in accordance with Section 6 of BCP 79. 18 Internet-Drafts are working documents of the Internet Engineering 19 Task Force (IETF), its areas, and its working groups. Note that 20 other groups may also distribute working documents as Internet- 21 Drafts. 23 Internet-Drafts are draft documents valid for a maximum of six months 24 and may be updated, replaced, or obsoleted by other documents at any 25 time. It is inappropriate to use Internet-Drafts as reference 26 material or to cite them other than as "work in progress." 28 The list of current Internet-Drafts can be accessed at 29 http://www.ietf.org/ietf/1id-abstracts.txt. 31 The list of Internet-Draft Shadow Directories can be accessed at 32 http://www.ietf.org/shadow.html. 34 This Internet-Draft will expire on January 31, 2007. 36 Copyright Notice 38 Copyright (C) The Internet Society (2006). 40 Abstract 42 The Microsoft Windows 2000 implementation of Kerberos introduces a 43 new encryption type based on the RC4 encryption algorithm and using 44 an MD5 HMAC for checksum. This is offered as an alternative to using 45 the existing DES based encryption types. 47 The RC4-HMAC encryption types are used to ease upgrade of existing 48 Windows NT environments, provide strong crypto (128-bit key lengths), 49 and provide exportable (meet United States government export 50 restriction requirements) encryption. This document describes the 51 implementation of those encryption types. 53 Table of Contents 55 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 56 2. Key Generation . . . . . . . . . . . . . . . . . . . . . . . . 3 57 3. Basic Operations . . . . . . . . . . . . . . . . . . . . . . . 4 58 4. Checksum Types . . . . . . . . . . . . . . . . . . . . . . . . 6 59 5. Encryption Types . . . . . . . . . . . . . . . . . . . . . . . 6 60 6. Key Strength Negotiation . . . . . . . . . . . . . . . . . . . 8 61 7. GSSAPI Kerberos V5 Mechanism Type . . . . . . . . . . . . . . 8 62 7.1. Mechanism Specific Changes . . . . . . . . . . . . . . . . 8 63 7.2. GSSAPI MIC Semantics . . . . . . . . . . . . . . . . . . . 10 64 7.3. GSSAPI WRAP Semantics . . . . . . . . . . . . . . . . . . 12 65 8. Security Considerations . . . . . . . . . . . . . . . . . . . 15 66 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 15 67 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 68 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 16 69 11.1. Normative References . . . . . . . . . . . . . . . . . . . 16 70 11.2. Informative References . . . . . . . . . . . . . . . . . . 16 71 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 16 72 Intellectual Property and Copyright Statements . . . . . . . . . . 18 74 1. Introduction 76 The Microsoft Windows 2000 implementation of Kerberos contains new 77 encryption and checksum types for two reasons: for export reasons 78 early in the development process, 56 bit DES encryption could not be 79 exported, and because upon upgrade from Windows NT 4.0 to Windows 80 2000, accounts will not have the appropriate DES keying material to 81 do the standard DES encryption. Furthermore, 3DES is not available 82 for export, and there was a desire to use a single flavor of 83 encryption in the product for both US and international products. 85 As a result, there are two new encryption types and one new checksum 86 type introduced in Microsoft Windows 2000. 88 Note that these cryptosystems aren't intended to be complete, 89 general-purpose Kerberos encryption or checksum systems as defined in 90 [RFC3961]: there is no one-one mapping between the operations in this 91 documents and the primitives described in [RFC3961]. 93 2. Key Generation 95 On upgrade from existing Windows NT domains, the user accounts would 96 not have a DES based key available to enable the use of DES base 97 encryption types specified in [RFC4120] [RFC3961]. The key used for 98 RC4-HMAC is the same as the existing Windows NT key (NT Password 99 Hash) for compatibility reasons. Once the account password is 100 changed, the DES based keys are created and maintained. Once the DES 101 keys are available DES based encryption types can be used with 102 Kerberos. 104 The RC4-HMAC String to key function is defined as follow: 106 String2Key(password) 108 K = MD4(UNICODE(password)) 110 The RC4-HMAC keys are generated by using the Windows UNICODE version 111 of the password. Each Windows UNICODE character is encoded in 112 little-endian format of 2 octets each. Then performing an MD4 113 [RFC1320] hash operation on just the UNICODE characters of the 114 password (not including the terminating zero octets). 116 For an account with a password of "foo", this String2Key("foo") will 117 return: 119 0xac, 0x8e, 0x65, 0x7f, 0x83, 0xdf, 0x82, 0xbe, 120 0xea, 0x5d, 0x43, 0xbd, 0xaf, 0x78, 0x00, 0xcc 122 3. Basic Operations 124 The MD5 HMAC function is defined in [RFC2104]. It is used in this 125 encryption type for checksum operations. Refer to [RFC2104] for 126 details on its operation. In this document this function is referred 127 to as HMAC(Key, Data) returning the checksum using the specified key 128 on the data. 130 The basic MD5 hash operation is used in this encryption type and 131 defined in [RFC1321]. In this document this function is referred to 132 as MD5(Data) returning the checksum of the data. 134 RC4 is a stream cipher licensed by RSA Data Security . In this 135 document the function is referred to as RC4(Key, Data) returning the 136 encrypted data using the specified key on the data. 138 These encryption types use key derivation. With each message, the 139 message type (T) is used as a component of the keying material. This 140 table summarizes the different key derivation values used in the 141 various operations. Note that these differ from the key derivations 142 used in other Kerberos encryption types. T = the message type, 143 encoded as a little-endian four byte integer. 145 1. AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with 146 the client key (T=1) 147 2. AS-REP Ticket and TGS-REP Ticket (includes TGS session key 148 or application session key), encrypted with the service key 149 (T=2) 150 3. AS-REP encrypted part (includes TGS session key or 151 application session key), encrypted with the client key (T=8) 152 4. TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the 153 TGS session key (T=4) 154 5. TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the 155 TGS authenticator subkey (T=5) 156 6. TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, 157 keyed with the TGS session key (T=6) 158 7. TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes 159 TGS authenticator subkey), encrypted with the TGS session key 160 T=7) 161 8. TGS-REP encrypted part (includes application session key), 162 encrypted with the TGS session key (T=8) 163 9. TGS-REP encrypted part (includes application session key), 164 encrypted with the TGS authenticator subkey (T=8) 165 10. AP-REQ Authenticator cksum, keyed with the application 166 session key (T=10) 167 11. AP-REQ Authenticator (includes application authenticator 168 subkey), encrypted with the application session key (T=11) 169 12. AP-REP encrypted part (includes application session 170 subkey), encrypted with the application session key (T=12) 171 13. KRB-PRIV encrypted part, encrypted with a key chosen by 172 the application. Also for data encrypted with GSS Wrap (T=13) 173 14. KRB-CRED encrypted part, encrypted with a key chosen by 174 the application (T=14) 175 15. KRB-SAFE cksum, keyed with a key chosen by the 176 application. Also for data signed in GSS MIC (T=15) 178 Relative to RFC-1964 key uses: 180 T = 0 in the generation of sequence number for the MIC token 181 T = 0 in the generation of sequence number for the WRAP token 182 T = 0 in the generation of encrypted data for the WRAPPED token 184 All strings in this document are ASCII unless otherwise specified. 185 The lengths of ASCII encoded character strings include the trailing 186 terminator character (0). The concat(a,b,c,...) function will return 187 the logical concatenation (left to right) of the values of the 188 arguments. The nonce(n) function returns a pseudo-random number of 189 "n" octets. 191 4. Checksum Types 193 There is one checksum type used in this encryption type. The 194 Kerberos constant for this type is: 196 #define KERB_CHECKSUM_HMAC_MD5 (-138) 198 The function is defined as follows: 200 K - is the Key 201 T - the message type, encoded as a little-endian four byte integer 203 CHKSUM(K, T, data) 205 Ksign = HMAC(K, "signaturekey") //includes zero octet at end 206 tmp = MD5(concat(T, data)) 207 CHKSUM = HMAC(Ksign, tmp) 209 5. Encryption Types 211 There are two encryption types used in these encryption types. The 212 Kerberos constants for these types are: 214 #define KERB_ETYPE_RC4_HMAC 23 215 #define KERB_ETYPE_RC4_HMAC_EXP 24 217 The basic encryption function is defined as follow: 219 T = the message type, encoded as a little-endian four byte integer. 221 OCTET L40[14] = "fortybits"; 223 The header field on the encrypted data in KDC messages is: 225 typedef struct _RC4_MDx_HEADER { 226 OCTET Checksum[16]; 227 OCTET Confounder[8]; 228 } RC4_MDx_HEADER, *PRC4_MDx_HEADER; 230 ENCRYPT (K, export, T, data) 231 { 232 struct EDATA { 233 struct HEADER { 234 OCTET Checksum[16]; 235 OCTET Confounder[8]; 236 } Header; 237 OCTET Data[0]; 238 } edata; 240 if (export){ 241 *((DWORD *)(L40+10)) = T; 242 HMAC (K, L40, 10 + 4, K1); 243 } 244 else 245 { 246 HMAC (K, &T, 4, K1); 247 } 248 memcpy (K2, K1, 16); 249 if (export) memset (K1+7, 0xAB, 9); 251 nonce (edata.Confounder, 8); 252 memcpy (edata.Data, data); 254 edata.Checksum = HMAC (K2, edata); 255 K3 = HMAC (K1, edata.Checksum); 257 RC4 (K3, edata.Confounder); 258 RC4 (K3, data.Data); 259 } 261 DECRYPT (K, export, T, edata) 262 { 263 // edata looks like 264 struct EDATA { 265 struct HEADER { 266 OCTET Checksum[16]; 267 OCTET Confounder[8]; 268 } Header; 269 OCTET Data[0]; 270 } edata; 272 if (export){ 273 *((DWORD *)(L40+10)) = T; 274 HMAC (K, L40, 14, K1); 275 } 276 else 277 { 278 HMAC (K, &T, 4, K1); 279 } 280 memcpy (K2, K1, 16); 281 if (export) memset (K1+7, 0xAB, 9); 283 K3 = HMAC (K1, edata.Checksum); 284 RC4 (K3, edata.Confounder); 285 RC4 (K3, edata.Data); 287 // verify generated and received checksums 288 checksum = HMAC (K2, concat(edata.Confounder, edata.Data)); 289 if (checksum != edata.Checksum) 290 printf("CHECKSUM ERROR !!!!!!\n"); 291 } 293 The KDC message is encrypted using the ENCRYPT function not including 294 the Checksum in the RC4_MDx_HEADER. 296 The character constant "fortybits" evolved from the time when a 40- 297 bit key length was all that was exportable from the United States. 298 It is now used to recognize that the key length is of "exportable" 299 length. In this description, the key size is actually 56-bits. 301 The pseudo-random operation [RFC3961] for both enctypes above is 302 defined as follows: 304 pseudo-random(K, S) = HMAC-SHA1(K, S) 306 where K is the protocol key and S is the input octet string. HMAC- 307 SHA1 is defined in [RFC2104] and the output of HMAC-SHA1 is the 20- 308 octet digest. 310 6. Key Strength Negotiation 312 A Kerberos client and server can negotiate over key length if they 313 are using mutual authentication. If the client is unable to perform 314 full strength encryption, it may propose a key in the "subkey" field 315 of the authenticator, using a weaker encryption type. The server 316 must then either return the same key or suggest its own key in the 317 subkey field of the AP reply message. The key used to encrypt data 318 is derived from the key returned by the server. If the client is 319 able to perform strong encryption but the server is not, it may 320 propose a subkey in the AP reply without first being sent a subkey in 321 the authenticator. 323 7. GSSAPI Kerberos V5 Mechanism Type 325 7.1. Mechanism Specific Changes 327 The GSSAPI per-message tokens also require new checksum and 328 encryption types. The GSS-API per-message tokens are adapted to 329 support these new encryption types. See [RFC1964] Section 1.2.2. 331 The only support quality of protection is: 333 #define GSS_KRB5_INTEG_C_QOP_DEFAULT 0x0 335 When using this RC4 based encryption type, the sequence number is 336 always sent in big-endian rather than little-endian order. 338 The Windows 2000 implementation also defines new GSSAPI flags in the 339 initial token passed when initializing a security context. These 340 flags are passed in the checksum field of the authenticator. See 341 [RFC1964] Section 1.1.1. 343 GSS_C_DCE_STYLE - This flag was added for use with Microsoft's 344 implementation of DCE RPC, which initially expected three legs of 345 authentication. Setting this flag causes an extra AP reply to be 346 sent from the client back to the server after receiving the server's 347 AP reply. In addition, the context negotiation tokens do not have 348 GSSAPI per message tokens - they are raw AP messages that do not 349 include object identifiers. 351 #define GSS_C_DCE_STYLE 0x1000 353 GSS_C_IDENTIFY_FLAG - This flag allows the client to indicate to the 354 server that it should only allow the server application to identify 355 the client by name and ID, but not to impersonate the client. 357 #define GSS_C_IDENTIFY_FLAG 0x2000 359 GSS_C_EXTENDED_ERROR_FLAG - Setting this flag indicates that the 360 client wants to be informed of extended error information. In 361 particular, Windows 2000 status codes may be returned in the data 362 field of a Kerberos error message. This allows the client to 363 understand a server failure more precisely. In addition, the server 364 may return errors to the client that are normally handled at the 365 application layer in the server, in order to let the client try to 366 recover. After receiving an error message, the client may attempt to 367 resubmit an AP request. 369 #define GSS_C_EXTENDED_ERROR_FLAG 0x4000 371 These flags are only used if a client is aware of these conventions 372 when using the SSPI on the Windows platform; they are not generally 373 used by default. 375 When NetBIOS addresses are used in the GSSAPI, they are identified by 376 the GSS_C_AF_NETBIOS value. This value is defined as: 378 #define GSS_C_AF_NETBIOS 0x14 380 NetBios addresses are 16-octet addresses typically composed of 1 to 381 15 characters, trailing blank (ASCII char 20) filled, with a 16-th 382 octet of 0x0. 384 7.2. GSSAPI MIC Semantics 386 The GSSAPI checksum type and algorithm is defined in Section 5. Only 387 the first 8 octets of the checksum are used. The resulting checksum 388 is stored in the SGN_CKSUM field . See [RFC1964] Section 1.2 for 389 GSS_GetMIC() and GSS_Wrap(conf_flag=FALSE). 391 The GSS_GetMIC token has the following format: 393 Byte no Name Description 394 0..1 TOK_ID Identification field. 395 Tokens emitted by GSS_GetMIC() contain 396 the hex value 01 01 in this field. 397 2..3 SGN_ALG Integrity algorithm indicator. 398 11 00 - HMAC 399 4..7 Filler Contains ff ff ff ff 400 8..15 SND_SEQ Sequence number field. 401 16..23 SGN_CKSUM Checksum of "to-be-signed data", 402 calculated according to algorithm 403 specified in SGN_ALG field. 405 The MIC mechanism used for GSS MIC based messages is as follow: 407 GetMIC(Kss, direction, export, seq_num, data) 408 { 409 struct Token { 410 struct Header { 411 OCTET TOK_ID[2]; 412 OCTET SGN_ALG[2]; 413 OCTET Filler[4]; 414 }; 415 OCTET SND_SEQ[8]; 416 OCTET SGN_CKSUM[8]; 417 } Token; 419 Token.TOK_ID = 01 01; 420 Token.SGN_SLG = 11 00; 421 Token.Filler = ff ff ff ff; 423 // Create the sequence number 424 if (direction == sender_is_initiator) 425 { 426 memset(Token.SEND_SEQ+4, 0xff, 4) 427 } 428 else if (direction == sender_is_acceptor) 429 { 430 memset(Token.SEND_SEQ+4, 0, 4) 431 } 432 Token.SEND_SEQ[0] = (seq_num & 0xff000000) >> 24; 433 Token.SEND_SEQ[1] = (seq_num & 0x00ff0000) >> 16; 434 Token.SEND_SEQ[2] = (seq_num & 0x0000ff00) >> 8; 435 Token.SEND_SEQ[3] = (seq_num & 0x000000ff); 437 // Derive signing key from session key 439 Ksign = HMAC(Kss, "signaturekey"); 440 // length includes terminating null 442 // Generate checksum of message - SGN_CKSUM 443 // Key derivation salt = 15 445 Sgn_Cksum = MD5((int32)15, Token.Header, data); 447 // Save first 8 octets of HMAC Sgn_Cksum 449 Sgn_Cksum = HMAC(Ksign, Sgn_Cksum); 450 memcpy(Token.SGN_CKSUM, Sgn_Cksum, 8); 452 // Encrypt the sequence number 454 // Derive encryption key for the sequence number 455 // Key derivation salt = 0 457 if (exportable) 458 { 459 Kseq = HMAC(Kss, "fortybits", (int32)0); 460 // len includes terminating null 461 memset(Kseq+7, 0xab, 7) 462 } 463 else 464 { 465 Kseq = HMAC(Kss, (int32)0); 466 } 467 Kseq = HMAC(Kseq, Token.SGN_CKSUM); 469 // Encrypt the sequence number 471 RC4(Kseq, Token.SND_SEQ); 473 } 475 7.3. GSSAPI WRAP Semantics 477 There are two encryption keys for GSSAPI message tokens, one that is 478 128 bits in strength, and one that is 56 bits in strength as defined 479 in Section 6. 481 All padding is rounded up to 1 byte. One byte is needed to say that 482 there is 1 byte of padding. The DES based mechanism type uses 8 byte 483 padding. See [RFC1964] Section 1.2.2.3. 485 The RC4-HMAC GSS_Wrap() token has the following format: 487 Byte no Name Description 488 0..1 TOK_ID Identification field. 489 Tokens emitted by GSS_Wrap() contain 490 the hex value 02 01 in this field. 491 2..3 SGN_ALG Checksum algorithm indicator. 492 11 00 - HMAC 493 4..5 SEAL_ALG ff ff - none 494 00 00 - DES-CBC 495 10 00 - RC4 496 6..7 Filler Contains ff ff 497 8..15 SND_SEQ Encrypted sequence number field. 498 16..23 SGN_CKSUM Checksum of plaintext padded data, 499 calculated according to algorithm 500 specified in SGN_ALG field. 501 24..31 Confounder Random confounder 502 32..last Data encrypted or plaintext padded data 504 The encryption mechanism used for GSS wrap based messages is as 505 follow: 507 WRAP(Kss, encrypt, direction, export, seq_num, data) 508 { 509 struct Token { // 32 octets 510 struct Header { 511 OCTET TOK_ID[2]; 512 OCTET SGN_ALG[2]; 513 OCTET SEAL_ALG[2]; 514 OCTET Filler[2]; 515 }; 516 OCTET SND_SEQ[8]; 517 OCTET SGN_CKSUM[8]; 518 OCTET Confounder[8]; 520 } Token; 522 Token.TOK_ID = 02 01; 523 Token.SGN_SLG = 11 00; 524 Token.SEAL_ALG = (no_encrypt)? ff ff : 10 00; 525 Token.Filler = ff ff; 527 // Create the sequence number 529 if (direction == sender_is_initiator) 530 { 531 memset(&Token.SEND_SEQ[4], 0xff, 4) 532 } 533 else if (direction == sender_is_acceptor) 534 { 535 memset(&Token.SEND_SEQ[4], 0, 4) 536 } 537 Token.SEND_SEQ[0] = (seq_num & 0xff000000) >> 24; 538 Token.SEND_SEQ[1] = (seq_num & 0x00ff0000) >> 16; 539 Token.SEND_SEQ[2] = (seq_num & 0x0000ff00) >> 8; 540 Token.SEND_SEQ[3] = (seq_num & 0x000000ff); 542 // Generate random confounder 544 nonce(&Token.Confounder, 8); 546 // Derive signing key from session key 548 Ksign = HMAC(Kss, "signaturekey"); 550 // Generate checksum of message - 551 // SGN_CKSUM + Token.Confounder 552 // Key derivation salt = 15 554 Sgn_Cksum = MD5((int32)15, Token.Header, 555 Token.Confounder); 557 // Derive encryption key for data 558 // Key derivation salt = 0 560 for (i = 0; i < 16; i++) Klocal[i] = Kss[i] ^ 0xF0; 561 // XOR 562 if (exportable) 563 { 564 Kcrypt = HMAC(Klocal, "fortybits", (int32)0); 565 // len includes terminating null 566 memset(Kcrypt+7, 0xab, 7); 568 } 569 else 570 { 571 Kcrypt = HMAC(Klocal, (int32)0); 572 } 574 // new encryption key salted with seq 576 Kcrypt = HMAC(Kcrypt, (int32)seq); 578 // Encrypt confounder (if encrypting) 580 if (encrypt) 581 RC4(Kcrypt, Token.Confounder); 583 // Sum the data buffer 585 Sgn_Cksum += MD5(data); // Append to checksum 587 // Encrypt the data (if encrypting) 589 if (encrypt) 590 RC4(Kcrypt, data); 592 // Save first 8 octets of HMAC Sgn_Cksum 594 Sgn_Cksum = HMAC(Ksign, Sgn_Cksum); 595 memcpy(Token.SGN_CKSUM, Sgn_Cksum, 8); 597 // Derive encryption key for the sequence number 598 // Key derivation salt = 0 600 if (exportable) 601 { 602 Kseq = HMAC(Kss, "fortybits", (int32)0); 603 // len includes terminating null 604 memset(Kseq+7, 0xab, 7) 605 } 606 else 607 { 608 Kseq = HMAC(Kss, (int32)0); 609 } 610 Kseq = HMAC(Kseq, Token.SGN_CKSUM); 612 // Encrypt the sequence number 614 RC4(Kseq, Token.SND_SEQ); 615 // Encrypted message = Token + Data 616 } 618 The character constant "fortybits" evolved from the time when a 40- 619 bit key length was all that was exportable from the United States. 620 It is now used to recognize that the key length is of "exportable" 621 length. In this description, the key size is actually 56-bits. 623 8. Security Considerations 625 Care must be taken in implementing these encryption types because 626 they use a stream cipher. If a different IV is not used in each 627 direction when using a session key, the encryption is weak. By using 628 the sequence number as an IV, this is avoided. 630 There are two classes of attack on RC4 described in [MIRONOV]. 631 Strong distinguishers distinguish an RC4 keystream from randomness at 632 the start of the stream. Weak distinguishers can operate on any part 633 of the keystream, and the best ones, described in [FMcG] and 634 [MANTIN05], can exploit data from multiple, different keystreams. A 635 consequence of these is that encrypting the same data (for instance, 636 a password) sufficiently many times in separate RC4 keystreams can be 637 sufficient to leak information to an adversary. The encryption types 638 defined in this document defend against these by constructing a new 639 key stream for every message. However, it is RECOMMENDED not to use 640 the RC4 encryption types defined in this document for high-volume 641 connections. 643 Weaknesses in MD4 [BOER91] were demonstrated by Den Boer and 644 Bosselaers in 1991. In August 2004, Xiaoyun Wang et al reported MD4 645 collisions generated using hand calculation [WANG04]. 646 Implementations based on Wang's algorithm can find collisions in real 647 time. However, the intended usage of MD4 described in this document 648 does not rely on the collision-resistant property of MD4. 649 Futhermore, MD4 is always used in the context of a keyed hash in this 650 document. Although no evidence has suggested keyed MD4 hashes are 651 vulnerable to collision-based attacks, no study has directly proved 652 that the HMAC-MD4 is secure: the existing study simply assumed that 653 the hash function used in HMAC is collision proof. It is thus 654 RECOMMENDED not to use the RC4 encryption types defined in this 655 document if alternative stronger encryption types, such as aes256- 656 cts-hmac-sha1-96 [RFC3962], are available. 658 9. Acknowledgements 660 The authors wish to thank Sam Hartman, Ken Raeburn and Qunli Li for 661 their insightful comments. 663 10. IANA Considerations 665 This document has no actions for IANA. 667 11. References 669 11.1. Normative References 671 [RFC1320] Rivest, R., "The MD4 Message-Digest Algorithm", RFC 1320, 672 April 1992. 674 [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, 675 April 1992. 677 [RFC1964] Linn, J., "The Kerberos Version 5 GSS-API Mechanism", 678 RFC 1964, June 1996. 680 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 681 Hashing for Message Authentication", RFC 2104, 682 February 1997. 684 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 685 Requirement Levels", BCP 14, RFC 2119, March 1997. 687 [RFC3961] Raeburn, K., "Encryption and Checksum Specifications for 688 Kerberos 5", RFC 3961, February 2005. 690 [RFC3962] Raeburn, K., "Advanced Encryption Standard (AES) 691 Encryption for Kerberos 5", RFC 3962, February 2005. 693 [RFC4120] Neuman, C., Yu, T., Hartman, S., and K. Raeburn, "The 694 Kerberos Network Authentication Service (V5)", RFC 4120, 695 July 2005. 697 11.2. Informative References 699 [BOER91] Boer, D. and A. Bosselaers, "An Attack on the Last Two 700 Rounds of MD4", 701 http://citeseer.ist.psu.edu/denboer91attack.html, 1991. 703 [FMcG] Fluhrer, S. and D. McGrew, "Statistical Analysis of the 704 Alleged RC4 Keystream Generator", Fast Software 705 Encryption: 7th International Workshop, FSE 2000, April 706 2000, . 708 [MANTIN01] Mantin, I., "Analysis of the Stream Cipher RC4", M.Sc. 709 Thesis, Weizmann Institute of Science, 2001, . 712 [MIRONOV] Mironov, I., "(Not So) Random Shuffles of RC4", Advances 713 in Cryptology -- CRYPTO 2002: 22nd Annual International 714 Cryptology Conference, August 2002, 715 . 717 [MANTIN05] Mantin, I., "Predicting and Distinguishing Attacks on RC4 718 Keystream Generator", Advances in Cryptology -- EUROCRYPT 719 2005: 24th Annual International Conference on the Theory 720 and Applications of Cryptographic Techniques, May 2005. 722 [WANG04] Wang, X., Lai, X., Feng, D., Chen H., and X. Yu, 723 "Cryptanalysis of Hash functions MD4 and RIPEMD", 724 http://www.infosec.sdu.edu.cn/paper/md4-ripemd-attck.pdf, 725 Augest, 2004. 727 Authors' Addresses 729 Karthik Jaganathan 730 Microsoft Corporation 731 One Microsoft Way 732 Redmond, WA 98052 733 US 735 Email: karthikj@microsoft.com 737 Larry Zhu 738 Microsoft Corporation 739 One Microsoft Way 740 Redmond, WA 98052 741 US 743 Email: lzhu@microsoft.com 745 John Brezak 746 Microsoft Corporation 747 One Microsoft Way 748 Redmond, WA 98052 749 US 751 Email: jbrezak@microsoft.com 753 Full Copyright Statement 755 Copyright (C) The Internet Society (2006). 757 This document is subject to the rights, licenses and restrictions 758 contained in BCP 78, and except as set forth therein, the authors 759 retain all their rights. 761 This document and the information contained herein are provided on an 762 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 763 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 764 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 765 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 766 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 767 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 769 Intellectual Property 771 The IETF takes no position regarding the validity or scope of any 772 Intellectual Property Rights or other rights that might be claimed to 773 pertain to the implementation or use of the technology described in 774 this document or the extent to which any license under such rights 775 might or might not be available; nor does it represent that it has 776 made any independent effort to identify any such rights. Information 777 on the procedures with respect to rights in RFC documents can be 778 found in BCP 78 and BCP 79. 780 Copies of IPR disclosures made to the IETF Secretariat and any 781 assurances of licenses to be made available, or the result of an 782 attempt made to obtain a general license or permission for the use of 783 such proprietary rights by implementers or users of this 784 specification can be obtained from the IETF on-line IPR repository at 785 http://www.ietf.org/ipr. 787 The IETF invites any interested party to bring to its attention any 788 copyrights, patents or patent applications, or other proprietary 789 rights that may cover technology that may be required to implement 790 this standard. Please address the information to the IETF at 791 ietf-ipr@ietf.org. 793 Acknowledgment 795 Funding for the RFC Editor function is provided by the IETF 796 Administrative Support Activity (IASA).