idnits 2.17.00 (12 Aug 2021) /tmp/idnits1513/draft-ietf-tls-rfc4346-bis-05.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 15. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 4284. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4295. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4302. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4308. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 116 instances of too long lines in the document, the longest one being 8 characters in excess of 72. == There are 1 instance of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == Line 737 has weird spacing: '...gorithm bul...' == Line 2230 has weird spacing: '...ixed_dh a c...' == Line 2232 has weird spacing: '...ixed_dh a c...' == Line 3916 has weird spacing: '...tegrity and...' == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a TLS connection during the first handshake on that channel, but MUST not be negotiated, as it provides no more protection than an unsecured connection. -- 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.) -- Couldn't find a document date in the document -- date freshness check skipped. -- 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: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC2119' is mentioned on line 199, but not defined -- Looks like a reference, but probably isn't: '0' on line 311 -- Looks like a reference, but probably isn't: '1' on line 311 -- Looks like a reference, but probably isn't: '3' on line 3609 -- Looks like a reference, but probably isn't: '9' on line 346 -- Looks like a reference, but probably isn't: '2' on line 2854 -- Looks like a reference, but probably isn't: '4' on line 382 -- Looks like a reference, but probably isn't: '8' on line 383 -- Looks like a reference, but probably isn't: '10' on line 481 -- Looks like a reference, but probably isn't: '20' on line 2937 -- Looks like a reference, but probably isn't: '48' on line 3142 -- Looks like a reference, but probably isn't: '32' on line 3144 == Missing Reference: 'ChangeCipherSpec' is mentioned on line 1605, but not defined -- Looks like a reference, but probably isn't: '28' on line 2849 -- Looks like a reference, but probably isn't: '46' on line 2969 == Missing Reference: 'RFC4346' is mentioned on line 2656, but not defined ** Obsolete undefined reference: RFC 4346 (Obsoleted by RFC 5246) == Missing Reference: 'Issue 26' is mentioned on line 3990, but not defined == Missing Reference: 'Issue 48' is mentioned on line 3994, but not defined == Missing Reference: 'Issue 49' is mentioned on line 3997, but not defined == Missing Reference: 'Issue 56' is mentioned on line 4000, but not defined == Unused Reference: 'REQ' is defined on line 4048, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' -- Possible downref: Non-RFC (?) normative reference: ref. '3DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DSS' ** Downref: Normative reference to an Informational RFC: RFC 2104 (ref. 'HMAC') -- Possible downref: Non-RFC (?) normative reference: ref. 'IDEA' ** Downref: Normative reference to an Informational RFC: RFC 1321 (ref. 'MD5') ** Obsolete normative reference: RFC 3447 (ref. 'PKCS1') (Obsoleted by RFC 8017) ** Obsolete normative reference: RFC 3280 (ref. 'PKIX') (Obsoleted by RFC 5280) ** Downref: Normative reference to an Informational RFC: RFC 2268 (ref. 'RC2') -- Possible downref: Non-RFC (?) normative reference: ref. 'SCH' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) == Outdated reference: draft-mcgrew-auth-enc has been published as RFC 5116 -- Obsolete informational reference (is this intentional?): RFC 4307 (ref. 'IKEALG') (Obsoleted by RFC 8247) -- Obsolete informational reference (is this intentional?): RFC 4366 (Obsoleted by RFC 5246, RFC 6066) -- Obsolete informational reference (is this intentional?): RFC 1948 (ref. 'SEQNUM') (Obsoleted by RFC 6528) -- Obsolete informational reference (is this intentional?): RFC 3268 (ref. 'TLSAES') (Obsoleted by RFC 5246) == Outdated reference: draft-ietf-tls-rfc4366-bis has been published as RFC 6066 -- Obsolete informational reference (is this intentional?): RFC 1832 (ref. 'XDR') (Obsoleted by RFC 4506) Summary: 9 errors (**), 0 flaws (~~), 17 warnings (==), 33 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 INTERNET-DRAFT Tim Dierks 3 Obsoletes (if approved): RFC 3268, 4346, 4366 Independent 4 Intended status: Proposed Standard Eric Rescorla 5 Network Resonance, Inc. 6 September 2007 (Expires March 2008) 8 The Transport Layer Security (TLS) Protocol 9 Version 1.2 11 Status of this Memo 12 By submitting this Internet-Draft, each author represents that any 13 applicable patent or other IPR claims of which he or she is aware 14 have been or will be disclosed, and any of which he or she becomes 15 aware will be disclosed, in accordance with Section 6 of BCP 79. 17 Internet-Drafts are working documents of the Internet Engineering 18 Task Force (IETF), its areas, and its working groups. Note that 19 other groups may also distribute working documents as Internet- 20 Drafts. 22 Internet-Drafts are draft documents valid for a maximum of six months 23 and may be updated, replaced, or obsoleted by other documents at any 24 time. It is inappropriate to use Internet-Drafts as reference 25 material or to cite them other than as "work in progress." 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt. 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 Copyright Notice 35 Copyright (C) The IETF Trust (2007). 37 Abstract 39 This document specifies Version 1.2 of the Transport Layer Security 40 (TLS) protocol. The TLS protocol provides communications security 41 over the Internet. The protocol allows client/server applications to 42 communicate in a way that is designed to prevent eavesdropping, 43 tampering, or message forgery. 45 Table of Contents 47 1. Introduction 3 48 1.1 Requirements Terminology 5 49 1.2 Major Differences from TLS 1.1 5 50 2. Goals 6 51 3. Goals of This Document 6 52 4. Presentation Language 7 53 4.1. Basic Block Size 7 54 4.2. Miscellaneous 7 55 4.3. Vectors 7 56 4.4. Numbers 8 57 4.5. Enumerateds 9 58 4.6. Constructed Types 10 59 4.6.1. Variants 10 60 4.7. Cryptographic Attributes 11 61 4.8. Constants 12 62 5. HMAC and the Pseudorandom Function 13 63 6. The TLS Record Protocol 14 64 6.1. Connection States 15 65 6.2. Record layer 17 66 6.2.1. Fragmentation 17 67 6.2.2. Record Compression and Decompression 19 68 6.2.3. Record Payload Protection 19 69 6.2.3.1. Null or Standard Stream Cipher 20 70 6.2.3.2. CBC Block Cipher 21 71 6.2.3.3. AEAD ciphers 22 72 6.3. Key Calculation 24 73 7. The TLS Handshaking Protocols 25 74 7.1. Change Cipher Spec Protocol 25 75 7.2. Alert Protocol 26 76 7.2.1. Closure Alerts 27 77 7.2.2. Error Alerts 28 78 7.3. Handshake Protocol Overview 31 79 7.4. Handshake Protocol 34 80 7.4.1. Hello Messages 35 81 7.4.1.1. Hello Request 35 82 7.4.1.2. Client Hello 36 83 7.4.1.3. Server Hello 39 84 7.4.1.4 Hello Extensions 41 85 7.4.1.4.1 Cert Hash Types 42 86 7.4.2. Server Certificate 42 87 7.4.3. Server Key Exchange Message 44 88 7.4.4. Certificate Request 46 89 7.4.5 Server hello done 48 90 7.4.6. Client Certificate 48 91 7.4.7. Client Key Exchange Message 49 92 7.4.7.1. RSA Encrypted Premaster Secret Message 49 93 7.4.7.2. Client Diffie-Hellman Public Value 52 94 7.4.8. Certificate verify 52 95 7.4.9. Finished 53 96 8. Cryptographic Computations 55 97 8.1. Computing the Master Secret 55 98 8.1.1. RSA 55 99 8.1.2. Diffie-Hellman 55 100 9. Mandatory Cipher Suites 56 101 10. Application Data Protocol 56 102 11. Security Considerations 56 103 12. IANA Considerations 56 104 A. Protocol Constant Values 58 105 A.1. Record Layer 58 106 A.2. Change Cipher Specs Message 59 107 A.3. Alert Messages 59 108 A.4. Handshake Protocol 61 109 A.4.1. Hello Messages 61 110 A.4.2. Server Authentication and Key Exchange Messages 62 111 A.4.3. Client Authentication and Key Exchange Messages 64 112 A.4.4. Handshake Finalization Message 64 113 A.5. The CipherSuite 64 114 A.6. The Security Parameters 67 115 B. Glossary 68 116 C. CipherSuite Definitions 72 117 D. Implementation Notes 74 118 D.1 Random Number Generation and Seeding 74 119 D.2 Certificates and Authentication 74 120 D.3 CipherSuites 74 121 D.4 Implementation Pitfalls 74 122 E. Backward Compatibility 77 123 E.1 Compatibility with TLS 1.0/1.1 and SSL 3.0 77 124 E.2 Compatibility with SSL 2.0 78 125 E.3. Avoiding Man-in-the-Middle Version Rollback 80 126 F. Security Analysis 81 127 F.1. Handshake Protocol 81 128 F.1.1. Authentication and Key Exchange 81 129 F.1.1.1. Anonymous Key Exchange 81 130 F.1.1.2. RSA Key Exchange and Authentication 82 131 F.1.1.3. Diffie-Hellman Key Exchange with Authentication 82 132 F.1.2. Version Rollback Attacks 83 133 F.1.3. Detecting Attacks Against the Handshake Protocol 84 134 F.1.4. Resuming Sessions 84 135 F.2. Protecting Application Data 85 136 F.3. Explicit IVs 85 137 F.4. Security of Composite Cipher Modes 85 138 F.5 Denial of Service 86 140 1. Introduction 142 The primary goal of the TLS Protocol is to provide privacy and data 143 integrity between two communicating applications. The protocol is 144 composed of two layers: the TLS Record Protocol and the TLS Handshake 145 Protocol. At the lowest level, layered on top of some reliable 146 transport protocol (e.g., TCP[TCP]), is the TLS Record Protocol. The 147 TLS Record Protocol provides connection security that has two basic 148 properties: 150 - The connection is private. Symmetric cryptography is used for 151 data encryption (e.g., DES [DES], RC4 [SCH] etc.). The keys for 152 this symmetric encryption are generated uniquely for each 153 connection and are based on a secret negotiated by another 154 protocol (such as the TLS Handshake Protocol). The Record 155 Protocol can also be used without encryption. 157 - The connection is reliable. Message transport includes a message 158 integrity check using a keyed MAC. Secure hash functions (e.g., 159 SHA, MD5, etc.) are used for MAC computations. The Record 160 Protocol can operate without a MAC, but is generally only used in 161 this mode while another protocol is using the Record Protocol as 162 a transport for negotiating security parameters. 164 The TLS Record Protocol is used for encapsulation of various higher- 165 level protocols. One such encapsulated protocol, the TLS Handshake 166 Protocol, allows the server and client to authenticate each other and 167 to negotiate an encryption algorithm and cryptographic keys before 168 the application protocol transmits or receives its first byte of 169 data. The TLS Handshake Protocol provides connection security that 170 has three basic properties: 172 - The peer's identity can be authenticated using asymmetric, or 173 public key, cryptography (e.g., RSA [RSA], DSS [DSS], etc.). This 174 authentication can be made optional, but is generally required 175 for at least one of the peers. 177 - The negotiation of a shared secret is secure: the negotiated 178 secret is unavailable to eavesdroppers, and for any authenticated 179 connection the secret cannot be obtained, even by an attacker who 180 can place himself in the middle of the connection. 182 - The negotiation is reliable: no attacker can modify the 183 negotiation communication without being detected by the parties 184 to the communication. 186 One advantage of TLS is that it is application protocol independent. 187 Higher-level protocols can layer on top of the TLS Protocol 188 transparently. The TLS standard, however, does not specify how 189 protocols add security with TLS; the decisions on how to initiate TLS 190 handshaking and how to interpret the authentication certificates 191 exchanged are left to the judgment of the designers and implementors 192 of protocols that run on top of TLS. 194 1.1 Requirements Terminology 196 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 197 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 198 document are to be interpreted as described in RFC 2119 [RFC2119]. 200 1.2 Major Differences from TLS 1.1 201 This document is a revision of the TLS 1.1 [TLS1.1] protocol which 202 contains improved flexibility, particularly for negotiation of 203 cryptographic algorithms. The major changes are: 205 - Merged in TLS Extensions definition and AES Cipher Suites from 206 external documents [TLSEXT] and [TLSAES]. 208 - Replacement of MD5/SHA-1 combination in the PRF. Addition 209 of cipher-suite specified PRFs. 211 - Replacement of MD5/SHA-1 combination in the digitally-signed 212 element. 214 - Allow the client to indicate which hash functions it supports 215 for digital signature. 217 - Allow the server to indicate which hash functions it supports 218 for digital signature. 220 - Addition of support for authenticated encryption with additional 221 data modes. 223 - Tightened up a number of requirements. 225 - The usual clarifications and editorial work. 227 - Added some guidance that DH groups should be checked. 229 - Cleaned up description of Bleichenbacher/Klima attack defenses. 231 - Tighter checking of EncryptedPreMasterSecret version numbers. 233 - Stronger language about when alerts MUST be sent. 235 - Added an Implementation Pitfalls sections 237 - Harmonized the requirement to send an empty certificate list 238 after certificate_request even when no certs are available. 240 - Made the verify_data length depend on the cipher suite. 242 - TLS_RSA_WITH_AES_128_CBC_SHA is now the mandatory to implement 243 cipher suite. 245 2. Goals 247 The goals of TLS Protocol, in order of their priority, are as 248 follows: 250 1. Cryptographic security: TLS should be used to establish a secure 251 connection between two parties. 253 2. Interoperability: Independent programmers should be able to 254 develop applications utilizing TLS that can successfully exchange 255 cryptographic parameters without knowledge of one another's code. 257 3. Extensibility: TLS seeks to provide a framework into which new 258 public key and bulk encryption methods can be incorporated as 259 necessary. This will also accomplish two sub-goals: preventing 260 the need to create a new protocol (and risking the introduction 261 of possible new weaknesses) and avoiding the need to implement an 262 entire new security library. 264 4. Relative efficiency: Cryptographic operations tend to be highly 265 CPU intensive, particularly public key operations. For this 266 reason, the TLS protocol has incorporated an optional session 267 caching scheme to reduce the number of connections that need to 268 be established from scratch. Additionally, care has been taken to 269 reduce network activity. 271 3. Goals of This Document 273 This document and the TLS protocol itself are based on the SSL 3.0 274 Protocol Specification as published by Netscape. The differences 275 between this protocol and SSL 3.0 are not dramatic, but they are 276 significant enough that the various versions of TLS and SSL 3.0 do 277 not interoperate (although each protocol incorporates a mechanism by 278 which an implementation can back down to prior versions). This 279 document is intended primarily for readers who will be implementing 280 the protocol and for those doing cryptographic analysis of it. The 281 specification has been written with this in mind, and it is intended 282 to reflect the needs of those two groups. For that reason, many of 283 the algorithm-dependent data structures and rules are included in the 284 body of the text (as opposed to in an appendix), providing easier 285 access to them. 287 This document is not intended to supply any details of service 288 definition or of interface definition, although it does cover select 289 areas of policy as they are required for the maintenance of solid 290 security. 292 4. Presentation Language 294 This document deals with the formatting of data in an external 295 representation. The following very basic and somewhat casually 296 defined presentation syntax will be used. The syntax draws from 297 several sources in its structure. Although it resembles the 298 programming language "C" in its syntax and XDR [XDR] in both its 299 syntax and intent, it would be risky to draw too many parallels. The 300 purpose of this presentation language is to document TLS only; it has 301 no general application beyond that particular goal. 303 4.1. Basic Block Size 305 The representation of all data items is explicitly specified. The 306 basic data block size is one byte (i.e., 8 bits). Multiple byte data 307 items are concatenations of bytes, from left to right, from top to 308 bottom. From the bytestream, a multi-byte item (a numeric in the 309 example) is formed (using C notation) by: 311 value = (byte[0] << 8*(n-1)) | (byte[1] << 8*(n-2)) | 312 ... | byte[n-1]; 314 This byte ordering for multi-byte values is the commonplace network 315 byte order or big endian format. 317 4.2. Miscellaneous 319 Comments begin with "/*" and end with "*/". 321 Optional components are denoted by enclosing them in "[[ ]]" double 322 brackets. 324 Single-byte entities containing uninterpreted data are of type 325 opaque. 327 4.3. Vectors 329 A vector (single dimensioned array) is a stream of homogeneous data 330 elements. The size of the vector may be specified at documentation 331 time or left unspecified until runtime. In either case, the length 332 declares the number of bytes, not the number of elements, in the 333 vector. The syntax for specifying a new type, T', that is a fixed- 334 length vector of type T is 336 T T'[n]; 337 Here, T' occupies n bytes in the data stream, where n is a multiple 338 of the size of T. The length of the vector is not included in the 339 encoded stream. 341 In the following example, Datum is defined to be three consecutive 342 bytes that the protocol does not interpret, while Data is three 343 consecutive Datum, consuming a total of nine bytes. 345 opaque Datum[3]; /* three uninterpreted bytes */ 346 Datum Data[9]; /* 3 consecutive 3 byte vectors */ 348 Variable-length vectors are defined by specifying a subrange of legal 349 lengths, inclusively, using the notation . When 350 these are encoded, the actual length precedes the vector's contents 351 in the byte stream. The length will be in the form of a number 352 consuming as many bytes as required to hold the vector's specified 353 maximum (ceiling) length. A variable-length vector with an actual 354 length field of zero is referred to as an empty vector. 356 T T'; 358 In the following example, mandatory is a vector that must contain 359 between 300 and 400 bytes of type opaque. It can never be empty. The 360 actual length field consumes two bytes, a uint16, sufficient to 361 represent the value 400 (see Section 4.4). On the other hand, longer 362 can represent up to 800 bytes of data, or 400 uint16 elements, and it 363 may be empty. Its encoding will include a two-byte actual length 364 field prepended to the vector. The length of an encoded vector must 365 be an even multiple of the length of a single element (for example, a 366 17-byte vector of uint16 would be illegal). 368 opaque mandatory<300..400>; 369 /* length field is 2 bytes, cannot be empty */ 370 uint16 longer<0..800>; 371 /* zero to 400 16-bit unsigned integers */ 373 4.4. Numbers 375 The basic numeric data type is an unsigned byte (uint8). All larger 376 numeric data types are formed from fixed-length series of bytes 377 concatenated as described in Section 4.1 and are also unsigned. The 378 following numeric types are predefined. 380 uint8 uint16[2]; 381 uint8 uint24[3]; 382 uint8 uint32[4]; 383 uint8 uint64[8]; 384 All values, here and elsewhere in the specification, are stored in 385 "network" or "big-endian" order; the uint32 represented by the hex 386 bytes 01 02 03 04 is equivalent to the decimal value 16909060. 388 Note that in some cases (e.g., DH parameters) it is necessary to 389 represent integers as opaque vectors. In such cases, they are 390 represented as unsigned integers (i.e., leading zero octets are not 391 required even if the most significant bit is set). 393 4.5. Enumerateds 395 An additional sparse data type is available called enum. A field of 396 type enum can only assume the values declared in the definition. 397 Each definition is a different type. Only enumerateds of the same 398 type may be assigned or compared. Every element of an enumerated must 399 be assigned a value, as demonstrated in the following example. Since 400 the elements of the enumerated are not ordered, they can be assigned 401 any unique value, in any order. 403 enum { e1(v1), e2(v2), ... , en(vn) [[, (n)]] } Te; 405 Enumerateds occupy as much space in the byte stream as would its 406 maximal defined ordinal value. The following definition would cause 407 one byte to be used to carry fields of type Color. 409 enum { red(3), blue(5), white(7) } Color; 411 One may optionally specify a value without its associated tag to 412 force the width definition without defining a superfluous element. 413 In the following example, Taste will consume two bytes in the data 414 stream but can only assume the values 1, 2, or 4. 416 enum { sweet(1), sour(2), bitter(4), (32000) } Taste; 418 The names of the elements of an enumeration are scoped within the 419 defined type. In the first example, a fully qualified reference to 420 the second element of the enumeration would be Color.blue. Such 421 qualification is not required if the target of the assignment is well 422 specified. 424 Color color = Color.blue; /* overspecified, legal */ 425 Color color = blue; /* correct, type implicit */ 427 For enumerateds that are never converted to external representation, 428 the numerical information may be omitted. 430 enum { low, medium, high } Amount; 431 4.6. Constructed Types 433 Structure types may be constructed from primitive types for 434 convenience. Each specification declares a new, unique type. The 435 syntax for definition is much like that of C. 437 struct { 438 T1 f1; 439 T2 f2; 440 ... 441 Tn fn; 442 } [[T]]; 444 The fields within a structure may be qualified using the type's name, 445 with a syntax much like that available for enumerateds. For example, 446 T.f2 refers to the second field of the previous declaration. 447 Structure definitions may be embedded. 449 4.6.1. Variants 451 Defined structures may have variants based on some knowledge that is 452 available within the environment. The selector must be an enumerated 453 type that defines the possible variants the structure defines. There 454 must be a case arm for every element of the enumeration declared in 455 the select. The body of the variant structure may be given a label 456 for reference. The mechanism by which the variant is selected at 457 runtime is not prescribed by the presentation language. 459 struct { 460 T1 f1; 461 T2 f2; 462 .... 463 Tn fn; 464 select (E) { 465 case e1: Te1; 466 case e2: Te2; 467 .... 468 case en: Ten; 469 } [[fv]]; 470 } [[Tv]]; 472 For example: 474 enum { apple, orange } VariantTag; 475 struct { 476 uint16 number; 477 opaque string<0..10>; /* variable length */ 478 } V1; 479 struct { 480 uint32 number; 481 opaque string[10]; /* fixed length */ 482 } V2; 483 struct { 484 select (VariantTag) { /* value of selector is implicit */ 485 case apple: V1; /* VariantBody, tag = apple */ 486 case orange: V2; /* VariantBody, tag = orange */ 487 } variant_body; /* optional label on variant */ 488 } VariantRecord; 490 Variant structures may be qualified (narrowed) by specifying a value 491 for the selector prior to the type. For example, an 493 orange VariantRecord 495 is a narrowed type of a VariantRecord containing a variant_body of 496 type V2. 498 4.7. Cryptographic Attributes 500 The five cryptographic operations digital signing, stream cipher 501 encryption, block cipher encryption, authenticated encryption with 502 additional data (AEAD) encryption and public key encryption are 503 designated digitally-signed, stream-ciphered, block-ciphered, aead- 504 ciphered, and public-key-encrypted, respectively. A field's 505 cryptographic processing is specified by prepending an appropriate 506 key word designation before the field's type specification. 507 Cryptographic keys are implied by the current session state (see 508 Section 6.1). 510 In digital signing, one-way hash functions are used as input for a 511 signing algorithm. A digitally-signed element is encoded as an opaque 512 vector <0..2^16-1>, where the length is specified by the signing 513 algorithm and key. 515 In RSA signing, the opaque vector contains the signature generated 516 using the RSASSA-PKCS1-v1_5 signature scheme defined in [PKCS1]. As 517 discussed in [PKCS1], the DigestInfo MUST be DER encoded and for 518 digest algorithms without parameters (which include SHA-1) the 519 DigestInfo.AlgorithmIdentifier.parameters field MUST be NULL but 520 implementations MUST accept both without parameters and with NULL 521 parameters. Note that earlier versions of TLS used a different RSA 522 signature scheme which did not include a DigestInfo encoding. 524 In DSS, the 20 bytes of the SHA-1 hash are run directly through the 525 Digital Signing Algorithm with no additional hashing. This produces 526 two values, r and s. The DSS signature is an opaque vector, as above, 527 the contents of which are the DER encoding of: 529 Dss-Sig-Value ::= SEQUENCE { 530 r INTEGER, 531 s INTEGER 532 } 534 In stream cipher encryption, the plaintext is exclusive-ORed with an 535 identical amount of output generated from a cryptographically secure 536 keyed pseudorandom number generator. 538 In block cipher encryption, every block of plaintext encrypts to a 539 block of ciphertext. All block cipher encryption is done in CBC 540 (Cipher Block Chaining) mode, and all items that are block-ciphered 541 will be an exact multiple of the cipher block length. 543 In AEAD encryption, the plaintext is simultaneously encrypted and 544 integrity protected. The input may be of any length and the output is 545 generally larger than the input in order to accomodate the integrity 546 check value. 548 In public key encryption, a public key algorithm is used to encrypt 549 data in such a way that it can be decrypted only with the matching 550 private key. A public-key-encrypted element is encoded as an opaque 551 vector <0..2^16-1>, where the length is specified by the encryption 552 algorithm and key. 554 RSA encryption is done using the RSAES-PKCS1-v1_5 encryption scheme 555 defined in [PKCS1]. 557 In the following example 559 stream-ciphered struct { 560 uint8 field1; 561 uint8 field2; 562 digitally-signed opaque hash[20]; 563 } UserType; 565 the contents of hash are used as input for the signing algorithm, and 566 then the entire structure is encrypted with a stream cipher. The 567 length of this structure, in bytes, would be equal to two bytes for 568 field1 and field2, plus two bytes for the length of the signature, 569 plus the length of the output of the signing algorithm. This is known 570 because the algorithm and key used for the signing are known prior to 571 encoding or decoding this structure. 573 4.8. Constants 574 Typed constants can be defined for purposes of specification by 575 declaring a symbol of the desired type and assigning values to it. 576 Under-specified types (opaque, variable length vectors, and 577 structures that contain opaque) cannot be assigned values. No fields 578 of a multi-element structure or vector may be elided. 580 For example: 582 struct { 583 uint8 f1; 584 uint8 f2; 585 } Example1; 587 Example1 ex1 = {1, 4}; /* assigns f1 = 1, f2 = 4 */ 589 5. HMAC and the Pseudorandom Function 591 The TLS record layer uses a keyed Message Authentication Code (MAC) 592 to protect message integrity. The cipher suites defined in this 593 document use a construction known as HMAC, described in [HMAC], which 594 is based on a hash function. Other cipher suites MAY define their own 595 MAC constructions, if needed. 597 In addition, a construction is required to do expansion of secrets 598 into blocks of data for the purposes of key generation or validation. 599 This pseudo-random function (PRF) takes as input a secret, a seed, 600 and an identifying label and produces an output of arbitrary length. 602 In this section, we define one PRF, based on HMAC. This PRF with the 603 SHA-256 hash function is used for all cipher suites defined in this 604 document and in TLS documents published prior to this document. New 605 cipher suites MUST explicitly specify a PRF and in general SHOULD use 606 the TLS PRF with SHA-256 or a stronger standard hash function. 608 First, we define a data expansion function, P_hash(secret, data) that 609 uses a single hash function to expand a secret and seed into an 610 arbitrary quantity of output: 612 P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + 613 HMAC_hash(secret, A(2) + seed) + 614 HMAC_hash(secret, A(3) + seed) + ... 616 Where + indicates concatenation. 618 A() is defined as: 619 A(0) = seed 620 A(i) = HMAC_hash(secret, A(i-1)) 621 P_hash can be iterated as many times as is necessary to produce the 622 required quantity of data. For example, if P_SHA-1 is being used to 623 create 64 bytes of data, it will have to be iterated 4 times (through 624 A(4)), creating 80 bytes of output data; the last 16 bytes of the 625 final iteration will then be discarded, leaving 64 bytes of output 626 data. 628 TLS's PRF is created by applying P_hash to the secret S as: 630 PRF(secret, label, seed) = P_(secret, label + seed) 632 The label is an ASCII string. It should be included in the exact form 633 it is given without a length byte or trailing null character. For 634 example, the label "slithy toves" would be processed by hashing the 635 following bytes: 637 73 6C 69 74 68 79 20 74 6F 76 65 73 639 6. The TLS Record Protocol 641 The TLS Record Protocol is a layered protocol. At each layer, 642 messages may include fields for length, description, and content. 643 The Record Protocol takes messages to be transmitted, fragments the 644 data into manageable blocks, optionally compresses the data, applies 645 a MAC, encrypts, and transmits the result. Received data is 646 decrypted, verified, decompressed, reassembled, and then delivered to 647 higher-level clients. 649 Four record protocol clients are described in this document: the 650 handshake protocol, the alert protocol, the change cipher spec 651 protocol, and the application data protocol. In order to allow 652 extension of the TLS protocol, additional record types can be 653 supported by the record protocol. New record type values are assigned 654 by IANA as described in Section 12. 656 Implementations MUST NOT send record types not defined in this 657 document unless negotiated by some extension. If a TLS 658 implementation receives an unexpected record type, it MUST send a 659 unexpected_message alert." 661 Any protocol designed for use over TLS MUST be carefully designed to 662 deal with all possible attacks against it. Note that because the 663 type and length of a record are not protected by encryption, care 664 SHOULD be taken to minimize the value of traffic analysis of these 665 values. 667 6.1. Connection States 669 A TLS connection state is the operating environment of the TLS Record 670 Protocol. It specifies a compression algorithm, an encryption 671 algorithm, and a MAC algorithm. In addition, the parameters for these 672 algorithms are known: the MAC secret and the bulk encryption keys for 673 the connection in both the read and the write directions. Logically, 674 there are always four connection states outstanding: the current read 675 and write states, and the pending read and write states. All records 676 are processed under the current read and write states. The security 677 parameters for the pending states can be set by the TLS Handshake 678 Protocol, and the Change Cipher Spec can selectively make either of 679 the pending states current, in which case the appropriate current 680 state is disposed of and replaced with the pending state; the pending 681 state is then reinitialized to an empty state. It is illegal to make 682 a state that has not been initialized with security parameters a 683 current state. The initial current state always specifies that no 684 encryption, compression, or MAC will be used. 686 The security parameters for a TLS Connection read and write state are 687 set by providing the following values: 689 connection end 690 Whether this entity is considered the "client" or the "server" in 691 this connection. 693 bulk encryption algorithm 694 An algorithm to be used for bulk encryption. This specification 695 includes the key size of this algorithm, how much of that key is 696 secret, whether it is a block, stream, or AEAD cipher, and the 697 block size of the cipher (if appropriate). 699 MAC algorithm 700 An algorithm to be used for message authentication. This 701 specification includes the size of the value returned by the MAC 702 algorithm. 704 compression algorithm 705 An algorithm to be used for data compression. This specification 706 must include all information the algorithm requires to do 707 compression. 709 master secret 710 A 48-byte secret shared between the two peers in the connection. 712 client random 713 A 32-byte value provided by the client. 715 server random 716 A 32-byte value provided by the server. 718 These parameters are defined in the presentation language as: 720 enum { server, client } ConnectionEnd; 722 enum { null, rc4, rc2, des, 3des, des40, idea, aes } BulkCipherAlgorithm; 724 enum { stream, block, aead } CipherType; 726 enum { null, md5, sha, sha256, sha384, sha512} MACAlgorithm; 728 /* The use of "sha" above is historical and denotes SHA-1 */ 730 enum { null(0), (255) } CompressionMethod; 732 /* The algorithms specified in CompressionMethod, 733 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 735 struct { 736 ConnectionEnd entity; 737 BulkCipherAlgorithm bulk_cipher_algorithm; 738 CipherType cipher_type; 739 uint8 enc_key_length; 740 uint8 block_length; 741 uint8 fixed_iv_length; 742 uint8 record_iv_length; 743 MACAlgorithm mac_algorithm; 744 uint8 mac_length; 745 uint8 mac_key_length; 746 uint8 verify_data_length; 747 CompressionMethod compression_algorithm; 748 opaque master_secret[48]; 749 opaque client_random[32]; 750 opaque server_random[32]; 751 } SecurityParameters; 753 The record layer will use the security parameters to generate the 754 following four items: 756 client write MAC secret 757 server write MAC secret 758 client write key 759 server write key 761 The client write parameters are used by the server when receiving and 762 processing records and vice-versa. The algorithm used for generating 763 these items from the security parameters is described in Section 6.3. 765 Once the security parameters have been set and the keys have been 766 generated, the connection states can be instantiated by making them 767 the current states. These current states MUST be updated for each 768 record processed. Each connection state includes the following 769 elements: 771 compression state 772 The current state of the compression algorithm. 774 cipher state 775 The current state of the encryption algorithm. This will consist 776 of the scheduled key for that connection. For stream ciphers, 777 this will also contain whatever state information is necessary to 778 allow the stream to continue to encrypt or decrypt data. 780 MAC secret 781 The MAC secret for this connection, as generated above. 783 sequence number 784 Each connection state contains a sequence number, which is 785 maintained separately for read and write states. The sequence 786 number MUST be set to zero whenever a connection state is made 787 the active state. Sequence numbers are of type uint64 and may not 788 exceed 2^64-1. Sequence numbers do not wrap. If a TLS 789 implementation would need to wrap a sequence number, it must 790 renegotiate instead. A sequence number is incremented after each 791 record: specifically, the first record transmitted under a 792 particular connection state MUST use sequence number 0. 794 6.2. Record layer 796 The TLS Record Layer receives uninterpreted data from higher layers 797 in non-empty blocks of arbitrary size. 799 6.2.1. Fragmentation 801 The record layer fragments information blocks into TLSPlaintext 802 records carrying data in chunks of 2^14 bytes or less. Client message 803 boundaries are not preserved in the record layer (i.e., multiple 804 client messages of the same ContentType MAY be coalesced into a 805 single TLSPlaintext record, or a single message MAY be fragmented 806 across several records). 808 struct { 809 uint8 major, minor; 810 } ProtocolVersion; 812 enum { 813 change_cipher_spec(20), alert(21), handshake(22), 814 application_data(23), (255) 815 } ContentType; 817 struct { 818 ContentType type; 819 ProtocolVersion version; 820 uint16 length; 821 opaque fragment[TLSPlaintext.length]; 822 } TLSPlaintext; 824 type 825 The higher-level protocol used to process the enclosed fragment. 827 version 828 The version of the protocol being employed. This document 829 describes TLS Version 1.2, which uses the version { 3, 3 }. The 830 version value 3.3 is historical, deriving from the use of 3.1 for 831 TLS 1.0. (See Appendix A.1). Note that a client that supports 832 multiple versions of TLS may not know what version will be 833 employed before it receives ServerHello. See Appendix E for 834 discussion about what record layer version number should be 835 employed for ClientHello. 837 length 838 The length (in bytes) of the following TLSPlaintext.fragment. 839 The length MUST NOT exceed 2^14. 841 fragment 842 The application data. This data is transparent and treated as an 843 independent block to be dealt with by the higher-level protocol 844 specified by the type field. 846 Implementations MUST NOT send zero-length fragments of Handshake, 847 Alert, or Change Cipher Spec content types. Zero-length fragments 848 of Application data MAY be sent as they are potentially useful as 849 a traffic analysis countermeasure. 851 Note: Data of different TLS Record layer content types MAY be 852 interleaved. Application data is generally of lower precedence 853 for transmission than other content types. However, records MUST 854 be delivered to the network in the same order as they are 855 protected by the record layer. Recipients MUST receive and 856 process interleaved application layer traffic during handshakes 857 subsequent to the first one on a connection. 859 6.2.2. Record Compression and Decompression 861 All records are compressed using the compression algorithm defined in 862 the current session state. There is always an active compression 863 algorithm; however, initially it is defined as 864 CompressionMethod.null. The compression algorithm translates a 865 TLSPlaintext structure into a TLSCompressed structure. Compression 866 functions are initialized with default state information whenever a 867 connection state is made active. 869 Compression must be lossless and may not increase the content length 870 by more than 1024 bytes. If the decompression function encounters a 871 TLSCompressed.fragment that would decompress to a length in excess of 872 2^14 bytes, it MUST report a fatal decompression failure error. 874 struct { 875 ContentType type; /* same as TLSPlaintext.type */ 876 ProtocolVersion version;/* same as TLSPlaintext.version */ 877 uint16 length; 878 opaque fragment[TLSCompressed.length]; 879 } TLSCompressed; 881 length 882 The length (in bytes) of the following TLSCompressed.fragment. 883 The length MUST NOT exceed 2^14 + 1024. 885 fragment 886 The compressed form of TLSPlaintext.fragment. 888 Note: A CompressionMethod.null operation is an identity operation; no 889 fields are altered. 891 Implementation note: 892 Decompression functions are responsible for ensuring that 893 messages cannot cause internal buffer overflows. 895 6.2.3. Record Payload Protection 897 The encryption and MAC functions translate a TLSCompressed structure 898 into a TLSCiphertext. The decryption functions reverse the process. 899 The MAC of the record also includes a sequence number so that 900 missing, extra, or repeated messages are detectable. 902 struct { 903 ContentType type; 904 ProtocolVersion version; 905 uint16 length; 906 select (SecurityParameters.cipher_type) { 907 case stream: GenericStreamCipher; 908 case block: GenericBlockCipher; 909 case aead: GenericAEADCipher; 910 } fragment; 911 } TLSCiphertext; 913 type 914 The type field is identical to TLSCompressed.type. 916 version 917 The version field is identical to TLSCompressed.version. 919 length 920 The length (in bytes) of the following TLSCiphertext.fragment. 921 The length MUST NOT exceed 2^14 + 2048. 923 fragment 924 The encrypted form of TLSCompressed.fragment, with the MAC. 926 6.2.3.1. Null or Standard Stream Cipher 928 Stream ciphers (including BulkCipherAlgorithm.null, see Appendix A.6) 929 convert TLSCompressed.fragment structures to and from stream 930 TLSCiphertext.fragment structures. 932 stream-ciphered struct { 933 opaque content[TLSCompressed.length]; 934 opaque MAC[SecurityParameters.mac_length]; 935 } GenericStreamCipher; 937 The MAC is generated as: 939 MAC(MAC_write_secret, seq_num + TLSCompressed.type + 940 TLSCompressed.version + TLSCompressed.length + 941 TLSCompressed.fragment); 943 where "+" denotes concatenation. 945 seq_num 946 The sequence number for this record. 948 hash 949 The hashing algorithm specified by 950 SecurityParameters.mac_algorithm. 952 Note that the MAC is computed before encryption. The stream cipher 953 encrypts the entire block, including the MAC. For stream ciphers that 954 do not use a synchronization vector (such as RC4), the stream cipher 955 state from the end of one record is simply used on the subsequent 956 packet. If the CipherSuite is TLS_NULL_WITH_NULL_NULL, encryption 957 consists of the identity operation (i.e., the data is not encrypted, 958 and the MAC size is zero, implying that no MAC is used). 959 TLSCiphertext.length is TLSCompressed.length plus 960 SecurityParameters.mac_length. 962 6.2.3.2. CBC Block Cipher 964 For block ciphers (such as RC2, DES, or AES), the encryption and MAC 965 functions convert TLSCompressed.fragment structures to and from block 966 TLSCiphertext.fragment structures. 968 struct { 969 opaque IV[SecurityParameters.record_iv_length]; 970 block-ciphered struct { 971 opaque content[TLSCompressed.length]; 972 opaque MAC[SecurityParameters.mac_length]; 973 uint8 padding[GenericBlockCipher.padding_length]; 974 uint8 padding_length; 975 }; 976 } GenericBlockCipher; 978 The MAC is generated as described in Section 6.2.3.1. 980 IV 981 The Initialization Vector (IV) SHOULD be chosen at random, and 982 MUST be unpredictable. Note that in versions of TLS prior to 1.1, 983 there was no IV field, and the last ciphertext block of the 984 previous record (the "CBC residue") was used as the IV. This was 985 changed to prevent the attacks described in [CBCATT]. For block 986 ciphers, the IV length is of length 987 SecurityParameters.record_iv_length which is equal to the 988 SecurityParameters.block_size. 990 padding 991 Padding that is added to force the length of the plaintext to be 992 an integral multiple of the block cipher's block length. The 993 padding MAY be any length up to 255 bytes, as long as it results 994 in the TLSCiphertext.length being an integral multiple of the 995 block length. Lengths longer than necessary might be desirable to 996 frustrate attacks on a protocol that are based on analysis of the 997 lengths of exchanged messages. Each uint8 in the padding data 998 vector MUST be filled with the padding length value. The receiver 999 MUST check this padding and MUST use the bad_record_mac alert to 1000 indicate padding errors. 1002 padding_length 1003 The padding length MUST be such that the total size of the 1004 GenericBlockCipher structure is a multiple of the cipher's block 1005 length. Legal values range from zero to 255, inclusive. This 1006 length specifies the length of the padding field exclusive of the 1007 padding_length field itself. 1009 The encrypted data length (TLSCiphertext.length) is one more than the 1010 sum of one more than the sum of SecurityParameters.block_length, 1011 TLSCompressed.length, SecurityParameters.mac_length, and 1012 padding_length. 1014 Example: If the block length is 8 bytes, the content length 1015 (TLSCompressed.length) is 61 bytes, and the MAC length is 20 1016 bytes, then the length before padding is 82 bytes (this does 1017 not include the IV. Thus, the padding length modulo 8 must be 1018 equal to 6 in order to make the total length an even multiple 1019 of 8 bytes (the block length). The padding length can be 6, 1020 14, 22, and so on, through 254. If the padding length were the 1021 minimum necessary, 6, the padding would be 6 bytes, each 1022 containing the value 6. Thus, the last 8 octets of the 1023 GenericBlockCipher before block encryption would be xx 06 06 1024 06 06 06 06 06, where xx is the last octet of the MAC. 1026 Note: With block ciphers in CBC mode (Cipher Block Chaining), 1027 it is critical that the entire plaintext of the record be known 1028 before any ciphertext is transmitted. Otherwise, it is possible 1029 for the attacker to mount the attack described in [CBCATT]. 1031 Implementation Note: Canvel et al. [CBCTIME] have demonstrated a timing 1032 attack on CBC padding based on the time required to compute the 1033 MAC. In order to defend against this attack, implementations MUST 1034 ensure that record processing time is essentially the same 1035 whether or not the padding is correct. In general, the best way 1036 to do this is to compute the MAC even if the padding is 1037 incorrect, and only then reject the packet. For instance, if the 1038 pad appears to be incorrect, the implementation might assume a 1039 zero-length pad and then compute the MAC. This leaves a small 1040 timing channel, since MAC performance depends to some extent on 1041 the size of the data fragment, but it is not believed to be large 1042 enough to be exploitable, due to the large block size of existing 1043 MACs and the small size of the timing signal. 1045 6.2.3.3. AEAD ciphers 1047 For AEAD [AEAD] ciphers (such as [CCM] or [GCM]) the AEAD function 1048 converts TLSCompressed.fragment structures to and from AEAD 1049 TLSCiphertext.fragment structures. 1051 struct { 1052 opaque nonce_explicit[SecurityParameters.record_iv_length]; 1054 aead-ciphered struct { 1055 opaque content[TLSCompressed.length]; 1056 }; 1057 } GenericAEADCipher; 1059 AEAD ciphers take as input a single key, a nonce, a plaintext, and 1060 "additional data" to be included in the authentication check, as 1061 described in Section 2.1 of [AEAD]. These inputs are as follows. 1063 The key is either the client_write_key or the server_write_key. No 1064 MAC key is used. 1066 Each AEAD cipher suite has to specify how the nonce supplied to the 1067 AEAD operation is constructed, and what is the length of the 1068 GenericAEADCipher.nonce_explicit part. In many cases, it is 1069 appropriate to use the partially implicit nonce technique described 1070 in Section 3.2.1 of [AEAD]; in this case, the implicit part SHOULD be 1071 derived from key_block as client_write_iv and server_write_iv (as 1072 described in Section 6.3), and the explicit part is included in 1073 GenericAEAEDCipher.nonce_explicit. 1075 The plaintext is the TLSCompressed.fragment. 1077 The additional authenticated data, which we denote as 1078 additional_data, is defined as follows: 1080 additional_data = seq_num + TLSCompressed.type + 1081 TLSCompressed.version + TLSCompressed.length; 1083 Where "+" denotes concatenation. 1085 The aead_output consists of the ciphertext output by the AEAD 1086 encryption operation. The length will generally be larger than 1087 TLSCompressed.length, but by an amount that varies with the AEAD 1088 cipher. Since the ciphers might incorporate padding, the amount of 1089 overhead could vary with different TLSCompressed.length values. Each 1090 AEAD cipher MUST NOT produce an expansion of greater than 1024 bytes. 1091 Symbolically, 1093 AEADEncrypted = AEAD-Encrypt(key, IV, plaintext, 1094 additional_data) 1096 In order to decrypt and verify, the cipher takes as input the key, 1097 IV, the "additional_data", and the AEADEncrypted value. The output is 1098 either the plaintext or an error indicating that the decryption 1099 failed. There is no separate integrity check. I.e., 1101 TLSCompressed.fragment = AEAD-Decrypt(write_key, IV, AEADEncrypted, 1102 additional_data) 1104 If the decryption fails, a fatal bad_record_mac alert MUST be 1105 generated. 1107 6.3. Key Calculation 1109 The Record Protocol requires an algorithm to generate keys, and MAC 1110 secrets from the security parameters provided by the handshake 1111 protocol. 1113 The master secret is hashed into a sequence of secure bytes, which 1114 are assigned to the MAC secrets and keys required by the current 1115 connection state (see Appendix A.6). CipherSpecs require a client 1116 write MAC secret, a server write MAC secret, a client write key, and 1117 a server write key, each of which is generated from the master secret 1118 in that order. Unused values are empty. 1120 When keys and MAC secrets are generated, the master secret is used as 1121 an entropy source. 1123 To generate the key material, compute 1125 key_block = PRF(SecurityParameters.master_secret, 1126 "key expansion", 1127 SecurityParameters.server_random + 1128 SecurityParameters.client_random); 1130 until enough output has been generated. Then the key_block is 1131 partitioned as follows: 1133 client_write_MAC_secret[SecurityParameters.mac_key_length] 1134 server_write_MAC_secret[SecurityParameters.mac_key_length] 1135 client_write_key[SecurityParameters.enc_key_length] 1136 server_write_key[SecurityParameters.enc_key_length] 1137 client_write_IV[SecurityParameters.fixed_iv_length] 1138 server_write_IV[SecurityParameters.fixed_iv_length] 1140 The client_write_IV and server_write_IV are only generated for 1141 implicit nonce techniques as described in Section 3.2.1 of [AEAD]. 1143 Implementation note: 1144 The currently defined cipher suite which requires the most 1145 material is AES_256_CBC_SHA. It requires 2 x 32 byte keys and 2 x 1146 20 byte MAC secrets, for a total 104 bytes of key material. 1148 7. The TLS Handshaking Protocols 1150 TLS has three subprotocols that are used to allow peers to agree 1151 upon security parameters for the record layer, to authenticate 1152 themselves, to instantiate negotiated security parameters, and to 1153 report error conditions to each other. 1155 The Handshake Protocol is responsible for negotiating a session, 1156 which consists of the following items: 1158 session identifier 1159 An arbitrary byte sequence chosen by the server to identify an 1160 active or resumable session state. 1162 peer certificate 1163 X509v3 [PKIX] certificate of the peer. This element of the 1164 state may be null. 1166 compression method 1167 The algorithm used to compress data prior to encryption. 1169 cipher spec 1170 Specifies the bulk data encryption algorithm (such as null, 1171 DES, etc.) and a MAC algorithm (such as MD5 or SHA). It also 1172 defines cryptographic attributes such as the mac_length. (See 1173 Appendix A.6 for formal definition.) 1175 master secret 1176 48-byte secret shared between the client and server. 1178 is resumable 1179 A flag indicating whether the session can be used to initiate 1180 new connections. 1182 These items are then used to create security parameters for use by 1183 the Record Layer when protecting application data. Many connections 1184 can be instantiated using the same session through the resumption 1185 feature of the TLS Handshake Protocol. 1187 7.1. Change Cipher Spec Protocol 1189 The change cipher spec protocol exists to signal transitions in 1190 ciphering strategies. The protocol consists of a single message, 1191 which is encrypted and compressed under the current (not the pending) 1192 connection state. The message consists of a single byte of value 1. 1194 struct { 1195 enum { change_cipher_spec(1), (255) } type; 1196 } ChangeCipherSpec; 1198 The change cipher spec message is sent by both the client and the 1199 server to notify the receiving party that subsequent records will be 1200 protected under the newly negotiated CipherSpec and keys. Reception 1201 of this message causes the receiver to instruct the Record Layer to 1202 immediately copy the read pending state into the read current state. 1203 Immediately after sending this message, the sender MUST instruct the 1204 record layer to make the write pending state the write active state. 1205 (See Section 6.1.) The change cipher spec message is sent during the 1206 handshake after the security parameters have been agreed upon, but 1207 before the verifying finished message is sent. 1209 Note: If a rehandshake occurs while data is flowing on a connection, 1210 the communicating parties may continue to send data using the old 1211 CipherSpec. However, once the ChangeCipherSpec has been sent, the new 1212 CipherSpec MUST be used. The first side to send the ChangeCipherSpec 1213 does not know that the other side has finished computing the new 1214 keying material (e.g., if it has to perform a time consuming public 1215 key operation). Thus, a small window of time, during which the 1216 recipient must buffer the data, MAY exist. In practice, with modern 1217 machines this interval is likely to be fairly short. 1219 7.2. Alert Protocol 1221 One of the content types supported by the TLS Record layer is the 1222 alert type. Alert messages convey the severity of the message and a 1223 description of the alert. Alert messages with a level of fatal result 1224 in the immediate termination of the connection. In this case, other 1225 connections corresponding to the session may continue, but the 1226 session identifier MUST be invalidated, preventing the failed session 1227 from being used to establish new connections. Like other messages, 1228 alert messages are encrypted and compressed, as specified by the 1229 current connection state. 1231 enum { warning(1), fatal(2), (255) } AlertLevel; 1233 enum { 1234 close_notify(0), 1235 unexpected_message(10), 1236 bad_record_mac(20), 1237 decryption_failed_RESERVED(21), 1238 record_overflow(22), 1239 decompression_failure(30), 1240 handshake_failure(40), 1241 no_certificate_RESERVED(41), 1242 bad_certificate(42), 1243 unsupported_certificate(43), 1244 certificate_revoked(44), 1245 certificate_expired(45), 1246 certificate_unknown(46), 1247 illegal_parameter(47), 1248 unknown_ca(48), 1249 access_denied(49), 1250 decode_error(50), 1251 decrypt_error(51), 1252 export_restriction_RESERVED(60), 1253 protocol_version(70), 1254 insufficient_security(71), 1255 internal_error(80), 1256 user_canceled(90), 1257 no_renegotiation(100), 1258 unsupported_extension(110), 1259 (255) 1260 } AlertDescription; 1262 struct { 1263 AlertLevel level; 1264 AlertDescription description; 1265 } Alert; 1267 7.2.1. Closure Alerts 1269 The client and the server must share knowledge that the connection is 1270 ending in order to avoid a truncation attack. Either party may 1271 initiate the exchange of closing messages. 1273 close_notify 1274 This message notifies the recipient that the sender will not send 1275 any more messages on this connection. Note that as of TLS 1.1, 1276 failure to properly close a connection no longer requires that a 1277 session not be resumed. This is a change from TLS 1.0 to conform 1278 with widespread implementation practice. 1280 Either party may initiate a close by sending a close_notify alert. 1281 Any data received after a closure alert is ignored. 1283 Unless some other fatal alert has been transmitted, each party is 1284 required to send a close_notify alert before closing the write side 1285 of the connection. The other party MUST respond with a close_notify 1286 alert of its own and close down the connection immediately, 1287 discarding any pending writes. It is not required for the initiator 1288 of the close to wait for the responding close_notify alert before 1289 closing the read side of the connection. 1291 If the application protocol using TLS provides that any data may be 1292 carried over the underlying transport after the TLS connection is 1293 closed, the TLS implementation must receive the responding 1294 close_notify alert before indicating to the application layer that 1295 the TLS connection has ended. If the application protocol will not 1296 transfer any additional data, but will only close the underlying 1297 transport connection, then the implementation MAY choose to close the 1298 transport without waiting for the responding close_notify. No part of 1299 this standard should be taken to dictate the manner in which a usage 1300 profile for TLS manages its data transport, including when 1301 connections are opened or closed. 1303 Note: It is assumed that closing a connection reliably delivers 1304 pending data before destroying the transport. 1306 7.2.2. Error Alerts 1308 Error handling in the TLS Handshake protocol is very simple. When an 1309 error is detected, the detecting party sends a message to the other 1310 party. Upon transmission or receipt of a fatal alert message, both 1311 parties immediately close the connection. Servers and clients MUST 1312 forget any session-identifiers, keys, and secrets associated with a 1313 failed connection. Thus, any connection terminated with a fatal alert 1314 MUST NOT be resumed. 1316 Whenever an implementation encounters a condition which is defined as 1317 a fatal alert, it MUST send the appropriate alert prior to closing 1318 the connection. In cases where an implementation chooses to send an 1319 alert which MAY be a warning alert but intends to close the 1320 connection immediately afterwards, it MUST send that alert at the 1321 fatal alert level. 1323 If an alert with a level of warning is sent and received, generally 1324 the connection can continue normally. If the receiving party decides 1325 not to proceed with the connection (e.g., after having received a 1326 no_renegotiation alert that it is not willing to accept), it SHOULD 1327 send a fatal alert to terminate the connection. 1329 The following error alerts are defined: 1331 unexpected_message 1332 An inappropriate message was received. This alert is always fatal 1333 and should never be observed in communication between proper 1334 implementations. 1336 bad_record_mac 1337 This alert is returned if a record is received with an incorrect 1338 MAC. This alert also MUST be returned if an alert is sent because 1339 a TLSCiphertext decrypted in an invalid way: either it wasn't an 1340 even multiple of the block length, or its padding values, when 1341 checked, weren't correct. This message is always fatal. 1343 decryption_failed_RESERVED 1344 This alert was used in some earlier versions of TLS, and may have 1345 permitted certain attacks against the CBC mode [CBCATT]. It MUST 1346 NOT be sent by compliant implementations. 1348 record_overflow 1349 A TLSCiphertext record was received that had a length more than 1350 2^14+2048 bytes, or a record decrypted to a TLSCompressed record 1351 with more than 2^14+1024 bytes. This message is always fatal. 1353 decompression_failure 1354 The decompression function received improper input (e.g., data 1355 that would expand to excessive length). This message is always 1356 fatal. 1358 handshake_failure 1359 Reception of a handshake_failure alert message indicates that the 1360 sender was unable to negotiate an acceptable set of security 1361 parameters given the options available. This is a fatal error. 1363 no_certificate_RESERVED 1364 This alert was used in SSLv3 but not any version of TLS. It MUST 1365 NOT be sent by compliant implementations. 1367 bad_certificate 1368 A certificate was corrupt, contained signatures that did not 1369 verify correctly, etc. 1371 unsupported_certificate 1372 A certificate was of an unsupported type. 1374 certificate_revoked 1375 A certificate was revoked by its signer. 1377 certificate_expired 1378 A certificate has expired or is not currently valid. 1380 certificate_unknown 1381 Some other (unspecified) issue arose in processing the 1382 certificate, rendering it unacceptable. 1384 illegal_parameter 1385 A field in the handshake was out of range or inconsistent with 1386 other fields. This is always fatal. 1388 unknown_ca 1389 A valid certificate chain or partial chain was received, but the 1390 certificate was not accepted because the CA certificate could not 1391 be located or couldn't be matched with a known, trusted CA. This 1392 message is always fatal. 1394 access_denied 1395 A valid certificate was received, but when access control was 1396 applied, the sender decided not to proceed with negotiation. 1397 This message is always fatal. 1399 decode_error 1400 A message could not be decoded because some field was out of the 1401 specified range or the length of the message was incorrect. This 1402 message is always fatal. 1404 decrypt_error 1405 A handshake cryptographic operation failed, including being 1406 unable to correctly verify a signature, decrypt a key exchange, 1407 or validate a finished message. 1409 export_restriction_RESERVED 1410 This alert was used in some earlier versions of TLS. It MUST NOT 1411 be sent by compliant implementations. 1413 protocol_version 1414 The protocol version the client has attempted to negotiate is 1415 recognized but not supported. (For example, old protocol versions 1416 might be avoided for security reasons). This message is always 1417 fatal. 1419 insufficient_security 1420 Returned instead of handshake_failure when a negotiation has 1421 failed specifically because the server requires ciphers more 1422 secure than those supported by the client. This message is always 1423 fatal. 1425 internal_error 1426 An internal error unrelated to the peer or the correctness of the 1427 protocol (such as a memory allocation failure) makes it 1428 impossible to continue. This message is always fatal. 1430 user_canceled 1431 This handshake is being canceled for some reason unrelated to a 1432 protocol failure. If the user cancels an operation after the 1433 handshake is complete, just closing the connection by sending a 1434 close_notify is more appropriate. This alert should be followed 1435 by a close_notify. This message is generally a warning. 1437 no_renegotiation 1438 Sent by the client in response to a hello request or by the 1439 server in response to a client hello after initial handshaking. 1440 Either of these would normally lead to renegotiation; when that 1441 is not appropriate, the recipient should respond with this alert. 1442 At that point, the original requester can decide whether to 1443 proceed with the connection. One case where this would be 1444 appropriate is where a server has spawned a process to satisfy a 1445 request; the process might receive security parameters (key 1446 length, authentication, etc.) at startup and it might be 1447 difficult to communicate changes to these parameters after that 1448 point. This message is always a warning. 1450 unsupported_extension 1451 sent by clients that receive an extended server hello containing 1452 an extension that they did not put in the corresponding client 1453 hello. This message is always fatal. 1455 For all errors where an alert level is not explicitly specified, the 1456 sending party MAY determine at its discretion whether this is a fatal 1457 error or not; if an alert with a level of warning is received, the 1458 receiving party MAY decide at its discretion whether to treat this as 1459 a fatal error or not. However, all messages that are transmitted 1460 with a level of fatal MUST be treated as fatal messages. 1462 New Alert values are assigned by IANA as described in Section 12. 1464 7.3. Handshake Protocol Overview 1466 The cryptographic parameters of the session state are produced by the 1467 TLS Handshake Protocol, which operates on top of the TLS Record 1468 Layer. When a TLS client and server first start communicating, they 1469 agree on a protocol version, select cryptographic algorithms, 1470 optionally authenticate each other, and use public-key encryption 1471 techniques to generate shared secrets. 1473 The TLS Handshake Protocol involves the following steps: 1475 - Exchange hello messages to agree on algorithms, exchange random 1476 values, and check for session resumption. 1478 - Exchange the necessary cryptographic parameters to allow the 1479 client and server to agree on a premaster secret. 1481 - Exchange certificates and cryptographic information to allow the 1482 client and server to authenticate themselves. 1484 - Generate a master secret from the premaster secret and exchanged 1485 random values. 1487 - Provide security parameters to the record layer. 1489 - Allow the client and server to verify that their peer has 1490 calculated the same security parameters and that the handshake 1491 occurred without tampering by an attacker. 1493 Note that higher layers should not be overly reliant on whether TLS 1494 always negotiates the strongest possible connection between two 1495 peers. There are a number of ways in which a man in the middle 1496 attacker can attempt to make two entities drop down to the least 1497 secure method they support. The protocol has been designed to 1498 minimize this risk, but there are still attacks available: for 1499 example, an attacker could block access to the port a secure service 1500 runs on, or attempt to get the peers to negotiate an unauthenticated 1501 connection. The fundamental rule is that higher levels must be 1502 cognizant of what their security requirements are and never transmit 1503 information over a channel less secure than what they require. The 1504 TLS protocol is secure in that any cipher suite offers its promised 1505 level of security: if you negotiate 3DES with a 1024 bit RSA key 1506 exchange with a host whose certificate you have verified, you can 1507 expect to be that secure. 1509 These goals are achieved by the handshake protocol, which can be 1510 summarized as follows: The client sends a client hello message to 1511 which the server must respond with a server hello message, or else a 1512 fatal error will occur and the connection will fail. The client hello 1513 and server hello are used to establish security enhancement 1514 capabilities between client and server. The client hello and server 1515 hello establish the following attributes: Protocol Version, Session 1516 ID, Cipher Suite, and Compression Method. Additionally, two random 1517 values are generated and exchanged: ClientHello.random and 1518 ServerHello.random. 1520 The actual key exchange uses up to four messages: the server 1521 certificate, the server key exchange, the client certificate, and the 1522 client key exchange. New key exchange methods can be created by 1523 specifying a format for these messages and by defining the use of the 1524 messages to allow the client and server to agree upon a shared 1525 secret. This secret MUST be quite long; currently defined key 1526 exchange methods exchange secrets that range from 46 bytes upwards. 1528 Following the hello messages, the server will send its certificate, 1529 if it is to be authenticated. Additionally, a server key exchange 1530 message may be sent, if it is required (e.g., if their server has no 1531 certificate, or if its certificate is for signing only). If the 1532 server is authenticated, it may request a certificate from the 1533 client, if that is appropriate to the cipher suite selected. Next, 1534 the server will send the server hello done message, indicating that 1535 the hello-message phase of the handshake is complete. The server will 1536 then wait for a client response. If the server has sent a certificate 1537 request message, the client MUST send the certificate message. The 1538 client key exchange message is now sent, and the content of that 1539 message will depend on the public key algorithm selected between the 1540 client hello and the server hello. If the client has sent a 1541 certificate with signing ability, a digitally-signed certificate 1542 verify message is sent to explicitly verify possession of the private 1543 key in the certificate. 1545 At this point, a change cipher spec message is sent by the client, 1546 and the client copies the pending Cipher Spec into the current Cipher 1547 Spec. The client then immediately sends the finished message under 1548 the new algorithms, keys, and secrets. In response, the server will 1549 send its own change cipher spec message, transfer the pending to the 1550 current Cipher Spec, and send its finished message under the new 1551 Cipher Spec. At this point, the handshake is complete, and the client 1552 and server may begin to exchange application layer data. (See flow 1553 chart below.) Application data MUST NOT be sent prior to the 1554 completion of the first handshake (before a cipher suite other than 1555 TLS_NULL_WITH_NULL_NULL is established). 1557 Client Server 1559 ClientHello --------> 1560 ServerHello 1561 Certificate* 1562 ServerKeyExchange* 1563 CertificateRequest* 1564 <-------- ServerHelloDone 1565 Certificate* 1566 ClientKeyExchange 1567 CertificateVerify* 1568 [ChangeCipherSpec] 1569 Finished --------> 1570 [ChangeCipherSpec] 1571 <-------- Finished 1572 Application Data <-------> Application Data 1574 Fig. 1. Message flow for a full handshake 1576 * Indicates optional or situation-dependent messages that are not 1577 always sent. 1579 Note: To help avoid pipeline stalls, ChangeCipherSpec is an 1580 independent TLS Protocol content type, and is not actually a TLS 1581 handshake message. 1583 When the client and server decide to resume a previous session or 1584 duplicate an existing session (instead of negotiating new security 1585 parameters), the message flow is as follows: 1587 The client sends a ClientHello using the Session ID of the session to 1588 be resumed. The server then checks its session cache for a match. If 1589 a match is found, and the server is willing to re-establish the 1590 connection under the specified session state, it will send a 1591 ServerHello with the same Session ID value. At this point, both 1592 client and server MUST send change cipher spec messages and proceed 1593 directly to finished messages. Once the re-establishment is complete, 1594 the client and server MAY begin to exchange application layer data. 1595 (See flow chart below.) If a Session ID match is not found, the 1596 server generates a new session ID and the TLS client and server 1597 perform a full handshake. 1599 Client Server 1601 ClientHello --------> 1602 ServerHello 1603 [ChangeCipherSpec] 1604 <-------- Finished 1605 [ChangeCipherSpec] 1606 Finished --------> 1607 Application Data <-------> Application Data 1609 Fig. 2. Message flow for an abbreviated handshake 1611 The contents and significance of each message will be presented in 1612 detail in the following sections. 1614 7.4. Handshake Protocol 1616 The TLS Handshake Protocol is one of the defined higher-level clients 1617 of the TLS Record Protocol. This protocol is used to negotiate the 1618 secure attributes of a session. Handshake messages are supplied to 1619 the TLS Record Layer, where they are encapsulated within one or more 1620 TLSPlaintext structures, which are processed and transmitted as 1621 specified by the current active session state. 1623 enum { 1624 hello_request(0), client_hello(1), server_hello(2), 1625 certificate(11), server_key_exchange (12), 1626 certificate_request(13), server_hello_done(14), 1627 certificate_verify(15), client_key_exchange(16), 1628 finished(20), (255) 1629 } HandshakeType; 1631 struct { 1632 HandshakeType msg_type; /* handshake type */ 1633 uint24 length; /* bytes in message */ 1634 select (HandshakeType) { 1635 case hello_request: HelloRequest; 1636 case client_hello: ClientHello; 1637 case server_hello: ServerHello; 1638 case certificate: Certificate; 1639 case server_key_exchange: ServerKeyExchange; 1640 case certificate_request: CertificateRequest; 1641 case server_hello_done: ServerHelloDone; 1642 case certificate_verify: CertificateVerify; 1643 case client_key_exchange: ClientKeyExchange; 1644 case finished: Finished; 1645 } body; 1646 } Handshake; 1648 The handshake protocol messages are presented below in the order they 1649 MUST be sent; sending handshake messages in an unexpected order 1650 results in a fatal error. Unneeded handshake messages can be omitted, 1651 however. Note one exception to the ordering: the Certificate message 1652 is used twice in the handshake (from server to client, then from 1653 client to server), but described only in its first position. The one 1654 message that is not bound by these ordering rules is the Hello 1655 Request message, which can be sent at any time, but which should be 1656 ignored by the client if it arrives in the middle of a handshake. 1658 New Handshake message types are assigned by IANA as described in 1659 Section 12. 1661 7.4.1. Hello Messages 1663 The hello phase messages are used to exchange security enhancement 1664 capabilities between the client and server. When a new session 1665 begins, the Record Layer's connection state encryption, hash, and 1666 compression algorithms are initialized to null. The current 1667 connection state is used for renegotiation messages. 1669 7.4.1.1. Hello Request 1671 When this message will be sent: 1672 The hello request message MAY be sent by the server at any time. 1674 Meaning of this message: 1676 Hello request is a simple notification that the client should 1677 begin the negotiation process anew by sending a client hello 1678 message when convenient. This message is not intended to 1679 establish which side is the client or server but merely to 1680 initiate a new negotiation. Servers SHOULD NOT send a 1681 HelloRequest immediately upon the client's initial connection. 1682 It is the client's job to send a ClientHello at that time. 1684 This message will be ignored by the client if the client is 1685 currently negotiating a session. This message may be ignored by 1686 the client if it does not wish to renegotiate a session, or the 1687 client may, if it wishes, respond with a no_renegotiation alert. 1688 Since handshake messages are intended to have transmission 1689 precedence over application data, it is expected that the 1690 negotiation will begin before no more than a few records are 1691 received from the client. If the server sends a hello request but 1692 does not receive a client hello in response, it may close the 1693 connection with a fatal alert. 1695 After sending a hello request, servers SHOULD NOT repeat the request 1696 until the subsequent handshake negotiation is complete. 1698 Structure of this message: 1699 struct { } HelloRequest; 1701 Note: This message MUST NOT be included in the message hashes that are 1702 maintained throughout the handshake and used in the finished 1703 messages and the certificate verify message. 1705 7.4.1.2. Client Hello 1707 When this message will be sent: 1708 When a client first connects to a server it is required to send 1709 the client hello as its first message. The client can also send a 1710 client hello in response to a hello request or on its own 1711 initiative in order to renegotiate the security parameters in an 1712 existing connection. 1714 Structure of this message: 1715 The client hello message includes a random structure, which is 1716 used later in the protocol. 1718 struct { 1719 uint32 gmt_unix_time; 1720 opaque random_bytes[28]; 1721 } Random; 1723 gmt_unix_time 1724 The current time and date in standard UNIX 32-bit format (seconds 1725 since the midnight starting Jan 1, 1970, GMT, ignoring leap 1726 seconds) according to the sender's internal clock. Clocks are not 1727 required to be set correctly by the basic TLS Protocol; higher- 1728 level or application protocols may define additional 1729 requirements. 1731 random_bytes 1732 28 bytes generated by a secure random number generator. 1734 The client hello message includes a variable-length session 1735 identifier. If not empty, the value identifies a session between the 1736 same client and server whose security parameters the client wishes to 1737 reuse. The session identifier MAY be from an earlier connection, this 1738 connection, or from another currently active connection. The second 1739 option is useful if the client only wishes to update the random 1740 structures and derived values of a connection, and the third option 1741 makes it possible to establish several independent secure connections 1742 without repeating the full handshake protocol. These independent 1743 connections may occur sequentially or simultaneously; a SessionID 1744 becomes valid when the handshake negotiating it completes with the 1745 exchange of Finished messages and persists until it is removed due to 1746 aging or because a fatal error was encountered on a connection 1747 associated with the session. The actual contents of the SessionID are 1748 defined by the server. 1750 opaque SessionID<0..32>; 1752 Warning: 1753 Because the SessionID is transmitted without encryption or 1754 immediate MAC protection, servers MUST NOT place confidential 1755 information in session identifiers or let the contents of fake 1756 session identifiers cause any breach of security. (Note that the 1757 content of the handshake as a whole, including the SessionID, is 1758 protected by the Finished messages exchanged at the end of the 1759 handshake.) 1761 The CipherSuite list, passed from the client to the server in the 1762 client hello message, contains the combinations of cryptographic 1763 algorithms supported by the client in order of the client's 1764 preference (favorite choice first). Each CipherSuite defines a key 1765 exchange algorithm, a bulk encryption algorithm (including secret key 1766 length), a MAC algorithm, and a PRF. The server will select a cipher 1767 suite or, if no acceptable choices are presented, return a handshake 1768 failure alert and close the connection. 1770 uint8 CipherSuite[2]; /* Cryptographic suite selector */ 1771 The client hello includes a list of compression algorithms supported 1772 by the client, ordered according to the client's preference. 1774 enum { null(0), (255) } CompressionMethod; 1776 struct { 1777 ProtocolVersion client_version; 1778 Random random; 1779 SessionID session_id; 1780 CipherSuite cipher_suites<2..2^16-2>; 1781 CompressionMethod compression_methods<1..2^8-1>; 1782 select (extensions_present) { 1783 case false: 1784 struct {}; 1785 case true: 1786 Extension extensions<0..2^16-1>; 1787 }; 1788 } ClientHello; 1790 TLS allows extensions to follow the compression_methods field in an 1791 extensions block. The presence of extensions can be detected by 1792 determining whether there are bytes following the compression_methods 1793 at the end of the ClientHello. Note that this method of detecting 1794 optional data differs from the normal TLS method of having a 1795 variable-length field but is used for compatibility with TLS before 1796 extensions were defined. 1798 client_version 1799 The version of the TLS protocol by which the client wishes to 1800 communicate during this session. This SHOULD be the latest 1801 (highest valued) version supported by the client. For this 1802 version of the specification, the version will be 3.3 (See 1803 Appendix E for details about backward compatibility). 1805 random 1806 A client-generated random structure. 1808 session_id 1809 The ID of a session the client wishes to use for this connection. 1810 This field should be empty if no session_id is available, or it 1811 the client wishes to generate new security parameters. 1813 cipher_suites 1814 This is a list of the cryptographic options supported by the 1815 client, with the client's first preference first. If the 1816 session_id field is not empty (implying a session resumption 1817 request) this vector MUST include at least the cipher_suite from 1818 that session. Values are defined in Appendix A.5. 1820 compression_methods 1821 This is a list of the compression methods supported by the 1822 client, sorted by client preference. If the session_id field is 1823 not empty (implying a session resumption request) it MUST include 1824 the compression_method from that session. This vector MUST 1825 contain, and all implementations MUST support, 1826 CompressionMethod.null. Thus, a client and server will always be 1827 able to agree on a compression method. 1829 client_hello_extension_list 1830 Clients MAY request extended functionality from servers by 1831 sending data in the client_hello_extension_list. Here the new 1832 "client_hello_extension_list" field contains a list of 1833 extensions. The actual "Extension" format is defined in Section 1834 7.4.1.4. 1836 In the event that a client requests additional functionality using 1837 extensions, and this functionality is not supplied by the server, the 1838 client MAY abort the handshake. A server that supports the 1839 extensions mechanism MUST accept only client hello messages in either 1840 the original (TLS 1.0/TLS 1.1) ClientHello or the extended 1841 ClientHello format defined in this document, and (as for all other 1842 messages) MUST check that the amount of data in the message precisely 1843 matches one of these formats; if not then it MUST send a fatal 1844 "decode_error" alert. 1846 After sending the client hello message, the client waits for a server 1847 hello message. Any other handshake message returned by the server 1848 except for a hello request is treated as a fatal error. 1850 7.4.1.3. Server Hello 1852 When this message will be sent: 1853 The server will send this message in response to a client hello 1854 message when it was able to find an acceptable set of algorithms. 1855 If it cannot find such a match, it will respond with a handshake 1856 failure alert. 1858 Structure of this message: 1859 struct { 1860 ProtocolVersion server_version; 1861 Random random; 1862 SessionID session_id; 1863 CipherSuite cipher_suite; 1864 CompressionMethod compression_method; 1865 select (extensions_present) { 1866 case false: 1867 struct {}; 1868 case true: 1869 Extension extensions<0..2^16-1>; 1870 }; 1871 } ServerHello; 1873 The presence of extensions can be detected by determining whether 1874 there are bytes following the compression_method field at the end of 1875 the ServerHello. 1877 server_version 1878 This field will contain the lower of that suggested by the client 1879 in the client hello and the highest supported by the server. For 1880 this version of the specification, the version is 3.3. (See 1881 Appendix E for details about backward compatibility.) 1883 random 1884 This structure is generated by the server and MUST be 1885 independently generated from the ClientHello.random. 1887 session_id 1888 This is the identity of the session corresponding to this 1889 connection. If the ClientHello.session_id was non-empty, the 1890 server will look in its session cache for a match. If a match is 1891 found and the server is willing to establish the new connection 1892 using the specified session state, the server will respond with 1893 the same value as was supplied by the client. This indicates a 1894 resumed session and dictates that the parties must proceed 1895 directly to the finished messages. Otherwise this field will 1896 contain a different value identifying the new session. The server 1897 may return an empty session_id to indicate that the session will 1898 not be cached and therefore cannot be resumed. If a session is 1899 resumed, it must be resumed using the same cipher suite it was 1900 originally negotiated with. Note that there is no requirement 1901 that the server resume any session even if it had formerly 1902 provided a session_id. Client MUST be prepared to do a full 1903 negotiation -- including negotiating new cipher suites -- during 1904 any handshake. 1906 cipher_suite 1907 The single cipher suite selected by the server from the list in 1908 ClientHello.cipher_suites. For resumed sessions, this field is 1909 the value from the state of the session being resumed. 1911 compression_method 1912 The single compression algorithm selected by the server from the 1913 list in ClientHello.compression_methods. For resumed sessions 1914 this field is the value from the resumed session state. 1916 server_hello_extension_list 1917 A list of extensions. Note that only extensions offered by the 1918 client can appear in the server's list. 1920 7.4.1.4 Hello Extensions 1922 The extension format is: 1924 struct { 1925 ExtensionType extension_type; 1926 opaque extension_data<0..2^16-1>; 1927 } Extension; 1929 enum { 1930 signature_hash_types(TBD-BY-IANA), (65535) 1931 } ExtensionType; 1933 Here: 1935 - "extension_type" identifies the particular extension type. 1937 - "extension_data" contains information specific to the particular 1938 extension type. 1940 The initial set of extensions is defined in a companion document 1941 [TLSEXT]. The list of extension types is maintained by IANA as 1942 described in Section 12. 1944 There are subtle (and not so subtle) interactions that may occur in 1945 this protocol between new features and existing features which may 1946 result in a significant reduction in overall security, The following 1947 considerations should be taken into account when designing new 1948 extensions: 1950 - Some cases where a server does not agree to an extension are 1951 error 1952 conditions, and some simply a refusal to support a particular 1953 feature. In general error alerts should be used for the former, 1954 and a field in the server extension response for the latter. 1956 - Extensions should as far as possible be designed to prevent any 1957 attack that forces use (or non-use) of a particular feature by 1958 manipulation of handshake messages. This principle should be 1959 followed regardless of whether the feature is believed to cause a 1960 security problem. 1962 Often the fact that the extension fields are included in the 1963 inputs to the Finished message hashes will be sufficient, but 1964 extreme care is needed when the extension changes the meaning of 1965 messages sent in the handshake phase. Designers and implementors 1966 should be aware of the fact that until the handshake has been 1967 authenticated, active attackers can modify messages and insert, 1968 remove, or replace extensions. 1970 - It would be technically possible to use extensions to change 1971 major aspects of the design of TLS; for example the design of 1972 cipher suite negotiation. This is not recommended; it would be 1973 more appropriate to define a new version of TLS - particularly 1974 since the TLS handshake algorithms have specific protection 1975 against version rollback attacks based on the version number, and 1976 the possibility of version rollback should be a significant 1977 consideration in any major design change. 1979 7.4.1.4.1 Cert Hash Types 1981 The client MAY use the "signature_hash_types" to indicate to the 1982 server which hash functions may be used in digital signatures. 1983 The "extension_data" field of this extension contains: 1985 enum{ 1986 md5(0), sha1(1), sha256(2), sha384(3), sha512(4), (255) 1987 } HashType; 1989 struct { 1990 HashType types<1..255>; 1991 } SignatureHashTypes; 1993 These values indicate support for MD5 [MD5], SHA-1, SHA-256, SHA-384, 1994 and SHA-512 [SHA] respectively. The server MUST NOT send this 1995 extension. The values are indicated in descending order of 1996 preference. 1998 Clients SHOULD send this extension if they support any algorithm 1999 other than SHA-1. If this extension is not used, servers SHOULD 2000 assume that the client supports only SHA-1. Note: this is a change 2001 from TLS 1.1 where there are no explicit rules but as a practical 2002 matter one can assume that the peer supports MD5 and SHA-1. 2004 7.4.2. Server Certificate 2006 When this message will be sent: 2007 The server MUST send a certificate whenever the agreed-upon key 2008 exchange method uses certificates for authentication (this 2009 includes all key exchange methods defined in this document except 2010 DH_anon). This message will always immediately follow the server 2011 hello message. 2013 Meaning of this message: 2014 The certificate type MUST be appropriate for the selected cipher 2015 suite's key exchange algorithm, and is generally an X.509v3 2016 certificate. It MUST contain a key that matches the key exchange 2017 method, as follows. Unless otherwise specified, the signing 2018 algorithm for the certificate MUST be the same as the algorithm 2019 for the certificate key. Unless otherwise specified, the public 2020 key MAY be of any length. 2022 Key Exchange Algorithm Certificate Key Type 2024 RSA RSA public key; the certificate MUST 2025 allow the key to be used for encryption. 2027 DHE_DSS DSS public key. 2029 DHE_RSA RSA public key that can be used for 2030 signing. 2032 DH_DSS Diffie-Hellman key. The algorithm used 2033 to sign the certificate MUST be DSS. 2035 DH_RSA Diffie-Hellman key. The algorithm used 2036 to sign the certificate MUST be RSA. 2038 All certificate profiles and key and cryptographic formats are 2039 defined by the IETF PKIX working group [PKIX]. When a key usage 2040 extension is present, the digitalSignature bit MUST be set for the 2041 key to be eligible for signing, as described above, and the 2042 keyEncipherment bit MUST be present to allow encryption, as described 2043 above. The keyAgreement bit must be set on Diffie-Hellman 2044 certificates. 2046 As CipherSuites that specify new key exchange methods are specified 2047 for the TLS Protocol, they will imply certificate format and the 2048 required encoded keying information. 2050 Structure of this message: 2051 opaque ASN.1Cert<1..2^24-1>; 2053 struct { 2054 ASN.1Cert certificate_list<0..2^24-1>; 2055 } Certificate; 2057 certificate_list 2058 This is a sequence (chain) of X.509v3 certificates. The sender's 2059 certificate must come first in the list. Each following 2060 certificate must directly certify the one preceding it. Because 2061 certificate validation requires that root keys be distributed 2062 independently, the self-signed certificate that specifies the 2063 root certificate authority may optionally be omitted from the 2064 chain, under the assumption that the remote end must already 2065 possess it in order to validate it in any case. 2067 The same message type and structure will be used for the client's 2068 response to a certificate request message. Note that a client MAY 2069 send no certificates if it does not have an appropriate certificate 2070 to send in response to the server's authentication request. 2072 Note: PKCS #7 [PKCS7] is not used as the format for the certificate 2073 vector because PKCS #6 [PKCS6] extended certificates are not 2074 used. Also, PKCS #7 defines a SET rather than a SEQUENCE, making 2075 the task of parsing the list more difficult. 2077 7.4.3. Server Key Exchange Message 2079 When this message will be sent: 2080 This message will be sent immediately after the server 2081 certificate message (or the server hello message, if this is an 2082 anonymous negotiation). 2084 The server key exchange message is sent by the server only when 2085 the server certificate message (if sent) does not contain enough 2086 data to allow the client to exchange a premaster secret. This is 2087 true for the following key exchange methods: 2089 DHE_DSS 2090 DHE_RSA 2091 DH_anon 2093 It is not legal to send the server key exchange message for the 2094 following key exchange methods: 2096 RSA 2097 DH_DSS 2098 DH_RSA 2100 Meaning of this message: 2101 This message conveys cryptographic information to allow the 2102 client to communicate the premaster secret: a Diffie-Hellman 2103 public key with which the client can complete a key exchange 2104 (with the result being the premaster secret) or a public key for 2105 some other algorithm. 2107 As additional CipherSuites are defined for TLS that include new key 2108 exchange algorithms, the server key exchange message will be sent if 2109 and only if the certificate type associated with the key exchange 2110 algorithm does not provide enough information for the client to 2111 exchange a premaster secret. 2113 If the client has offered the SignatureHashTypes extension, the hash 2114 function MUST be one of those listed in that extension. Otherwise it 2115 MUST be assumed that only SHA-1 is supported. 2117 If the SignatureAlgorithm being used to sign the ServerKeyExchange 2118 message is DSA, the hash algorithm MUST be SHA-1. [TODO: This is 2119 incorrect. What it should say is that it must be specified in the 2120 SPKI of the cert. However, I don't believe this is actually defined. 2121 Rather, the DSA certs just say dsa. We need new certs to say 2122 dsaWithSHAXXX.] 2124 If the SignatureAlgorithm is RSA, then any hash function accepted by 2125 the client MAY be used. The selected hash function MUST be indicated 2126 in the digest_algorithm field of the signature structure. 2128 The hash algorithm is denoted Hash below. Hash.length is the length 2129 of the output of that algorithm. 2131 Structure of this message: 2132 enum { diffie_hellman, rsa} KeyExchangeAlgorithm; 2134 struct { 2135 opaque dh_p<1..2^16-1>; 2136 opaque dh_g<1..2^16-1>; 2137 opaque dh_Ys<1..2^16-1>; 2138 } ServerDHParams; /* Ephemeral DH parameters */ 2140 dh_p 2141 The prime modulus used for the Diffie-Hellman operation. 2143 dh_g 2144 The generator used for the Diffie-Hellman operation. 2146 dh_Ys 2147 The server's Diffie-Hellman public value (g^X mod p). 2149 struct { 2150 select (KeyExchangeAlgorithm) { 2151 case diffie_hellman: 2152 ServerDHParams params; 2153 Signature signed_params; 2154 }; 2155 } ServerKeyExchange; 2157 struct { 2158 select (KeyExchangeAlgorithm) { 2159 case diffie_hellman: 2160 ServerDHParams params; 2161 }; 2162 } ServerParams; 2164 params 2165 The server's key exchange parameters. 2167 signed_params 2168 For non-anonymous key exchanges, a hash of the corresponding 2169 params value, with the signature appropriate to that hash 2170 applied. 2172 hash 2173 Hash(ClientHello.random + ServerHello.random + ServerParams) 2175 sha_hash 2176 SHA1(ClientHello.random + ServerHello.random + ServerParams) 2178 enum { anonymous, rsa, dsa } SignatureAlgorithm; 2180 struct { 2181 select (SignatureAlgorithm) { 2182 case anonymous: struct { }; 2183 case rsa: 2184 HashType digest_algorithm; // NEW 2185 digitally-signed struct { 2186 opaque hash[Hash.length]; 2187 }; 2188 case dsa: 2189 digitally-signed struct { 2190 opaque sha_hash[20]; 2191 }; 2192 }; 2193 }; 2194 } Signature; 2196 7.4.4. Certificate Request 2198 When this message will be sent: 2199 A non-anonymous server can optionally request a certificate from 2200 the client, if appropriate for the selected cipher suite. This 2201 message, if sent, will immediately follow the Server Key Exchange 2202 message (if it is sent; otherwise, the Server Certificate 2203 message). 2205 Structure of this message: 2206 enum { 2207 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 2208 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 2209 fortezza_dms_RESERVED(20), 2210 (255) 2211 } ClientCertificateType; 2213 opaque DistinguishedName<1..2^16-1>; 2215 struct { 2216 ClientCertificateType certificate_types<1..2^8-1>; 2217 HashType certificate_hash<1..2^8-1>; 2218 DistinguishedName certificate_authorities<0..2^16-1>; 2219 } CertificateRequest; 2221 certificate_types 2222 This field is a list of the types of certificates requested, 2223 sorted in order of the server's preference. 2225 certificate_types 2226 A list of the types of certificate types which the client may 2227 offer. 2228 rsa_sign a certificate containing an RSA key 2229 dss_sign a certificate containing a DSS key 2230 rsa_fixed_dh a certificate signed with RSA and containing 2231 a static DH key. 2232 dss_fixed_dh a certificate signed with DSS and containing 2233 a static DH key 2235 Certificate types rsa_sign and dss_sign SHOULD contain 2236 certificates signed with the same algorithm. However, this is 2237 not required. This is a holdover from TLS 1.0 and 1.1. 2239 certificate_hash 2240 A list of acceptable hash algorithms to be used in signatures 2241 in both the client certificate and the CertificateVerify. 2242 These algorithms are listed in descending order of 2243 preference. 2245 certificate_authorities 2246 A list of the distinguished names [X501] of acceptable 2247 certificateauthorities, represented in DER-encoded format. 2248 These distinguished names may specify a desired distinguished 2249 name for a root CA or for a subordinate CA; thus, this 2250 message can be used both to describe known roots and a 2251 desired authorization space. If the certificate_authorities 2252 list is empty then the client MAY send any certificate of the 2253 appropriate ClientCertificateType, unless there is some 2254 external arrangement to the contrary. 2256 New ClientCertificateType values are assigned by IANA as described in 2257 Section 12. 2259 Note: Values listed as RESERVED may not be used. They were 2260 used in SSLv3. 2262 Note: It is a fatal handshake_failure alert for an anonymous server to 2263 request client authentication. 2265 7.4.5 Server hello done 2267 When this message will be sent: 2268 The server hello done message is sent by the server to indicate 2269 the end of the server hello and associated messages. After 2270 sending this message, the server will wait for a client response. 2272 Meaning of this message: 2273 This message means that the server is done sending messages to 2274 support the key exchange, and the client can proceed with its 2275 phase of the key exchange. 2277 Upon receipt of the server hello done message, the client SHOULD 2278 verify that the server provided a valid certificate, if required 2279 and check that the server hello parameters are acceptable. 2281 Structure of this message: 2282 struct { } ServerHelloDone; 2284 7.4.6. Client Certificate 2286 When this message will be sent: 2287 This is the first message the client can send after receiving a 2288 server hello done message. This message is only sent if the 2289 server requests a certificate. If no suitable certificate is 2290 available, the client MUST send a certificate message containing 2291 no certificates. That is, the certificate_list structure has a 2292 length of zero. If client authentication is required by the 2293 server for the handshake to continue, it may respond with a fatal 2294 handshake failure alert. Client certificates are sent using the 2295 Certificate structure defined in Section 7.4.2. 2297 Note: When using a static Diffie-Hellman based key exchange method 2298 (DH_DSS or DH_RSA), if client authentication is requested, the 2299 Diffie-Hellman group and generator encoded in the client's 2300 certificate MUST match the server specified Diffie-Hellman 2301 parameters if the client's parameters are to be used for the key 2302 exchange. 2304 7.4.7. Client Key Exchange Message 2306 When this message will be sent: 2307 This message is always sent by the client. It MUST immediately 2308 follow the client certificate message, if it is sent. Otherwise 2309 it MUST be the first message sent by the client after it receives 2310 the server hello done message. 2312 Meaning of this message: 2313 With this message, the premaster secret is set, either though 2314 direct transmission of the RSA-encrypted secret, or by the 2315 transmission of Diffie-Hellman parameters that will allow each 2316 side to agree upon the same premaster secret. When the key 2317 exchange method is DH_RSA or DH_DSS, client certification has 2318 been requested, and the client was able to respond with a 2319 certificate that contained a Diffie-Hellman public key whose 2320 parameters (group and generator) matched those specified by the 2321 server in its certificate, this message MUST NOT contain any 2322 data. 2324 Structure of this message: 2325 The choice of messages depends on which key exchange method has 2326 been selected. See Section 7.4.3 for the KeyExchangeAlgorithm 2327 definition. 2329 struct { 2330 select (KeyExchangeAlgorithm) { 2331 case rsa: EncryptedPreMasterSecret; 2332 case diffie_hellman: ClientDiffieHellmanPublic; 2333 } exchange_keys; 2334 } ClientKeyExchange; 2336 7.4.7.1. RSA Encrypted Premaster Secret Message 2338 Meaning of this message: 2339 If RSA is being used for key agreement and authentication, the 2340 client generates a 48-byte premaster secret, encrypts it using 2341 the public key from the server's certificate and sends the result 2342 in an encrypted premaster secret message. This structure is a 2343 variant of the client key exchange message and is not a message 2344 in itself. 2346 Structure of this message: 2347 struct { 2348 ProtocolVersion client_version; 2349 opaque random[46]; 2350 } PreMasterSecret; 2352 client_version 2353 The latest (newest) version supported by the client. This is 2354 used to detect version roll-back attacks. 2356 random 2357 46 securely-generated random bytes. 2359 struct { 2360 public-key-encrypted PreMasterSecret pre_master_secret; 2361 } EncryptedPreMasterSecret; 2363 pre_master_secret 2364 This random value is generated by the client and is used to 2365 generate the master secret, as specified in Section 8.1. 2367 Note: The version number in the PreMasterSecret is the version offered 2368 by the client in the ClientHello.client_version, not the 2369 version negotiated for the connection. This feature is 2370 designed to prevent rollback attacks. Unfortunately, some 2371 old implementations use the negotiated version instead and 2372 therefore checking the version number may lead to failure to 2373 interoperate with such incorrect client implementations. 2375 Client implementations MUST always send the correct version 2376 number in PreMasterSecret. If ClientHello.client_version is 2377 TLS 1.1 or higher, server implementations MUST check the 2378 version number as described in the note below. If the version 2379 number is earlier than 1.0, server implementations SHOULD 2380 check the version number, but MAY have a configuration option 2381 to disable the check. Note that if the check fails, the 2382 PreMasterSecret SHOULD be randomized as described below. 2384 Note: Attacks discovered by Bleichenbacher [BLEI] and Klima et al. 2385 [KPR03] can be used to attack a TLS server that reveals whether a 2386 particular message, when decrypted, is properly PKCS#1 formatted, 2387 contains a valid PreMasterSecret structure, or has the correct 2388 version number. 2390 The best way to avoid these vulnerabilities is to treat incorrectly 2391 formatted messages in a manner indistinguishable from correctly 2392 formatted RSA blocks. In other words: 2394 1. Generate a string R of 46 random bytes 2396 2. Decrypt the message M 2398 3. If the PKCS#1 padding is not correct, or the length of 2399 message M is not exactly 48 bytes: 2400 premaster secret = ClientHello.client_version || R 2401 else If ClientHello.client_version <= TLS 1.0, and 2402 version number check is explicitly disabled: 2403 premaster secret = M 2404 else: 2405 premaster secret = ClientHello.client_version || M[2..47] 2407 In any case, a TLS server MUST NOT generate an alert if processing an 2408 RSA-encrypted premaster secret message fails, or the version number 2409 is not as expected. Instead, it MUST continue the handshake with a 2410 randomly generated premaster secret. It may be useful to log the 2411 real cause of failure for troubleshooting purposes; however, care 2412 must be taken to avoid leaking the information to an attacker 2413 (though, e.g., timing, log files, or other channels.) 2415 The RSAES-OAEP encryption scheme defined in [PKCS1] is more secure 2416 against the Bleichenbacher attack. However, for maximal compatibility 2417 with earlier versions of TLS, this specification uses the RSAES- 2418 PKCS1-v1_5 scheme. No variants of the Bleichenbacher attack are known 2419 to exist provided that the above recommendations are followed. 2421 Implementation Note: Public-key-encrypted data is represented as an 2422 opaque vector <0..2^16-1> (see Section 4.7). Thus, the RSA-encrypted 2423 PreMasterSecret in a ClientKeyExchange is preceded by two length 2424 bytes. These bytes are redundant in the case of RSA because the 2425 EncryptedPreMasterSecret is the only data in the ClientKeyExchange 2426 and its length can therefore be unambiguously determined. The SSLv3 2427 specification was not clear about the encoding of public-key- 2428 encrypted data, and therefore many SSLv3 implementations do not 2429 include the the length bytes, encoding the RSA encrypted data 2430 directly in the ClientKeyExchange message. 2432 This specification requires correct encoding of the 2433 EncryptedPreMasterSecret complete with length bytes. The resulting 2434 PDU is incompatible with many SSLv3 implementations. Implementors 2435 upgrading from SSLv3 MUST modify their implementations to generate 2436 and accept the correct encoding. Implementors who wish to be 2437 compatible with both SSLv3 and TLS should make their implementation's 2438 behavior dependent on the protocol version. 2440 Implementation Note: It is now known that remote timing-based attacks 2441 on TLS are possible, at least when the client and server are on the 2442 same LAN. Accordingly, implementations that use static RSA keys MUST 2443 use RSA blinding or some other anti-timing technique, as described in 2444 [TIMING]. 2446 7.4.7.2. Client Diffie-Hellman Public Value 2448 Meaning of this message: 2449 This structure conveys the client's Diffie-Hellman public value 2450 (Yc) if it was not already included in the client's certificate. 2451 The encoding used for Yc is determined by the enumerated 2452 PublicValueEncoding. This structure is a variant of the client 2453 key exchange message, and not a message in itself. 2455 Structure of this message: 2456 enum { implicit, explicit } PublicValueEncoding; 2458 implicit 2459 If the client certificate already contains a suitable Diffie- 2460 Hellman key, then Yc is implicit and does not need to be sent 2461 again. In this case, the client key exchange message will be 2462 sent, but it MUST be empty. 2464 explicit 2465 Yc needs to be sent. 2467 struct { 2468 select (PublicValueEncoding) { 2469 case implicit: struct { }; 2470 case explicit: opaque dh_Yc<1..2^16-1>; 2471 } dh_public; 2472 } ClientDiffieHellmanPublic; 2474 dh_Yc 2475 The client's Diffie-Hellman public value (Yc). 2477 7.4.8. Certificate verify 2479 When this message will be sent: 2480 This message is used to provide explicit verification of a client 2481 certificate. This message is only sent following a client 2482 certificate that has signing capability (i.e. all certificates 2483 except those containing fixed Diffie-Hellman parameters). When 2484 sent, it MUST immediately follow the client key exchange message. 2486 Structure of this message: 2487 struct { 2488 Signature signature; 2489 } CertificateVerify; 2491 The Signature type is defined in 7.4.3. 2493 The hash function MUST be one of the algorithms offered in the 2494 CertificateRequest message. 2496 If the SignatureAlgorithm being used to sign the ServerKeyExchange 2497 message is DSA, the hash function used MUST be SHA-1. 2498 [TODO: This is incorrect. What it should say is that it must 2499 be specified in the SPKI of the cert. However, I don't believe 2500 this is actually defined. Rather, the DSA certs just say 2501 dsa. We need new certs to say dsaWithSHAXXX] 2503 If the SignatureAlgorithm is RSA, then any of the functions offered 2504 by the server may be used. The selected hash function MUST be 2505 indicated in the digest_algorithm field of the signature structure. 2507 The hash algorithm is denoted Hash below. 2509 CertificateVerify.signature.hash 2510 Hash(handshake_messages); 2512 CertificateVerify.signature.sha_hash 2513 SHA(handshake_messages); 2515 Here handshake_messages refers to all handshake messages sent or 2516 received starting at client hello up to but not including this 2517 message, including the type and length fields of the handshake 2518 messages. This is the concatenation of all the Handshake structures 2519 as defined in 7.4 exchanged thus far. 2521 7.4.9. Finished 2523 When this message will be sent: 2524 A finished message is always sent immediately after a change 2525 cipher spec message to verify that the key exchange and 2526 authentication processes were successful. It is essential that a 2527 change cipher spec message be received between the other 2528 handshake messages and the Finished message. 2530 Meaning of this message: 2531 The finished message is the first protected with the just- 2532 negotiated algorithms, keys, and secrets. Recipients of finished 2533 messages MUST verify that the contents are correct. Once a side 2534 has sent its Finished message and received and validated the 2535 Finished message from its peer, it may begin to send and receive 2536 application data over the connection. 2538 struct { 2539 opaque verify_data[SecurityParameters.verify_data_length]; 2540 } Finished; 2542 verify_data 2543 PRF(master_secret, finished_label, Hash(handshake_messages)) 2544 [0..SecurityParameters.verify_data_length-1]; 2546 finished_label 2547 For Finished messages sent by the client, the string "client 2548 finished". For Finished messages sent by the server, the 2549 string "server finished". 2551 Hash denotes the negotiated hash used for the PRF. If a new 2552 PRF is defined, then this hash MUST be specified. 2554 In previous versions of TLS, the verify_data was always 12 2555 octets long. In the current version of TLS, it depends on the 2556 cipher suite. Any cipher suite which does not explicitly 2557 specify SecurityParameters.verify_data_length has a 2558 SecurityParameters.verify_data_length equal to 12. This 2559 includes all existing cipher suites. Note that this 2560 representation has the same encoding as with previous 2561 versions. 2563 Future cipher suites MAY specify other lengths but such 2564 length MUST be at least 12 bytes. 2566 handshake_messages 2567 All of the data from all messages in this handshake (not 2568 including any HelloRequest messages) up to but not including 2569 this message. This is only data visible at the handshake 2570 layer and does not include record layer headers. This is the 2571 concatenation of all the Handshake structures as defined in 2572 7.4, exchanged thus far. 2574 It is a fatal error if a finished message is not preceded by a change 2575 cipher spec message at the appropriate point in the handshake. 2577 The value handshake_messages includes all handshake messages starting 2578 at client hello up to, but not including, this finished message. This 2579 may be different from handshake_messages in Section 7.4.8 because it 2580 would include the certificate verify message (if sent). Also, the 2581 handshake_messages for the finished message sent by the client will 2582 be different from that for the finished message sent by the server, 2583 because the one that is sent second will include the prior one. 2585 Note: Change cipher spec messages, alerts, and any other record types 2586 are not handshake messages and are not included in the hash 2587 computations. Also, Hello Request messages are omitted from 2588 handshake hashes. 2590 8. Cryptographic Computations 2592 In order to begin connection protection, the TLS Record Protocol 2593 requires specification of a suite of algorithms, a master secret, and 2594 the client and server random values. The authentication, encryption, 2595 and MAC algorithms are determined by the cipher_suite selected by the 2596 server and revealed in the server hello message. The compression 2597 algorithm is negotiated in the hello messages, and the random values 2598 are exchanged in the hello messages. All that remains is to calculate 2599 the master secret. 2601 8.1. Computing the Master Secret 2603 For all key exchange methods, the same algorithm is used to convert 2604 the pre_master_secret into the master_secret. The pre_master_secret 2605 should be deleted from memory once the master_secret has been 2606 computed. 2608 master_secret = PRF(pre_master_secret, "master secret", 2609 ClientHello.random + ServerHello.random) 2610 [0..47]; 2612 The master secret is always exactly 48 bytes in length. The length of 2613 the premaster secret will vary depending on key exchange method. 2615 8.1.1. RSA 2617 When RSA is used for server authentication and key exchange, a 2618 48-byte pre_master_secret is generated by the client, encrypted under 2619 the server's public key, and sent to the server. The server uses its 2620 private key to decrypt the pre_master_secret. Both parties then 2621 convert the pre_master_secret into the master_secret, as specified 2622 above. 2624 8.1.2. Diffie-Hellman 2626 A conventional Diffie-Hellman computation is performed. The 2627 negotiated key (Z) is used as the pre_master_secret, and is converted 2628 into the master_secret, as specified above. Leading bytes of Z that 2629 contain all zero bits are stripped before it is used as the 2630 pre_master_secret. 2632 Note: Diffie-Hellman parameters are specified by the server and may 2633 be either ephemeral or contained within the server's certificate. 2635 9. Mandatory Cipher Suites 2637 In the absence of an application profile standard specifying 2638 otherwise, a TLS compliant application MUST implement the cipher 2639 suite TLS_RSA_WITH_AES_128_CBC_SHA. 2641 10. Application Data Protocol 2643 Application data messages are carried by the Record Layer and are 2644 fragmented, compressed, and encrypted based on the current connection 2645 state. The messages are treated as transparent data to the record 2646 layer. 2648 11. Security Considerations 2650 Security issues are discussed throughout this memo, especially in 2651 Appendices D, E, and F. 2653 12. IANA Considerations 2655 This document uses several registries that were originally created in 2656 [RFC4346]. IANA is requested to update (has updated) these to 2657 reference this document. The registries and their allocation policies 2658 (unchanged from [TLS1.1]) are listed below. 2660 o TLS ClientCertificateType Identifiers Registry: Future 2661 values in the range 0-63 (decimal) inclusive are assigned via 2662 Standards Action [RFC2434]. Values in the range 64-223 2663 (decimal) inclusive are assigned Specification Required 2664 [RFC2434]. Values from 224-255 (decimal) inclusive are 2665 reserved for Private Use [RFC2434]. 2667 o TLS Cipher Suite Registry: Future values with the first byte 2668 in the range 0-191 (decimal) inclusive are assigned via 2669 Standards Action [RFC2434]. Values with the first byte in 2670 the range 192-254 (decimal) are assigned via Specification 2671 Required [RFC2434]. Values with the first byte 255 (decimal) 2672 are reserved for Private Use [RFC2434]. 2674 o TLS ContentType Registry: Future values are allocated via 2675 Standards Action [RFC2434]. 2677 o TLS Alert Registry: Future values are allocated via 2678 Standards Action [RFC2434]. 2680 o TLS HandshakeType Registry: Future values are allocated via 2681 Standards Action [RFC2434]. 2683 This document also uses a registry originally created in [RFC4366]. 2684 IANA is requested to update (has updated) it to reference this 2685 document. The registry and its allocation policy (unchanged from 2686 [RFC4366]) is listed below:. 2688 o TLS ExtensionType Registry: Future values are allocated 2689 via IETF Consensus [RFC2434] 2691 In addition, this document defines one new registry to be maintained 2692 by IANA: 2694 o TLS HashType Registry: The registry will be initially 2695 populated with the values described in Section 7.4.1.4.7. 2696 Future values in the range 0-63 (decimal) inclusive are 2697 assigned via Standards Action [RFC2434]. Values in the 2698 range 64-223 (decimal) inclusive are assigned via 2699 Specification Required [RFC2434]. Values from 224-255 2700 (decimal) inclusive are reserved for Private Use [RFC2434]. 2702 This document defines one new TLS extension, cert_hash_type, which is 2703 to be (has been) allocated value TBD-BY-IANA in the TLS ExtensionType 2704 registry. 2706 This document also uses the TLS Compression Method Identifiers 2707 Registry, defined in [RFC3749]. IANA is requested to allocate value 2708 0 for the "null" compression method. 2710 Appendix A. Protocol Constant Values 2712 This section describes protocol types and constants. 2714 A.1. Record Layer 2716 struct { 2717 uint8 major, minor; 2718 } ProtocolVersion; 2720 ProtocolVersion version = { 3, 3 }; /* TLS v1.2*/ 2722 enum { 2723 change_cipher_spec(20), alert(21), handshake(22), 2724 application_data(23), (255) 2725 } ContentType; 2727 struct { 2728 ContentType type; 2729 ProtocolVersion version; 2730 uint16 length; 2731 opaque fragment[TLSPlaintext.length]; 2732 } TLSPlaintext; 2734 struct { 2735 ContentType type; 2736 ProtocolVersion version; 2737 uint16 length; 2738 opaque fragment[TLSCompressed.length]; 2739 } TLSCompressed; 2741 struct { 2742 ContentType type; 2743 ProtocolVersion version; 2744 uint16 length; 2745 select (SecurityParameters.cipher_type) { 2746 case stream: GenericStreamCipher; 2747 case block: GenericBlockCipher; 2748 case aead: GenericAEADCipher; 2749 } fragment; 2750 } TLSCiphertext; 2752 stream-ciphered struct { 2753 opaque content[TLSCompressed.length]; 2754 opaque MAC[SecurityParameters.mac_length]; 2755 } GenericStreamCipher; 2757 struct { 2758 opaque IV[SecurityParameters.record_iv_length]; 2759 block-ciphered struct { 2760 opaque content[TLSCompressed.length]; 2761 opaque MAC[SecurityParameters.mac_length]; 2762 uint8 padding[GenericBlockCipher.padding_length]; 2763 uint8 padding_length; 2764 }; 2765 } GenericBlockCipher; 2767 aead-ciphered struct { 2768 opaque IV[SecurityParameters.iv_length]; 2769 opaque aead_output[AEADEncrypted.length]; 2770 } GenericAEADCipher; 2772 A.2. Change Cipher Specs Message 2774 struct { 2775 enum { change_cipher_spec(1), (255) } type; 2776 } ChangeCipherSpec; 2778 A.3. Alert Messages 2780 enum { warning(1), fatal(2), (255) } AlertLevel; 2782 enum { 2783 close_notify(0), 2784 unexpected_message(10), 2785 bad_record_mac(20), 2786 decryption_failed_RESERVED(21), 2787 record_overflow(22), 2788 decompression_failure(30), 2789 handshake_failure(40), 2790 no_certificate_RESERVED(41), 2791 bad_certificate(42), 2792 unsupported_certificate(43), 2793 certificate_revoked(44), 2794 certificate_expired(45), 2795 certificate_unknown(46), 2796 illegal_parameter(47), 2797 unknown_ca(48), 2798 access_denied(49), 2799 decode_error(50), 2800 decrypt_error(51), 2801 export_restriction_RESERVED(60), 2802 protocol_version(70), 2803 insufficient_security(71), 2804 internal_error(80), 2805 user_canceled(90), 2806 no_renegotiation(100), 2807 unsupported_extension(110), /* new */ 2808 (255) 2809 } AlertDescription; 2811 struct { 2812 AlertLevel level; 2813 AlertDescription description; 2814 } Alert; 2815 A.4. Handshake Protocol 2817 enum { 2818 hello_request(0), client_hello(1), server_hello(2), 2819 certificate(11), server_key_exchange (12), 2820 certificate_request(13), server_hello_done(14), 2821 certificate_verify(15), client_key_exchange(16), 2822 finished(20) 2823 (255) 2824 } HandshakeType; 2826 struct { 2827 HandshakeType msg_type; 2828 uint24 length; 2829 select (HandshakeType) { 2830 case hello_request: HelloRequest; 2831 case client_hello: ClientHello; 2832 case server_hello: ServerHello; 2833 case certificate: Certificate; 2834 case server_key_exchange: ServerKeyExchange; 2835 case certificate_request: CertificateRequest; 2836 case server_hello_done: ServerHelloDone; 2837 case certificate_verify: CertificateVerify; 2838 case client_key_exchange: ClientKeyExchange; 2839 case finished: Finished; 2840 } body; 2841 } Handshake; 2843 A.4.1. Hello Messages 2845 struct { } HelloRequest; 2847 struct { 2848 uint32 gmt_unix_time; 2849 opaque random_bytes[28]; 2850 } Random; 2852 opaque SessionID<0..32>; 2854 uint8 CipherSuite[2]; 2856 enum { null(0), (255) } CompressionMethod; 2858 struct { 2859 ProtocolVersion client_version; 2860 Random random; 2861 SessionID session_id; 2862 CipherSuite cipher_suites<2..2^16-1>; 2863 CompressionMethod compression_methods<1..2^8-1>; 2864 select (extensions_present) { 2865 case false: 2866 struct {}; 2867 case true: 2868 Extension extensions<0..2^16-1>; 2869 }; 2870 } ClientHello; 2872 struct { 2873 ProtocolVersion server_version; 2874 Random random; 2875 SessionID session_id; 2876 CipherSuite cipher_suite; 2877 CompressionMethod compression_method; 2878 select (extensions_present) { 2879 case false: 2880 struct {}; 2881 case true: 2882 Extension extensions<0..2^16-1>; 2883 }; 2884 } ServerHello; 2886 struct { 2887 ExtensionType extension_type; 2888 opaque extension_data<0..2^16-1>; 2889 } Extension; 2891 enum { 2892 signature_hash_types(TBD-BY-IANA), (65535) 2893 } ExtensionType; 2895 A.4.2. Server Authentication and Key Exchange Messages 2897 opaque ASN.1Cert<2^24-1>; 2899 struct { 2900 ASN.1Cert certificate_list<0..2^24-1>; 2901 } Certificate; 2903 enum { diffie_hellman } KeyExchangeAlgorithm; 2905 struct { 2906 opaque dh_p<1..2^16-1>; 2907 opaque dh_g<1..2^16-1>; 2908 opaque dh_Ys<1..2^16-1>; 2909 } ServerDHParams; 2910 struct { 2911 select (KeyExchangeAlgorithm) { 2912 case diffie_hellman: 2913 ServerDHParams params; 2914 Signature signed_params; 2915 } 2916 } ServerKeyExchange; 2918 enum { anonymous, rsa, dsa } SignatureAlgorithm; 2920 struct { 2921 select (KeyExchangeAlgorithm) { 2922 case diffie_hellman: 2923 ServerDHParams params; 2924 }; 2925 } ServerParams; 2927 struct { 2928 select (SignatureAlgorithm) { 2929 case anonymous: struct { }; 2930 case rsa: 2931 HashType digest_algorithm; // NEW 2932 digitally-signed struct { 2933 opaque hash[Hash.length]; 2934 }; 2935 case dsa: 2936 digitally-signed struct { 2937 opaque sha_hash[20]; 2938 }; 2939 }; 2940 }; 2941 } Signature; 2943 enum { 2944 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 2945 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 2946 fortezza_dms_RESERVED(20), 2947 (255) 2948 } ClientCertificateType; 2950 opaque DistinguishedName<1..2^16-1>; 2952 struct { 2953 ClientCertificateType certificate_types<1..2^8-1>; 2954 DistinguishedName certificate_authorities<0..2^16-1>; 2955 } CertificateRequest; 2957 struct { } ServerHelloDone; 2958 A.4.3. Client Authentication and Key Exchange Messages 2960 struct { 2961 select (KeyExchangeAlgorithm) { 2962 case rsa: EncryptedPreMasterSecret; 2963 case diffie_hellman: ClientDiffieHellmanPublic; 2964 } exchange_keys; 2965 } ClientKeyExchange; 2967 struct { 2968 ProtocolVersion client_version; 2969 opaque random[46]; 2970 } PreMasterSecret; 2972 struct { 2973 public-key-encrypted PreMasterSecret pre_master_secret; 2974 } EncryptedPreMasterSecret; 2976 enum { implicit, explicit } PublicValueEncoding; 2978 struct { 2979 select (PublicValueEncoding) { 2980 case implicit: struct {}; 2981 case explicit: opaque DH_Yc<1..2^16-1>; 2982 } dh_public; 2983 } ClientDiffieHellmanPublic; 2985 struct { 2986 Signature signature; 2987 } CertificateVerify; 2989 A.4.4. Handshake Finalization Message 2991 struct { 2992 opaque verify_data[SecurityParameters.verify_data_length]; 2993 } Finished; 2995 A.5. The CipherSuite 2997 The following values define the CipherSuite codes used in the client 2998 hello and server hello messages. 3000 A CipherSuite defines a cipher specification supported in TLS Version 3001 1.2. 3003 TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a 3004 TLS connection during the first handshake on that channel, but MUST 3005 not be negotiated, as it provides no more protection than an 3006 unsecured connection. 3008 CipherSuite TLS_NULL_WITH_NULL_NULL = { 0x00,0x00 }; 3010 The following CipherSuite definitions require that the server provide 3011 an RSA certificate that can be used for key exchange. The server may 3012 request either an RSA or a DSS signature-capable certificate in the 3013 certificate request message. 3015 CipherSuite TLS_RSA_WITH_NULL_MD5 = { 0x00,0x01 }; 3016 CipherSuite TLS_RSA_WITH_NULL_SHA = { 0x00,0x02 }; 3017 CipherSuite TLS_RSA_WITH_RC4_128_MD5 = { 0x00,0x04 }; 3018 CipherSuite TLS_RSA_WITH_RC4_128_SHA = { 0x00,0x05 }; 3019 CipherSuite TLS_RSA_WITH_IDEA_CBC_SHA = { 0x00,0x07 }; 3020 CipherSuite TLS_RSA_WITH_DES_CBC_SHA = { 0x00,0x09 }; 3021 CipherSuite TLS_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0A }; 3022 CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x2F }; 3023 CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x35 }; 3025 The following CipherSuite definitions are used for server- 3026 authenticated (and optionally client-authenticated) Diffie-Hellman. 3027 DH denotes cipher suites in which the server's certificate contains 3028 the Diffie-Hellman parameters signed by the certificate authority 3029 (CA). DHE denotes ephemeral Diffie-Hellman, where the Diffie-Hellman 3030 parameters are signed by a DSS or RSA certificate, which has been 3031 signed by the CA. The signing algorithm used is specified after the 3032 DH or DHE parameter. The server can request an RSA or DSS signature- 3033 capable certificate from the client for client authentication or it 3034 may request a Diffie-Hellman certificate. Any Diffie-Hellman 3035 certificate provided by the client must use the parameters (group and 3036 generator) described by the server. 3038 CipherSuite TLS_DH_DSS_WITH_DES_CBC_SHA = { 0x00,0x0C }; 3039 CipherSuite TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0D }; 3040 CipherSuite TLS_DH_RSA_WITH_DES_CBC_SHA = { 0x00,0x0F }; 3041 CipherSuite TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x10 }; 3042 CipherSuite TLS_DHE_DSS_WITH_DES_CBC_SHA = { 0x00,0x12 }; 3043 CipherSuite TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x13 }; 3044 CipherSuite TLS_DHE_RSA_WITH_DES_CBC_SHA = { 0x00,0x15 }; 3045 CipherSuite TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x16 }; 3046 CipherSuite TLS_DH_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x30 }; 3047 CipherSuite TLS_DH_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x31 }; 3048 CipherSuite TLS_DHE_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x32 }; 3049 CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x33 }; 3050 CipherSuite TLS_DH_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x36 }; 3051 CipherSuite TLS_DH_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x37 }; 3052 CipherSuite TLS_DHE_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x38 }; 3053 CipherSuite TLS_DHE_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x39 }; 3054 The following cipher suites are used for completely anonymous Diffie- 3055 Hellman communications in which neither party is authenticated. Note 3056 that this mode is vulnerable to man-in-the-middle attacks. Using 3057 this mode therefore is of limited use: These ciphersuites MUST NOT be 3058 used by TLS 1.2 implementations unless the application layer has 3059 specifically requested to allow anonymous key exchange. (Anonymous 3060 key exchange may sometimes be acceptable, for example, to support 3061 opportunistic encryption when no set-up for authentication is in 3062 place, or when TLS is used as part of more complex security protocols 3063 that have other means to ensure authentication.) 3065 CipherSuite TLS_DH_anon_WITH_RC4_128_MD5 = { 0x00, 0x18 }; 3066 CipherSuite TLS_DH_anon_WITH_DES_CBC_SHA = { 0x00, 0x1A }; 3067 CipherSuite TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = { 0x00, 0x1B }; 3068 CipherSuite TLS_DH_anon_WITH_AES_128_CBC_SHA = { 0x00, 0x34 }; 3069 CipherSuite TLS_DH_anon_WITH_AES_256_CBC_SHA = { 0x00, 0x3A }; 3071 Note that using non-anonymous key exchange without actually verifying 3072 the key exchange is essentially equivalent to anonymous key exchange, 3073 and the same precautions apply. While non-anonymous key exchange 3074 will generally involve a higher computational and communicational 3075 cost than anonymous key exchange, it may be in the interest of 3076 interoperability not to disable non-anonymous key exchange when the 3077 application layer is allowing anonymous key exchange. 3079 When SSLv3 and TLS 1.0 were designed, the United States restricted 3080 the export of cryptographic software containing certain strong 3081 encryption algorithms. A series of cipher suites were designed to 3082 operate at reduced key lengths in order to comply with those 3083 regulations. Due to advances in computer performance, these 3084 algorithms are now unacceptably weak and export restrictions have 3085 since been loosened. TLS 1.2 implementations MUST NOT negotiate these 3086 cipher suites in TLS 1.2 mode. However, for backward compatibility 3087 they may be offered in the ClientHello for use with TLS 1.0 or SSLv3 3088 only servers. TLS 1.2 clients MUST check that the server did not 3089 choose one of these cipher suites during the handshake. These 3090 ciphersuites are listed below for informational purposes and to 3091 reserve the numbers. 3093 CipherSuite TLS_RSA_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x03 }; 3094 CipherSuite TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = { 0x00,0x06 }; 3095 CipherSuite TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x08 }; 3096 CipherSuite TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0B }; 3097 CipherSuite TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0E }; 3098 CipherSuite TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x11 }; 3099 CipherSuite TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x14 }; 3100 CipherSuite TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x17 }; 3101 CipherSuite TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x19 }; 3102 New cipher suite values are assigned by IANA as described in Section 3103 12. 3105 Note: The cipher suite values { 0x00, 0x1C } and { 0x00, 0x1D } are 3106 reserved to avoid collision with Fortezza-based cipher suites in SSL 3107 3. 3109 A.6. The Security Parameters 3111 These security parameters are determined by the TLS Handshake 3112 Protocol and provided as parameters to the TLS Record Layer in order 3113 to initialize a connection state. SecurityParameters includes: 3115 enum { null(0), (255) } CompressionMethod; 3117 enum { server, client } ConnectionEnd; 3119 enum { null, rc4, rc2, des, 3des, des40, aes, idea } 3120 BulkCipherAlgorithm; 3122 enum { stream, block, aead } CipherType; 3124 enum { null, md5, sha } MACAlgorithm; 3126 /* The algorithms specified in CompressionMethod, 3127 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 3129 struct { 3130 ConnectionEnd entity; 3131 BulkCipherAlgorithm bulk_cipher_algorithm; 3132 CipherType cipher_type; 3133 uint8 enc_key_length; 3134 uint8 block_length; 3135 uint8 fixed_iv_length; 3136 uint8 record_iv_length; 3137 MACAlgorithm mac_algorithm; 3138 uint8 mac_length; 3139 uint8 mac_key_length; 3140 uint8 verify_data_length; 3141 CompressionMethod compression_algorithm; 3142 opaque master_secret[48]; 3143 opaque client_random[32]; 3144 opaque server_random[32]; 3145 } SecurityParameters; 3146 Appendix B. Glossary 3148 Advanced Encryption Standard (AES) 3149 AES is a widely used symmetric encryption algorithm. AES is a 3150 block cipher with a 128, 192, or 256 bit keys and a 16 byte block 3151 size. [AES] TLS currently only supports the 128 and 256 bit key 3152 sizes. 3154 application protocol 3155 An application protocol is a protocol that normally layers 3156 directly on top of the transport layer (e.g., TCP/IP). Examples 3157 include HTTP, TELNET, FTP, and SMTP. 3159 asymmetric cipher 3160 See public key cryptography. 3162 authenticated encryption with additional data (AEAD) 3163 A symmetric encryption algorithm that simultaneously provides 3164 confidentiality and message integrity. 3166 authentication 3167 Authentication is the ability of one entity to determine the 3168 identity of another entity. 3170 block cipher 3171 A block cipher is an algorithm that operates on plaintext in 3172 groups of bits, called blocks. 64 bits is a common block size. 3174 bulk cipher 3175 A symmetric encryption algorithm used to encrypt large quantities 3176 of data. 3178 cipher block chaining (CBC) 3179 CBC is a mode in which every plaintext block encrypted with a 3180 block cipher is first exclusive-ORed with the previous ciphertext 3181 block (or, in the case of the first block, with the 3182 initialization vector). For decryption, every block is first 3183 decrypted, then exclusive-ORed with the previous ciphertext block 3184 (or IV). 3186 certificate 3187 As part of the X.509 protocol (a.k.a. ISO Authentication 3188 framework), certificates are assigned by a trusted Certificate 3189 Authority and provide a strong binding between a party's identity 3190 or some other attributes and its public key. 3192 client 3193 The application entity that initiates a TLS connection to a 3194 server. This may or may not imply that the client initiated the 3195 underlying transport connection. The primary operational 3196 difference between the server and client is that the server is 3197 generally authenticated, while the client is only optionally 3198 authenticated. 3200 client write key 3201 The key used to encrypt data written by the client. 3203 client write MAC secret 3204 The secret data used to authenticate data written by the client. 3206 connection 3207 A connection is a transport (in the OSI layering model 3208 definition) that provides a suitable type of service. For TLS, 3209 such connections are peer-to-peer relationships. The connections 3210 are transient. Every connection is associated with one session. 3212 Data Encryption Standard 3213 DES is a very widely used symmetric encryption algorithm. DES is 3214 a block cipher with a 56 bit key and an 8 byte block size. Note 3215 that in TLS, for key generation purposes, DES is treated as 3216 having an 8 byte key length (64 bits), but it still only provides 3217 56 bits of protection. (The low bit of each key byte is presumed 3218 to be set to produce odd parity in that key byte.) DES can also 3219 be operated in a mode where three independent keys and three 3220 encryptions are used for each block of data; this uses 168 bits 3221 of key (24 bytes in the TLS key generation method) and provides 3222 the equivalent of 112 bits of security. [DES], [3DES] 3224 Digital Signature Standard (DSS) 3225 A standard for digital signing, including the Digital Signing 3226 Algorithm, approved by the National Institute of Standards and 3227 Technology, defined in NIST FIPS PUB 186, "Digital Signature 3228 Standard", published May, 1994 by the U.S. Dept. of Commerce. 3229 [DSS] 3231 digital signatures 3232 Digital signatures utilize public key cryptography and one-way 3233 hash functions to produce a signature of the data that can be 3234 authenticated, and is difficult to forge or repudiate. 3236 handshake 3237 An initial negotiation between client and server that establishes 3238 the parameters of their transactions. 3240 Initialization Vector (IV) 3241 When a block cipher is used in CBC mode, the initialization 3242 vector is exclusive-ORed with the first plaintext block prior to 3243 encryption. 3245 IDEA 3246 A 64-bit block cipher designed by Xuejia Lai and James Massey. 3247 [IDEA] 3249 Message Authentication Code (MAC) 3250 A Message Authentication Code is a one-way hash computed from a 3251 message and some secret data. It is difficult to forge without 3252 knowing the secret data. Its purpose is to detect if the message 3253 has been altered. 3255 master secret 3256 Secure secret data used for generating encryption keys, MAC 3257 secrets, and IVs. 3259 MD5 3260 MD5 is a secure hashing function that converts an arbitrarily 3261 long data stream into a digest of fixed size (16 bytes). [MD5] 3263 public key cryptography 3264 A class of cryptographic techniques employing two-key ciphers. 3265 Messages encrypted with the public key can only be decrypted with 3266 the associated private key. Conversely, messages signed with the 3267 private key can be verified with the public key. 3269 one-way hash function 3270 A one-way transformation that converts an arbitrary amount of 3271 data into a fixed-length hash. It is computationally hard to 3272 reverse the transformation or to find collisions. MD5 and SHA are 3273 examples of one-way hash functions. 3275 RC2 3276 A block cipher developed by Ron Rivest, described in [RC2]. 3278 RC4 3279 A stream cipher invented by Ron Rivest. A compatible cipher is 3280 described in [SCH]. 3282 RSA 3283 A very widely used public-key algorithm that can be used for 3284 either encryption or digital signing. [RSA] 3286 server 3287 The server is the application entity that responds to requests 3288 for connections from clients. See also under client. 3290 session 3291 A TLS session is an association between a client and a server. 3292 Sessions are created by the handshake protocol. Sessions define a 3293 set of cryptographic security parameters that can be shared among 3294 multiple connections. Sessions are used to avoid the expensive 3295 negotiation of new security parameters for each connection. 3297 session identifier 3298 A session identifier is a value generated by a server that 3299 identifies a particular session. 3301 server write key 3302 The key used to encrypt data written by the server. 3304 server write MAC secret 3305 The secret data used to authenticate data written by the server. 3307 SHA 3308 The Secure Hash Algorithm is defined in FIPS PUB 180-2. It 3309 produces a 20-byte output. Note that all references to SHA 3310 actually use the modified SHA-1 algorithm. [SHA] 3312 SSL 3313 Netscape's Secure Socket Layer protocol [SSL3]. TLS is based on 3314 SSL Version 3.0 3316 stream cipher 3317 An encryption algorithm that converts a key into a 3318 cryptographically strong keystream, which is then exclusive-ORed 3319 with the plaintext. 3321 symmetric cipher 3322 See bulk cipher. 3324 Transport Layer Security (TLS) 3325 This protocol; also, the Transport Layer Security working group 3326 of the Internet Engineering Task Force (IETF). See "Comments" at 3327 the end of this document. 3329 Appendix C. CipherSuite Definitions 3331 CipherSuite Key Cipher Hash 3332 Exchange 3334 TLS_NULL_WITH_NULL_NULL NULL NULL NULL 3335 TLS_RSA_WITH_NULL_MD5 RSA NULL MD5 3336 TLS_RSA_WITH_NULL_SHA RSA NULL SHA 3337 TLS_RSA_WITH_RC4_128_MD5 RSA RC4_128 MD5 3338 TLS_RSA_WITH_RC4_128_SHA RSA RC4_128 SHA 3339 TLS_RSA_WITH_IDEA_CBC_SHA RSA IDEA_CBC SHA 3340 TLS_RSA_WITH_DES_CBC_SHA RSA DES_CBC SHA 3341 TLS_RSA_WITH_3DES_EDE_CBC_SHA RSA 3DES_EDE_CBC SHA 3342 TLS_RSA_WITH_AES_128_CBC_SHA RSA AES_128_CBC SHA 3343 TLS_RSA_WITH_AES_256_CBC_SHA RSA AES_256_CBC SHA 3344 TLS_DH_DSS_WITH_DES_CBC_SHA DH_DSS DES_CBC SHA 3345 TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA DH_DSS 3DES_EDE_CBC SHA 3346 TLS_DH_RSA_WITH_DES_CBC_SHA DH_RSA DES_CBC SHA 3347 TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA DH_RSA 3DES_EDE_CBC SHA 3348 TLS_DHE_DSS_WITH_DES_CBC_SHA DHE_DSS DES_CBC SHA 3349 TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA DHE_DSS 3DES_EDE_CBC SHA 3350 TLS_DHE_RSA_WITH_DES_CBC_SHA DHE_RSA DES_CBC SHA 3351 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA DHE_RSA 3DES_EDE_CBC SHA 3352 TLS_DH_anon_WITH_RC4_128_MD5 DH_anon RC4_128 MD5 3353 TLS_DH_anon_WITH_DES_CBC_SHA DH_anon DES_CBC SHA 3354 TLS_DH_anon_WITH_3DES_EDE_CBC_SHA DH_anon 3DES_EDE_CBC SHA 3355 TLS_DH_DSS_WITH_AES_128_CBC_SHA DH_DSS AES_128_CBC SHA 3356 TLS_DH_RSA_WITH_AES_128_CBC_SHA DH_RSA AES_128_CBC SHA 3357 TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE_DSS AES_128_CBC SHA 3358 TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE_RSA AES_128_CBC SHA 3359 TLS_DH_anon_WITH_AES_128_CBC_SHA DH_anon AES_128_CBC SHA 3360 TLS_DH_DSS_WITH_AES_256_CBC_SHA DH_DSS AES_256_CBC SHA 3361 TLS_DH_RSA_WITH_AES_256_CBC_SHA DH_RSA AES_256_CBC SHA 3362 TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE_DSS AES_256_CBC SHA 3363 TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE_RSA AES_256_CBC SHA 3364 TLS_DH_anon_WITH_AES_256_CBC_SHA DH_anon AES_256_CBC SHA 3366 Key 3367 Exchange 3368 Algorithm Description Key size limit 3370 DHE_DSS Ephemeral DH with DSS signatures None 3371 DHE_RSA Ephemeral DH with RSA signatures None 3372 DH_anon Anonymous DH, no signatures None 3373 DH_DSS DH with DSS-based certificates None 3374 DH_RSA DH with RSA-based certificates None 3375 NULL No key exchange N/A 3376 RSA RSA key exchange None 3377 Key Expanded IV Block 3378 Cipher Type Material Key Material Size Size 3380 NULL Stream 0 0 0 N/A 3381 IDEA_CBC Block 16 16 8 8 3382 RC4_128 Stream 16 16 0 N/A 3383 DES_CBC Block 8 8 8 8 3384 3DES_EDE_CBC Block 24 24 8 8 3386 Type 3387 Indicates whether this is a stream cipher or a block cipher 3388 running in CBC mode. 3390 Key Material 3391 The number of bytes from the key_block that are used for 3392 generating the write keys. 3394 Expanded Key Material 3395 The number of bytes actually fed into the encryption algorithm. 3397 IV Size 3398 The amount of data needed to be generated for the initialization 3399 vector. Zero for stream ciphers; equal to the block size for 3400 block ciphers (this is equal to SecurityParameters.record_iv_length). 3402 Block Size 3403 The amount of data a block cipher enciphers in one chunk; a 3404 block cipher running in CBC mode can only encrypt an even 3405 multiple of its block size. 3407 Hash Hash Padding 3408 function Size Size 3409 NULL 0 0 3410 MD5 16 48 3411 SHA 20 40 3412 Appendix D. Implementation Notes 3414 The TLS protocol cannot prevent many common security mistakes. This 3415 section provides several recommendations to assist implementors. 3417 D.1 Random Number Generation and Seeding 3419 TLS requires a cryptographically secure pseudorandom number generator 3420 (PRNG). Care must be taken in designing and seeding PRNGs. PRNGs 3421 based on secure hash operations, most notably SHA-1, are acceptable, 3422 but cannot provide more security than the size of the random number 3423 generator state. 3425 To estimate the amount of seed material being produced, add the 3426 number of bits of unpredictable information in each seed byte. For 3427 example, keystroke timing values taken from a PC compatible's 18.2 Hz 3428 timer provide 1 or 2 secure bits each, even though the total size of 3429 the counter value is 16 bits or more. Seeding a 128-bit PRNG would 3430 thus require approximately 100 such timer values. 3432 [RANDOM] provides guidance on the generation of random values. 3434 D.2 Certificates and Authentication 3436 Implementations are responsible for verifying the integrity of 3437 certificates and should generally support certificate revocation 3438 messages. Certificates should always be verified to ensure proper 3439 signing by a trusted Certificate Authority (CA). The selection and 3440 addition of trusted CAs should be done very carefully. Users should 3441 be able to view information about the certificate and root CA. 3443 D.3 CipherSuites 3445 TLS supports a range of key sizes and security levels, including some 3446 that provide no or minimal security. A proper implementation will 3447 probably not support many cipher suites. For instance, anonymous 3448 Diffie-Hellman is strongly discouraged because it cannot prevent man- 3449 in-the-middle attacks. Applications should also enforce minimum and 3450 maximum key sizes. For example, certificate chains containing 512-bit 3451 RSA keys or signatures are not appropriate for high-security 3452 applications. 3454 D.4 Implementation Pitfalls 3456 Implementation experience has shown that certain parts of earlier TLS 3457 specifications are not easy to understand, and have been a source of 3458 interoperability and security problems. Many of these areas have been 3459 clarified in this document, but this appendix contains a short list 3460 of the most important things that require special attention from 3461 implementors. 3463 TLS protocol issues: 3465 o Do you correctly handle handshake messages that are fragmented 3466 to multiple TLS records (see Section 6.2.1)? Including corner 3467 cases like a ClientHello that is split to several small 3468 fragments? 3470 o Do you ignore the TLS record layer version number in all TLS 3471 records before ServerHello (see Appendix E.1)? 3473 o Do you handle TLS extensions in ClientHello correctly, 3474 including omitting the extensions field completely? 3476 o Do you support renegotiation, both client and server initiated? 3477 While renegotiation this is an optional feature, supporting 3478 it is highly recommended. 3480 o When the server has requested a client certificate, but no 3481 suitable certificate is available, do you correctly send 3482 an empty Certificate message, instead of omitting the whole 3483 message (see Section 7.4.6)? 3485 Cryptographic details: 3487 o In RSA-encrypted Premaster Secret, do you correctly send and 3488 verify the version number? When an error is encountered, do 3489 you continue the handshake to avoid the Bleichenbacher 3490 attack (see Section 7.4.7.1)? 3492 o What countermeasures do you use to prevent timing attacks against 3493 RSA decryption and signing operations (see Section 7.4.7.1)? 3495 o When verifying RSA signatures, do you accept both NULL and 3496 missing parameters (see Section 4.7)? Do you verify that the 3497 RSA padding doesn't have additional data after the hash value? 3498 [FI06] 3500 o When using Diffie-Hellman key exchange, do you correctly strip 3501 leading zero bytes from the negotiated key (see Section 8.1.2)? 3503 o Does your TLS client check that the Diffie-Hellman parameters 3504 sent by the server are acceptable (see Section F.1.1.3)? 3506 o How do you generate unpredictable IVs for CBC mode ciphers 3507 (see Section 6.2.3.2)? 3508 o How do you address CBC mode timing attacks (Section 6.2.3.2)? 3510 o Do you use a strong and, most importantly, properly seeded 3511 random number generator (see Appendix D.1) for generating the 3512 premaster secret (for RSA key exchange), Diffie-Hellman private 3513 values, the DSA "k" parameter, and other security-critical 3514 values? 3515 Appendix E. Backward Compatibility 3517 E.1 Compatibility with TLS 1.0/1.1 and SSL 3.0 3519 Since there are various versions of TLS (1.0, 1.1, 1.2, and any 3520 future versions) and SSL (2.0 and 3.0), means are needed to negotiate 3521 the specific protocol version to use. The TLS protocol provides a 3522 built-in mechanism for version negotiation so as not to bother other 3523 protocol components with the complexities of version selection. 3525 TLS versions 1.0, 1.1, and 1.2, and SSL 3.0 are very similar, and use 3526 compatible ClientHello messages; thus, supporting all of them is 3527 relatively easy. Similarly, servers can easily handle clients trying 3528 to use future versions of TLS as long as the ClientHello format 3529 remains compatible, and the client support the highest protocol 3530 version available in the server. 3532 A TLS 1.2 client who wishes to negotiate with such older servers will 3533 send a normal TLS 1.2 ClientHello, containing { 3, 3 } (TLS 1.2) in 3534 ClientHello.client_version. If the server does not support this 3535 version, it will respond with ServerHello containing an older version 3536 number. If the client agrees to use this version, the negotiation 3537 will proceed as appropriate for the negotiated protocol. 3539 If the version chosen by the server is not supported by the client 3540 (or not acceptable), the client MUST send a "protocol_version" alert 3541 message and close the connection. 3543 If a TLS server receives a ClientHello containing a version number 3544 greater than the highest version supported by the server, it MUST 3545 reply according to the highest version supported by the server. 3547 A TLS server can also receive a ClientHello containing version number 3548 smaller than the highest supported version. If the server wishes to 3549 negotiate with old clients, it will proceed as appropriate for the 3550 highest version supported by the server that is not greater than 3551 ClientHello.client_version. For example, if the server supports TLS 3552 1.0, 1.1, and 1.2, and client_version is TLS 1.0, the server will 3553 proceed with a TLS 1.0 ServerHello. If server supports (or is willing 3554 to use) only versions greater than client_version, it MUST send a 3555 "protocol_version" alert message and close the connection. 3557 Whenever a client already knows the highest protocol known to a 3558 server (for example, when resuming a session), it SHOULD initiate the 3559 connection in that native protocol. 3561 Note: some server implementations are known to implement version 3562 negotiation incorrectly. For example, there are buggy TLS 1.0 servers 3563 that simply close the connection when the client offers a version 3564 newer than TLS 1.0. Also, it is known that some servers will refuse 3565 connection if any TLS extensions are included in ClientHello. 3566 Interoperability with such buggy servers is a complex topic beyond 3567 the scope of this document, and may require multiple connection 3568 attempts by the client. 3570 Earlier versions of the TLS specification were not fully clear on 3571 what the record layer version number (TLSPlaintext.version) should 3572 contain when sending ClientHello (i.e., before it is known which 3573 version of the protocol will be employed). Thus, TLS servers 3574 compliant with this specification MUST accept any value {03,XX} as 3575 the record layer version number for ClientHello. 3577 TLS clients that wish to negotiate with older servers MAY send any 3578 value {03,XX} as the record layer version number. Typical values 3579 would be {03,00}, the lowest version number supported by the client, 3580 and the value of ClientHello.client_version. No single value will 3581 guarantee interoperability with all old servers, but this is a 3582 complex topic beyond the scope of this document. 3584 E.2 Compatibility with SSL 2.0 3586 TLS 1.2 clients that wish to support SSL 2.0 servers MUST send 3587 version 2.0 CLIENT-HELLO messages defined in [SSL2]. The message MUST 3588 contain the same version number as would be used for ordinary 3589 ClientHello, and MUST encode the supported TLS ciphersuites in the 3590 CIPHER-SPECS-DATA field as described below. 3592 Warning: The ability to send version 2.0 CLIENT-HELLO messages will be 3593 phased out with all due haste, since the newer ClientHello format 3594 provides better mechanisms for moving to newer versions and 3595 negotiating extensions. TLS 1.2 clients SHOULD NOT support SSL 2.0. 3597 However, even TLS servers that do not support SSL 2.0 SHOULD accept 3598 version 2.0 CLIENT-HELLO messages. The message is presented below in 3599 sufficient detail for TLS server implementors; the true definition is 3600 still assumed to be [SSL2]. 3602 For negotiation purposes, 2.0 CLIENT-HELLO is interpreted the same 3603 way as a ClientHello with a "null" compression method and no 3604 extensions. Note that this message MUST be sent directly on the wire, 3605 not wrapped as a TLS record. For the purposes of calculating Finished 3606 and CertificateVerify, the msg_length field is not considered to be a 3607 part of the handshake message. 3609 uint8 V2CipherSpec[3]; 3610 struct { 3611 uint16 msg_length; 3612 uint8 msg_type; 3613 Version version; 3614 uint16 cipher_spec_length; 3615 uint16 session_id_length; 3616 uint16 challenge_length; 3617 V2CipherSpec cipher_specs[V2ClientHello.cipher_spec_length]; 3618 opaque session_id[V2ClientHello.session_id_length]; 3619 opaque challenge[V2ClientHello.challenge_length; 3620 } V2ClientHello; 3622 msg_length 3623 The highest bit MUST be 1; the remaining bits contain the 3624 length of the following data in bytes. 3626 msg_type 3627 This field, in conjunction with the version field, identifies a 3628 version 2 client hello message. The value MUST be one (1). 3630 version 3631 Equal to ClientHello.client_version. 3633 cipher_spec_length 3634 This field is the total length of the field cipher_specs. It 3635 cannot be zero and MUST be a multiple of the V2CipherSpec length 3636 (3). 3638 session_id_length 3639 This field MUST have a value of zero for a client that claims to 3640 support TLS 1.2. 3642 challenge_length 3643 The length in bytes of the client's challenge to the server to 3644 authenticate itself. Historically, permissible values are between 3645 16 and 32 bytes inclusive. When using the SSLv2 backward 3646 compatible handshake the client SHOULD use a 32 byte challenge. 3648 cipher_specs 3649 This is a list of all CipherSpecs the client is willing and able 3650 to use. In addition to the 2.0 cipher specs defined in [SSL2], 3651 this includes the TLS cipher suites normally sent in 3652 ClientHello.cipher_suites, each cipher suite prefixed by a zero 3653 byte. For example, TLS ciphersuite {0x00,0x0A} would be sent as 3654 {0x00,0x00,0x0A}. 3656 session_id 3657 This field MUST be empty. 3659 challenge 3660 Corresponds to ClientHello.random. If the challenge length is 3661 less than 32, the TLS server will pad the data with leading 3662 (note: not trailing) zero bytes to make it 32 bytes long. 3664 Note: Requests to resume a TLS session MUST use a TLS client hello. 3666 E.3. Avoiding Man-in-the-Middle Version Rollback 3668 When TLS clients fall back to Version 2.0 compatibility mode, they 3669 MUST use special PKCS#1 block formatting. This is done so that TLS 3670 servers will reject Version 2.0 sessions with TLS-capable clients. 3672 When a client negotiates SSL 2.0 but also supports TLS, it MUST set 3673 the right-hand (least-significant) 8 random bytes of the PKCS padding 3674 (not including the terminal null of the padding) for the RSA 3675 encryption of the ENCRYPTED-KEY-DATA field of the CLIENT-MASTER-KEY 3676 to 0x03 (the other padding bytes are random). 3678 When a TLS-capable server negotiates SSL 2.0 it SHOULD, after 3679 decrypting the ENCRYPTED-KEY-DATA field, check that these eight 3680 padding bytes are 0x03. If they are not, the server SHOULD generate a 3681 random value for SECRET-KEY-DATA, and continue the handshake (which 3682 will eventually fail since the keys will not match). Note that 3683 reporting the error situation to the client could make the server 3684 vulnerable to attacks described in [BLEI]. 3686 Appendix F. Security Analysis 3688 The TLS protocol is designed to establish a secure connection between 3689 a client and a server communicating over an insecure channel. This 3690 document makes several traditional assumptions, including that 3691 attackers have substantial computational resources and cannot obtain 3692 secret information from sources outside the protocol. Attackers are 3693 assumed to have the ability to capture, modify, delete, replay, and 3694 otherwise tamper with messages sent over the communication channel. 3695 This appendix outlines how TLS has been designed to resist a variety 3696 of attacks. 3698 F.1. Handshake Protocol 3700 The handshake protocol is responsible for selecting a CipherSpec and 3701 generating a Master Secret, which together comprise the primary 3702 cryptographic parameters associated with a secure session. The 3703 handshake protocol can also optionally authenticate parties who have 3704 certificates signed by a trusted certificate authority. 3706 F.1.1. Authentication and Key Exchange 3708 TLS supports three authentication modes: authentication of both 3709 parties, server authentication with an unauthenticated client, and 3710 total anonymity. Whenever the server is authenticated, the channel is 3711 secure against man-in-the-middle attacks, but completely anonymous 3712 sessions are inherently vulnerable to such attacks. Anonymous 3713 servers cannot authenticate clients. If the server is authenticated, 3714 its certificate message must provide a valid certificate chain 3715 leading to an acceptable certificate authority. Similarly, 3716 authenticated clients must supply an acceptable certificate to the 3717 server. Each party is responsible for verifying that the other's 3718 certificate is valid and has not expired or been revoked. 3720 The general goal of the key exchange process is to create a 3721 pre_master_secret known to the communicating parties and not to 3722 attackers. The pre_master_secret will be used to generate the 3723 master_secret (see Section 8.1). The master_secret is required to 3724 generate the finished messages, encryption keys, and MAC secrets (see 3725 Sections 7.4.9 and 6.3). By sending a correct finished message, 3726 parties thus prove that they know the correct pre_master_secret. 3728 F.1.1.1. Anonymous Key Exchange 3730 Completely anonymous sessions can be established using RSA or Diffie- 3731 Hellman for key exchange. With anonymous RSA, the client encrypts a 3732 pre_master_secret with the server's uncertified public key extracted 3733 from the server key exchange message. The result is sent in a client 3734 key exchange message. Since eavesdroppers do not know the server's 3735 private key, it will be infeasible for them to decode the 3736 pre_master_secret. 3738 With Diffie-Hellman, the server's public parameters are contained in 3739 the server key exchange message and the client's are sent in the 3740 client key exchange message. Eavesdroppers who do not know the 3741 private values should not be able to find the Diffie-Hellman result 3742 (i.e. the pre_master_secret). 3744 Warning: Completely anonymous connections only provide protection 3745 against passive eavesdropping. Unless an independent tamper- 3746 proof channel is used to verify that the finished messages 3747 were not replaced by an attacker, server authentication is 3748 required in environments where active man-in-the-middle 3749 attacks are a concern. 3751 F.1.1.2. RSA Key Exchange and Authentication 3753 With RSA, key exchange and server authentication are combined. The 3754 public key is contained in the server's certificate. Note that 3755 compromise of the server's static RSA key results in a loss of 3756 confidentiality for all sessions protected under that static key. TLS 3757 users desiring Perfect Forward Secrecy should use DHE cipher suites. 3758 The damage done by exposure of a private key can be limited by 3759 changing one's private key (and certificate) frequently. 3761 After verifying the server's certificate, the client encrypts a 3762 pre_master_secret with the server's public key. By successfully 3763 decoding the pre_master_secret and producing a correct finished 3764 message, the server demonstrates that it knows the private key 3765 corresponding to the server certificate. 3767 When RSA is used for key exchange, clients are authenticated using 3768 the certificate verify message (see Section 7.4.9). The client signs 3769 a value derived from the master_secret and all preceding handshake 3770 messages. These handshake messages include the server certificate, 3771 which binds the signature to the server, and ServerHello.random, 3772 which binds the signature to the current handshake process. 3774 F.1.1.3. Diffie-Hellman Key Exchange with Authentication 3776 When Diffie-Hellman key exchange is used, the server can either 3777 supply a certificate containing fixed Diffie-Hellman parameters or 3778 use the server key exchange message to send a set of temporary 3779 Diffie-Hellman parameters signed with a DSS or RSA certificate. 3780 Temporary parameters are hashed with the hello.random values before 3781 signing to ensure that attackers do not replay old parameters. In 3782 either case, the client can verify the certificate or signature to 3783 ensure that the parameters belong to the server. 3785 If the client has a certificate containing fixed Diffie-Hellman 3786 parameters, its certificate contains the information required to 3787 complete the key exchange. Note that in this case the client and 3788 server will generate the same Diffie-Hellman result (i.e., 3789 pre_master_secret) every time they communicate. To prevent the 3790 pre_master_secret from staying in memory any longer than necessary, 3791 it should be converted into the master_secret as soon as possible. 3792 Client Diffie-Hellman parameters must be compatible with those 3793 supplied by the server for the key exchange to work. 3795 If the client has a standard DSS or RSA certificate or is 3796 unauthenticated, it sends a set of temporary parameters to the server 3797 in the client key exchange message, then optionally uses a 3798 certificate verify message to authenticate itself. 3800 If the same DH keypair is to be used for multiple handshakes, either 3801 because the client or server has a certificate containing a fixed DH 3802 keypair or because the server is reusing DH keys, care must be taken 3803 to prevent small subgroup attacks. Implementations SHOULD follow the 3804 guidelines found in [SUBGROUP]. 3806 Small subgroup attacks are most easily avoided by using one of the 3807 DHE ciphersuites and generating a fresh DH private key (X) for each 3808 handshake. If a suitable base (such as 2) is chosen, g^X mod p can be 3809 computed very quickly, therefore the performance cost is minimized. 3810 Additionally, using a fresh key for each handshake provides Perfect 3811 Forward Secrecy. Implementations SHOULD generate a new X for each 3812 handshake when using DHE ciphersuites. 3814 Because TLS allows the server to provide arbitrary DH groups, the 3815 client SHOULD verify the correctness of the DH group. [TODO: provide 3816 a reference to some document describing how] and that it is of 3817 suitable size as defined by local policy. The client SHOULD also 3818 verify that the DH public exponent appears to be of adequate size. 3819 The server MAY choose to assist the client by providing a known 3820 group, such as those defined in [IKEALG] or [MODP]. These can be 3821 verified by simple comparison. 3823 F.1.2. Version Rollback Attacks 3825 Because TLS includes substantial improvements over SSL Version 2.0, 3826 attackers may try to make TLS-capable clients and servers fall back 3827 to Version 2.0. This attack can occur if (and only if) two TLS- 3828 capable parties use an SSL 2.0 handshake. 3830 Although the solution using non-random PKCS #1 block type 2 message 3831 padding is inelegant, it provides a reasonably secure way for Version 3832 3.0 servers to detect the attack. This solution is not secure against 3833 attackers who can brute force the key and substitute a new ENCRYPTED- 3834 KEY-DATA message containing the same key (but with normal padding) 3835 before the application specified wait threshold has expired. Altering 3836 the padding of the least significant 8 bytes of the PKCS padding does 3837 not impact security for the size of the signed hashes and RSA key 3838 lengths used in the protocol, since this is essentially equivalent to 3839 increasing the input block size by 8 bytes. 3841 F.1.3. Detecting Attacks Against the Handshake Protocol 3843 An attacker might try to influence the handshake exchange to make the 3844 parties select different encryption algorithms than they would 3845 normally chooses. 3847 For this attack, an attacker must actively change one or more 3848 handshake messages. If this occurs, the client and server will 3849 compute different values for the handshake message hashes. As a 3850 result, the parties will not accept each others' finished messages. 3851 Without the master_secret, the attacker cannot repair the finished 3852 messages, so the attack will be discovered. 3854 F.1.4. Resuming Sessions 3856 When a connection is established by resuming a session, new 3857 ClientHello.random and ServerHello.random values are hashed with the 3858 session's master_secret. Provided that the master_secret has not been 3859 compromised and that the secure hash operations used to produce the 3860 encryption keys and MAC secrets are secure, the connection should be 3861 secure and effectively independent from previous connections. 3862 Attackers cannot use known encryption keys or MAC secrets to 3863 compromise the master_secret without breaking the secure hash 3864 operations. 3866 Sessions cannot be resumed unless both the client and server agree. 3867 If either party suspects that the session may have been compromised, 3868 or that certificates may have expired or been revoked, it should 3869 force a full handshake. An upper limit of 24 hours is suggested for 3870 session ID lifetimes, since an attacker who obtains a master_secret 3871 may be able to impersonate the compromised party until the 3872 corresponding session ID is retired. Applications that may be run in 3873 relatively insecure environments should not write session IDs to 3874 stable storage. 3876 F.2. Protecting Application Data 3878 The master_secret is hashed with the ClientHello.random and 3879 ServerHello.random to produce unique data encryption keys and MAC 3880 secrets for each connection. 3882 Outgoing data is protected with a MAC before transmission. To prevent 3883 message replay or modification attacks, the MAC is computed from the 3884 MAC secret, the sequence number, the message length, the message 3885 contents, and two fixed character strings. The message type field is 3886 necessary to ensure that messages intended for one TLS Record Layer 3887 client are not redirected to another. The sequence number ensures 3888 that attempts to delete or reorder messages will be detected. Since 3889 sequence numbers are 64 bits long, they should never overflow. 3890 Messages from one party cannot be inserted into the other's output, 3891 since they use independent MAC secrets. Similarly, the server-write 3892 and client-write keys are independent, so stream cipher keys are used 3893 only once. 3895 If an attacker does break an encryption key, all messages encrypted 3896 with it can be read. Similarly, compromise of a MAC key can make 3897 message modification attacks possible. Because MACs are also 3898 encrypted, message-alteration attacks generally require breaking the 3899 encryption algorithm as well as the MAC. 3901 Note: MAC secrets may be larger than encryption keys, so messages can 3902 remain tamper resistant even if encryption keys are broken. 3904 F.3. Explicit IVs 3906 [CBCATT] describes a chosen plaintext attack on TLS that depends 3907 on knowing the IV for a record. Previous versions of TLS [TLS1.0] 3908 used the CBC residue of the previous record as the IV and 3909 therefore enabled this attack. This version uses an explicit IV 3910 in order to protect against this attack. 3912 F.4. Security of Composite Cipher Modes 3914 TLS secures transmitted application data via the use of symmetric 3915 encryption and authentication functions defined in the negotiated 3916 ciphersuite. The objective is to protect both the integrity and 3917 confidentiality of the transmitted data from malicious actions by 3918 active attackers in the network. It turns out that the order in 3919 which encryption and authentication functions are applied to the 3920 data plays an important role for achieving this goal [ENCAUTH]. 3922 The most robust method, called encrypt-then-authenticate, first 3923 applies encryption to the data and then applies a MAC to the 3924 ciphertext. This method ensures that the integrity and 3925 confidentiality goals are obtained with ANY pair of encryption 3926 and MAC functions, provided that the former is secure against 3927 chosen plaintext attacks and that the MAC is secure against 3928 chosen-message attacks. TLS uses another method, called 3929 authenticate-then-encrypt, in which first a MAC is computed on 3930 the plaintext and then the concatenation of plaintext and MAC is 3931 encrypted. This method has been proven secure for CERTAIN 3932 combinations of encryption functions and MAC functions, but it is 3933 not guaranteed to be secure in general. In particular, it has 3934 been shown that there exist perfectly secure encryption functions 3935 (secure even in the information-theoretic sense) that combined 3936 with any secure MAC function, fail to provide the confidentiality 3937 goal against an active attack. Therefore, new ciphersuites and 3938 operation modes adopted into TLS need to be analyzed under the 3939 authenticate-then-encrypt method to verify that they achieve the 3940 stated integrity and confidentiality goals. 3942 Currently, the security of the authenticate-then-encrypt method 3943 has been proven for some important cases. One is the case of 3944 stream ciphers in which a computationally unpredictable pad of 3945 the length of the message, plus the length of the MAC tag, is 3946 produced using a pseudo-random generator and this pad is xor-ed 3947 with the concatenation of plaintext and MAC tag. The other is 3948 the case of CBC mode using a secure block cipher. In this case, 3949 security can be shown if one applies one CBC encryption pass to 3950 the concatenation of plaintext and MAC and uses a new, 3951 independent, and unpredictable IV for each new pair of plaintext 3952 and MAC. In previous versions of SSL, CBC mode was used properly 3953 EXCEPT that it used a predictable IV in the form of the last 3954 block of the previous ciphertext. This made TLS open to chosen 3955 plaintext attacks. This version of the protocol is immune to 3956 those attacks. For exact details in the encryption modes proven 3957 secure, see [ENCAUTH]. 3959 F.5 Denial of Service 3961 TLS is susceptible to a number of denial of service (DoS) attacks. 3962 In particular, an attacker who initiates a large number of TCP 3963 connections can cause a server to consume large amounts of CPU doing 3964 RSA decryption. However, because TLS is generally used over TCP, it 3965 is difficult for the attacker to hide his point of origin if proper 3966 TCP SYN randomization is used [SEQNUM] by the TCP stack. 3968 Because TLS runs over TCP, it is also susceptible to a number of 3969 denial of service attacks on individual connections. In particular, 3970 attackers can forge RSTs, thereby terminating connections, or forge 3971 partial TLS records, thereby causing the connection to stall. These 3972 attacks cannot in general be defended against by a TCP-using 3973 protocol. Implementors or users who are concerned with this class of 3974 attack should use IPsec AH [AH] or ESP [ESP]. 3976 Security Considerations 3978 Security issues are discussed throughout this memo, especially in 3979 Appendices D, E, and F. 3981 Changes in This Version 3983 [RFC Editor: Please delete this] 3985 - Added compression methods to the IANA considerations. 3987 - Misc. editorial changes/clarifications 3989 - Added an Implementation Pitfalls sections 3990 [Issue 26] 3992 - Harmonized the requirement to send an empty certificate list 3993 after certificate_request even when no certs are available. 3994 [Issue 48] 3996 - Made the verify_data length depend on the cipher suite 3997 [Issue 49] 3999 - TLS_RSA_WITH_AES_128_CBC_SHA is now the mandatory to implement 4000 cipher suite [Issue 56] 4002 Normative References 4003 [AES] National Institute of Standards and Technology, 4004 "Specification for the Advanced Encryption Standard (AES)" 4005 FIPS 197. November 26, 2001. 4007 [3DES] National Institute of Standards and Technology, 4008 "Recommendation for the Triple Data Encryption Algorithm 4009 (TDEA) Block Cipher", NIST Special Publication 800-67, May 4010 2004. 4012 [DES] National Institute of Standards and Technology, "Data 4013 Encryption Standard (DES)", FIPS PUB 46-3, October 1999. 4015 [DSS] NIST FIPS PUB 186-2, "Digital Signature Standard," National 4016 Institute of Standards and Technology, U.S. Department of 4017 Commerce, 2000. PKI 4018 [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 4019 Hashing for Message Authentication", RFC 2104, February 4020 1997. 4022 [IDEA] X. Lai, "On the Design and Security of Block Ciphers," ETH 4023 Series in Information Processing, v. 1, Konstanz: Hartung- 4024 Gorre Verlag, 1992. 4026 [MD5] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321, 4027 April 1992. 4029 [PKCS1] J. Jonsson, B. Kaliski, "Public-Key Cryptography Standards 4030 (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 4031 3447, February 2003. 4033 [PKIX] Housley, R., Ford, W., Polk, W. and D. Solo, "Internet X.509 4034 Public Key Infrastructure Certificate and Certificate 4035 Revocation List (CRL) Profile", RFC 3280, April 2002. 4037 [RC2] Rivest, R., "A Description of the RC2(r) Encryption 4038 Algorithm", RFC 2268, March 1998. 4040 [SCH] B. Schneier. "Applied Cryptography: Protocols, Algorithms, 4041 and Source Code in C, 2nd ed.", Published by John Wiley & 4042 Sons, Inc. 1996. 4044 [SHA] NIST FIPS PUB 180-2, "Secure Hash Standard," National 4045 Institute of Standards and Technology, U.S. Department of 4046 Commerce., August 2001. 4048 [REQ] Bradner, S., "Key words for use in RFCs to Indicate 4049 Requirement Levels", BCP 14, RFC 2119, March 1997. 4051 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4052 IANA Considerations Section in RFCs", BCP 25, RFC 2434, 4053 October 1998. 4055 Informative References 4057 [AEAD] Mcgrew, D., "Authenticated Encryption", February 2007, 4058 draft-mcgrew-auth-enc-02.txt. 4060 [AH] Kent, S., and Atkinson, R., "IP Authentication Header", RFC 4061 4302, December 2005. 4063 [BLEI] Bleichenbacher D., "Chosen Ciphertext Attacks against 4064 Protocols Based on RSA Encryption Standard PKCS #1" in 4065 Advances in Cryptology -- CRYPTO'98, LNCS vol. 1462, pages: 4066 1-12, 1998. 4068 [CBCATT] Moeller, B., "Security of CBC Ciphersuites in SSL/TLS: 4069 Problems and Countermeasures", 4070 http://www.openssl.org/~bodo/tls-cbc.txt. 4072 [CBCTIME] Canvel, B., Hiltgen, A., Vaudenay, S., and M. Vuagnoux, 4073 "Password Interception in a SSL/TLS Channel", Advances in 4074 Cryptology -- CRYPTO 2003, LNCS vol. 2729, 2003. 4076 [CCM] "NIST Special Publication 800-38C: The CCM Mode for 4077 Authentication and Confidentiality", 4078 http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C.pdf 4080 [ENCAUTH] Krawczyk, H., "The Order of Encryption and Authentication 4081 for Protecting Communications (Or: How Secure is SSL?)", 4082 Crypto 2001. 4084 [ESP] Kent, S., and Atkinson, R., "IP Encapsulating Security 4085 Payload (ESP)", RFC 4303, December 2005. 4087 [FI06] Hal Finney, "Bleichenbacher's RSA signature forgery based on 4088 implementation error", ietf-openpgp@imc.org mailing list, 27 4089 August 2006, http://www.imc.org/ietf-openpgp/mail- 4090 archive/msg14307.html. 4092 [GCM] "NIST Special Publication 800-38D DRAFT (June, 2007): 4093 Recommendation for Block Cipher Modes of Operation: 4094 Galois/Counter Mode (GCM) and GMAC" 4096 [IKEALG] Schiller, J., "Cryptographic Algorithms for Use in the 4097 Internet Key Exchange Version 2 (IKEv2)", RFC 4307, December 4098 2005. 4100 [KPR03] Klima, V., Pokorny, O., Rosa, T., "Attacking RSA-based 4101 Sessions in SSL/TLS", http://eprint.iacr.org/2003/052/, 4102 March 2003. 4104 [MODP] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 4105 Diffie-Hellman groups for Internet Key Exchange (IKE)", RFC 4106 3526, May 2003. 4108 [PKCS6] RSA Laboratories, "PKCS #6: RSA Extended Certificate Syntax 4109 Standard," version 1.5, November 1993. 4111 [PKCS7] RSA Laboratories, "PKCS #7: RSA Cryptographic Message Syntax 4112 Standard," version 1.5, November 1993. 4114 [RANDOM] Eastlake, D., 3rd, Schiller, J., and S. Crocker, 4115 "Randomness Requirements for Security", BCP 106, RFC 4086, 4116 June 2005. 4118 [RFC3749] Hollenbeck, S., "Transport Layer Security Protocol 4119 Compression Methods", RFC 3749, May 2004. 4121 [RFC4366] Blake-Wilson, S., Nystrom, M., Hopwood, D., Mikkelsen, J., 4122 Wright, T., "Transport Layer Security (TLS) Extensions", RFC 4123 4366, April 2006. 4125 [RSA] R. Rivest, A. Shamir, and L. M. Adleman, "A Method for 4126 Obtaining Digital Signatures and Public-Key Cryptosystems," 4127 Communications of the ACM, v. 21, n. 2, Feb 1978, pp. 4128 120-126. 4130 [SEQNUM] Bellovin. S., "Defending Against Sequence Number Attacks", 4131 RFC 1948, May 1996. 4133 [SSL2] Hickman, Kipp, "The SSL Protocol", Netscape Communications 4134 Corp., Feb 9, 1995. 4136 [SSL3] A. Freier, P. Karlton, and P. Kocher, "The SSL 3.0 4137 Protocol", Netscape Communications Corp., Nov 18, 1996. 4139 [SUBGROUP] Zuccherato, R., "Methods for Avoiding the "Small-Subgroup" 4140 Attacks on the Diffie-Hellman Key Agreement Method for 4141 S/MIME", RFC 2785, March 2000. 4143 [TCP] Postel, J., "Transmission Control Protocol," STD 7, RFC 793, 4144 September 1981. 4146 [TIMING] Boneh, D., Brumley, D., "Remote timing attacks are 4147 practical", USENIX Security Symposium 2003. 4149 [TLSAES] Chown, P., "Advanced Encryption Standard (AES) Ciphersuites 4150 for Transport Layer Security (TLS)", RFC 3268, June 2002. 4152 [TLSEXT], Eastlake, D.E., "Transport Layer Security (TLS) 4153 Extensions: Extension Definitions", July 2007, draft-ietf- 4154 tls-rfc4366-bis-00.txt. 4156 [TLS1.0] Dierks, T., and C. Allen, "The TLS Protocol, Version 1.0", 4157 RFC 2246, January 1999. 4159 [TLS1.1] Dierks, T., and E. Rescorla, "The TLS Protocol, Version 4160 1.1", RFC 4346, April, 2006. 4162 [X501] ITU-T Recommendation X.501: Information Technology - Open 4163 Systems Interconnection - The Directory: Models, 1993. 4165 [XDR] Srinivansan, R., Sun Microsystems, "XDR: External Data 4166 Representation Standard", RFC 1832, August 1995. 4168 Credits 4170 Working Group Chairs 4171 Eric Rescorla 4172 EMail: ekr@networkresonance.com 4174 Pasi Eronen 4175 pasi.eronen@nokia.com 4177 Editors 4179 Tim Dierks Eric Rescorla 4180 Independent Network Resonance, Inc. 4182 EMail: tim@dierks.org EMail: ekr@networkresonance.com 4184 Other contributors 4186 Christopher Allen (co-editor of TLS 1.0) 4187 Alacrity Ventures 4188 ChristopherA@AlacrityManagement.com 4190 Martin Abadi 4191 University of California, Santa Cruz 4192 abadi@cs.ucsc.edu 4194 Steven M. Bellovin 4195 Columbia University 4196 smb@cs.columbia.edu 4198 Simon Blake-Wilson 4199 BCI 4200 EMail: sblakewilson@bcisse.com 4202 Ran Canetti 4203 IBM 4204 canetti@watson.ibm.com 4206 Pete Chown 4207 Skygate Technology Ltd 4208 pc@skygate.co.uk 4209 Taher Elgamal 4210 taher@securify.com 4211 Securify 4213 Anil Gangolli 4214 anil@busybuddha.org 4216 Kipp Hickman 4218 Alfred Hoenes 4220 David Hopwood 4221 Independent Consultant 4222 EMail: david.hopwood@blueyonder.co.uk 4224 Phil Karlton (co-author of SSLv3) 4226 Paul Kocher (co-author of SSLv3) 4227 Cryptography Research 4228 paul@cryptography.com 4230 Hugo Krawczyk 4231 Technion Israel Institute of Technology 4232 hugo@ee.technion.ac.il 4234 Jan Mikkelsen 4235 Transactionware 4236 EMail: janm@transactionware.com 4238 Magnus Nystrom 4239 RSA Security 4240 EMail: magnus@rsasecurity.com 4242 Robert Relyea 4243 Netscape Communications 4244 relyea@netscape.com 4246 Jim Roskind 4247 Netscape Communications 4248 jar@netscape.com 4250 Michael Sabin 4252 Dan Simon 4253 Microsoft, Inc. 4254 dansimon@microsoft.com 4256 Tom Weinstein 4257 Tim Wright 4258 Vodafone 4259 EMail: timothy.wright@vodafone.com 4261 Comments 4263 The discussion list for the IETF TLS working group is located at the 4264 e-mail address . Information on the group and 4265 information on how to subscribe to the list is at 4266 4268 Archives of the list can be found at: 4269 4270 Full Copyright Statement 4272 Copyright (C) The IETF Trust (2007). 4274 This document is subject to the rights, licenses and restrictions 4275 contained in BCP 78, and except as set forth therein, the authors 4276 retain all their rights. 4278 This document and the information contained herein are provided on an 4279 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4280 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 4281 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 4282 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 4283 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4284 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4286 Intellectual Property 4288 The IETF takes no position regarding the validity or scope of any 4289 Intellectual Property Rights or other rights that might be claimed to 4290 pertain to the implementation or use of the technology described in 4291 this document or the extent to which any license under such rights 4292 might or might not be available; nor does it represent that it has 4293 made any independent effort to identify any such rights. Information 4294 on the procedures with respect to rights in RFC documents can be 4295 found in BCP 78 and BCP 79. 4297 Copies of IPR disclosures made to the IETF Secretariat and any 4298 assurances of licenses to be made available, or the result of an 4299 attempt made to obtain a general license or permission for the use of 4300 such proprietary rights by implementers or users of this 4301 specification can be obtained from the IETF on-line IPR repository at 4302 http://www.ietf.org/ipr. 4304 The IETF invites any interested party to bring to its attention any 4305 copyrights, patents or patent applications, or other proprietary 4306 rights that may cover technology that may be required to implement 4307 this standard. Please address the information to the IETF at 4308 ietf-ipr@ietf.org. 4310 Acknowledgment 4312 Funding for the RFC Editor function is provided by the IETF 4313 Administrative Support Activity (IASA).