idnits 2.17.1 draft-ietf-tls-rfc4346-bis-02.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 on line 5147. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 5124. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 5131. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 5137. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 149 instances of too long lines in the document, the longest one being 9 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 RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 716 has weird spacing: '...gorithm bul...' == Line 2308 has weird spacing: '...ensions reque...' == Line 2695 has weird spacing: '...ixed_dh a c...' == Line 2697 has weird spacing: '...ixed_dh a c...' == Line 3569 has weird spacing: '...ensions reque...' == (1 more instance...) == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). == 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 'SHOULD not' in this paragraph: After sending a hello request, servers SHOULD not repeat the request until the subsequent handshake negotiation is complete. == 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: Warning: Because the SessionID is transmitted without encryption or immediate MAC protection, servers MUST not place confidential information in session identifiers or let the contents of fake session identifiers cause any breach of security. (Note that the content of the handshake as a whole, including the SessionID, is protected by the Finished messages exchanged at the end of the handshake.) == 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: Meaning of this message: With this message, the premaster secret is set, either though direct transmission of the RSA-encrypted secret, or by the transmission of Diffie-Hellman parameters which will allow each side to agree upon the same premaster secret. When the key exchange method is DH_RSA or DH_DSS, client certification has been requested, and the client was able to respond with a certificate which contained a Diffie-Hellman public key whose parameters (group and generator) matched those specified by the server in its certificate, this message MUST not contain any data. -- 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) -- Looks like a reference, but probably isn't: '0' on line 297 -- Looks like a reference, but probably isn't: '1' on line 297 -- Looks like a reference, but probably isn't: '3' on line 4281 -- Looks like a reference, but probably isn't: '9' on line 333 -- Looks like a reference, but probably isn't: '2' on line 3467 -- Looks like a reference, but probably isn't: '4' on line 368 -- Looks like a reference, but probably isn't: '8' on line 369 -- Looks like a reference, but probably isn't: '10' on line 463 -- Looks like a reference, but probably isn't: '20' on line 3705 -- Looks like a reference, but probably isn't: '48' on line 3887 -- Looks like a reference, but probably isn't: '32' on line 3889 == Missing Reference: 'ChangeCipherSpec' is mentioned on line 1623, but not defined -- Looks like a reference, but probably isn't: '28' on line 3462 == Missing Reference: 'TLS' is mentioned on line 4584, but not defined == Missing Reference: 'IANA' is mentioned on line 3249, but not defined -- Looks like a reference, but probably isn't: '46' on line 3667 -- Looks like a reference, but probably isn't: '12' on line 3714 == Missing Reference: 'PKCS1' is mentioned on line 3165, but not defined == Missing Reference: 'RFC 2434' is mentioned on line 3237, but not defined ** Obsolete undefined reference: RFC 2434 (Obsoleted by RFC 5226) == Missing Reference: 'RSADSI' is mentioned on line 4019, but not defined -- 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') ** Obsolete normative reference: RFC 2616 (ref. 'HTTP') (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Possible downref: Non-RFC (?) normative reference: ref. 'IDEA' ** Obsolete normative reference: RFC 3490 (ref. 'IDNA') (Obsoleted by RFC 5890, RFC 5891) ** Downref: Normative reference to an Informational RFC: RFC 1321 (ref. 'MD5') ** Obsolete normative reference: RFC 2560 (ref. 'OCSP') (Obsoleted by RFC 6960) ** Obsolete normative reference: RFC 2313 (ref. 'PKCS1A') (Obsoleted by RFC 2437) ** Obsolete normative reference: RFC 3447 (ref. 'PKCS1B') (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 3268 (ref. 'TLSAES') (Obsoleted by RFC 5246) ** Obsolete normative reference: RFC 3546 (ref. 'TLSEXT') (Obsoleted by RFC 4366) ** Obsolete normative reference: RFC 2396 (ref. 'URI') (Obsoleted by RFC 3986) -- Possible downref: Non-RFC (?) normative reference: ref. 'X509-4th' -- Possible downref: Non-RFC (?) normative reference: ref. 'X509-4th-TC1' == Outdated reference: A later version (-05) exists of draft-mcgrew-auth-enc-00 -- Obsolete informational reference (is this intentional?): RFC 2402 (ref. 'AH') (Obsoleted by RFC 4302, RFC 4305) -- Obsolete informational reference (is this intentional?): RFC 2406 (ref. 'ESP') (Obsoleted by RFC 4303, RFC 4305) -- Obsolete informational reference (is this intentional?): RFC 1750 (ref. 'RANDOM') (Obsoleted by RFC 4086) -- Obsolete informational reference (is this intentional?): RFC 1948 (ref. 'SEQNUM') (Obsoleted by RFC 6528) -- Obsolete informational reference (is this intentional?): RFC 793 (ref. 'TCP') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 1832 (ref. 'XDR') (Obsoleted by RFC 4506) Summary: 17 errors (**), 0 flaws (~~), 20 warnings (==), 37 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Tim Dierks 3 Independent 4 Eric Rescorla 5 INTERNET-DRAFT Network Resonance, Inc. 6 October 2006 (Expires April 2006) 8 The 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 Internet Society (2006). 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 4 48 1.1 Differences from TLS 1.1 5 49 1.1 Requirements Terminology 5 50 2. Goals 5 51 3. Goals of this document 6 52 4. Presentation language 6 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 8 58 4.6. Constructed types 9 59 4.6.1. Variants 10 60 4.7. Cryptographic attributes 11 61 4.8. Constants 12 62 5. HMAC and the pseudorandom function 12 63 6. The TLS Record Protocol 14 64 6.1. Connection states 14 65 6.2. Record layer 17 66 6.2.1. Fragmentation 17 67 6.2.2. Record compression and decompression 18 68 6.2.3. Record payload protection 19 69 6.2.3.1. Null or standard stream cipher 19 70 6.2.3.2. CBC block cipher 20 71 6.2.3.3. AEAD ciphers 23 72 6.3. Key calculation 24 73 7. The TLS Handshaking Protocols 24 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 35 80 7.4.1. Hello messages 36 81 7.4.1.1. Hello request 36 82 7.4.1.2. Client hello 37 83 7.4.1.3. Server hello 40 84 7.4.1.4 Hello Extensions 41 85 7.4.1.4.1 Server Name Indication 43 86 7.4.1.4.2 Maximum Fragment Length Negotiation 44 87 7.4.1.4.3 Client Certificate URLs 46 88 7.4.1.4.4 Trusted CA Indication 46 89 7.4.1.4.5 Truncated HMAC 48 90 7.4.1.4.6 Certificate Status Request 49 91 7.4.1.4.7 Cert Hash Types 50 92 7.4.1.4.8 Procedure for Defining New Extensions 51 93 7.4.2. Server certificate 52 94 7.4.3. Server key exchange message 53 95 7.4.4. CertificateStatus 56 96 7.4.5. Certificate request 56 97 7.4.6. Server hello done 58 98 7.4.7. Client certificate 59 99 7.4.8. Client Certificate URLs 59 100 7.4.9. Client key exchange message 61 101 7.4.9.1. RSA encrypted premaster secret message 62 102 7.4.9.2. Client Diffie-Hellman public value 64 103 7.4.10. Certificate verify 65 104 7.4.10. Finished 65 105 8. Cryptographic computations 66 106 8.1. Computing the master secret 67 107 8.1.1. RSA 67 108 8.1.2. Diffie-Hellman 67 109 9. Mandatory Cipher Suites 67 110 A. Protocol constant values 71 111 A.1. Record layer 71 112 A.2. Change cipher specs message 72 113 A.3. Alert messages 72 114 A.4. Handshake protocol 74 115 A.4.1. Hello messages 74 116 A.4.2. Server authentication and key exchange messages 77 117 A.4.3. Client authentication and key exchange messages 78 118 A.4.4. Handshake finalization message 79 119 A.5. The CipherSuite 80 120 A.6. The Security Parameters 83 121 B. Glossary 84 122 C. CipherSuite definitions 88 123 D. Implementation Notes 90 124 D.1 Random Number Generation and Seeding 90 125 D.2 Certificates and authentication 90 126 D.3 CipherSuites 90 127 E. Backward Compatibility 91 128 E.1. Version 2 client hello 92 129 E.2. Avoiding man-in-the-middle version rollback 93 130 F. Security analysis 95 131 F.1. Handshake protocol 95 132 F.1.1. Authentication and key exchange 95 133 F.1.1.1. Anonymous key exchange 95 134 F.1.1.2. RSA key exchange and authentication 96 135 F.1.1.3. Diffie-Hellman key exchange with authentication 97 136 F.1.2. Version rollback attacks 97 137 F.1.3. Detecting attacks against the handshake protocol 98 138 F.1.4. Resuming sessions 98 139 F.1.5 Extensions 99 140 F.1.5.1 Security of server_name 99 141 F.1.5.2 Security of client_certificate_url 100 142 F.1.5.4. Security of trusted_ca_keys 101 143 F.1.5.5. Security of truncated_hmac 101 144 F.1.5.6. Security of status_request 102 145 F.2. Protecting application data 102 146 F.3. Explicit IVs 103 147 F.4 Security of Composite Cipher Modes 103 148 F.5 Denial of Service 104 149 F.6. Final notes 104 151 1. Introduction 153 The primary goal of the TLS Protocol is to provide privacy and data 154 integrity between two communicating applications. The protocol is 155 composed of two layers: the TLS Record Protocol and the TLS Handshake 156 Protocol. At the lowest level, layered on top of some reliable 157 transport protocol (e.g., TCP[TCP]), is the TLS Record Protocol. The 158 TLS Record Protocol provides connection security that has two basic 159 properties: 161 - The connection is private. Symmetric cryptography is used for 162 data encryption (e.g., DES [DES], RC4 [SCH], etc.). The keys for 163 this symmetric encryption are generated uniquely for each 164 connection and are based on a secret negotiated by another 165 protocol (such as the TLS Handshake Protocol). The Record 166 Protocol can also be used without encryption. 168 - The connection is reliable. Message transport includes a message 169 integrity check using a keyed MAC. Secure hash functions (e.g., 170 SHA, MD5, etc.) are used for MAC computations. The Record 171 Protocol can operate without a MAC, but is generally only used in 172 this mode while another protocol is using the Record Protocol as 173 a transport for negotiating security parameters. 175 The TLS Record Protocol is used for encapsulation of various higher 176 level protocols. One such encapsulated protocol, the TLS Handshake 177 Protocol, allows the server and client to authenticate each other and 178 to negotiate an encryption algorithm and cryptographic keys before 179 the application protocol transmits or receives its first byte of 180 data. The TLS Handshake Protocol provides connection security that 181 has three basic properties: 183 - The peer's identity can be authenticated using asymmetric, or 184 public key, cryptography (e.g., RSA [RSA], DSS [DSS], etc.). This 185 authentication can be made optional, but is generally required 186 for at least one of the peers. 188 - The negotiation of a shared secret is secure: the negotiated 189 secret is unavailable to eavesdroppers, and for any authenticated 190 connection the secret cannot be obtained, even by an attacker who 191 can place himself in the middle of the connection. 193 - The negotiation is reliable: no attacker can modify the 194 negotiation communication without being detected by the parties 195 to the communication. 197 One advantage of TLS is that it is application protocol independent. 198 Higher level protocols can layer on top of the TLS Protocol 199 transparently. The TLS standard, however, does not specify how 200 protocols add security with TLS; the decisions on how to initiate TLS 201 handshaking and how to interpret the authentication certificates 202 exchanged are left up to the judgment of the designers and 203 implementors of protocols which run on top of TLS. 205 1.1 Differences from TLS 1.1 206 This document is a revision of the TLS 1.1 [TLS1.1] protocol which 207 contains improved flexibility, particularly for negotiation of 208 cryptographic algorithms. The major changes are: 210 - Merged in TLS Extensions and AES Cipher Suites from external 211 documents. 213 - Replacement of MD5/SHA-1 combination in the PRF 215 - Replacement of MD5/SHA-1 combination in the digitally-signed 216 element. 218 - Allow the client to indicate which hash functions it supports. 220 - Allow the server to indicate which hash functions it supports 222 - Addition of support for authenticated encryption with additional 223 data modes. 225 1.1 Requirements Terminology 227 Keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT" and 228 "MAY" that appear in this document are to be interpreted as described 229 in RFC 2119 [REQ]. 231 2. Goals 233 The goals of TLS Protocol, in order of their priority, are: 235 1. Cryptographic security: TLS should be used to establish a secure 236 connection between two parties. 238 2. Interoperability: Independent programmers should be able to 239 develop applications utilizing TLS that will then be able to 240 successfully exchange cryptographic parameters without knowledge 241 of one another's code. 243 3. Extensibility: TLS seeks to provide a framework into which new 244 public key and bulk encryption methods can be incorporated as 245 necessary. This will also accomplish two sub-goals: to prevent 246 the need to create a new protocol (and risking the introduction 247 of possible new weaknesses) and to avoid the need to implement an 248 entire new security library. 250 4. Relative efficiency: Cryptographic operations tend to be highly 251 CPU intensive, particularly public key operations. For this 252 reason, the TLS protocol has incorporated an optional session 253 caching scheme to reduce the number of connections that need to 254 be established from scratch. Additionally, care has been taken to 255 reduce network activity. 257 3. Goals of this document 259 This document and the TLS protocol itself are based on the SSL 3.0 260 Protocol Specification as published by Netscape. The differences 261 between this protocol and SSL 3.0 are not dramatic, but they are 262 significant enough that the various versions of TLS and SSL 3.0 do 263 not interoperate (although each protocol incorporates a mechanism by 264 which an implementation can back down to prior versions.) This 265 document is intended primarily for readers who will be implementing 266 the protocol and those doing cryptographic analysis of it. The 267 specification has been written with this in mind, and it is intended 268 to reflect the needs of those two groups. For that reason, many of 269 the algorithm-dependent data structures and rules are included in the 270 body of the text (as opposed to in an appendix), providing easier 271 access to them. 273 This document is not intended to supply any details of service 274 definition nor interface definition, although it does cover select 275 areas of policy as they are required for the maintenance of solid 276 security. 278 4. Presentation language 280 This document deals with the formatting of data in an external 281 representation. The following very basic and somewhat casually 282 defined presentation syntax will be used. The syntax draws from 283 several sources in its structure. Although it resembles the 284 programming language "C" in its syntax and XDR [XDR] in both its 285 syntax and intent, it would be risky to draw too many parallels. The 286 purpose of this presentation language is to document TLS only, not to 287 have general application beyond that particular goal. 289 4.1. Basic block size 291 The representation of all data items is explicitly specified. The 292 basic data block size is one byte (i.e. 8 bits). Multiple byte data 293 items are concatenations of bytes, from left to right, from top to 294 bottom. From the bytestream a multi-byte item (a numeric in the 295 example) is formed (using C notation) by: 297 value = (byte[0] << 8*(n-1)) | (byte[1] << 8*(n-2)) | 298 ... | byte[n-1]; 300 This byte ordering for multi-byte values is the commonplace network 301 byte order or big endian format. 303 4.2. Miscellaneous 305 Comments begin with "/*" and end with "*/". 307 Optional components are denoted by enclosing them in "[[ ]]" double 308 brackets. 310 Single byte entities containing uninterpreted data are of type 311 opaque. 313 4.3. Vectors 315 A vector (single dimensioned array) is a stream of homogeneous data 316 elements. The size of the vector may be specified at documentation 317 time or left unspecified until runtime. In either case the length 318 declares the number of bytes, not the number of elements, in the 319 vector. The syntax for specifying a new type T' that is a fixed 320 length vector of type T is 322 T T'[n]; 324 Here T' occupies n bytes in the data stream, where n is a multiple of 325 the size of T. The length of the vector is not included in the 326 encoded stream. 328 In the following example, Datum is defined to be three consecutive 329 bytes that the protocol does not interpret, while Data is three 330 consecutive Datum, consuming a total of nine bytes. 332 opaque Datum[3]; /* three uninterpreted bytes */ 333 Datum Data[9]; /* 3 consecutive 3 byte vectors */ 334 Variable length vectors are defined by specifying a subrange of legal 335 lengths, inclusively, using the notation . When 336 encoded, the actual length precedes the vector's contents in the byte 337 stream. The length will be in the form of a number consuming as many 338 bytes as required to hold the vector's specified maximum (ceiling) 339 length. A variable length vector with an actual length field of zero 340 is referred to as an empty vector. 342 T T'; 344 In the following example, mandatory is a vector that must contain 345 between 300 and 400 bytes of type opaque. It can never be empty. The 346 actual length field consumes two bytes, a uint16, sufficient to 347 represent the value 400 (see Section 4.4). On the other hand, longer 348 can represent up to 800 bytes of data, or 400 uint16 elements, and it 349 may be empty. Its encoding will include a two byte actual length 350 field prepended to the vector. The length of an encoded vector must 351 be an even multiple of the length of a single element (for example, a 352 17 byte vector of uint16 would be illegal). 354 opaque mandatory<300..400>; 355 /* length field is 2 bytes, cannot be empty */ 356 uint16 longer<0..800>; 357 /* zero to 400 16-bit unsigned integers */ 359 4.4. Numbers 361 The basic numeric data type is an unsigned byte (uint8). All larger 362 numeric data types are formed from fixed length series of bytes 363 concatenated as described in Section 4.1 and are also unsigned. The 364 following numeric types are predefined. 366 uint8 uint16[2]; 367 uint8 uint24[3]; 368 uint8 uint32[4]; 369 uint8 uint64[8]; 371 All values, here and elsewhere in the specification, are stored in 372 "network" or "big-endian" order; the uint32 represented by the hex 373 bytes 01 02 03 04 is equivalent to the decimal value 16909060. 375 4.5. Enumerateds 377 An additional sparse data type is available called enum. A field of 378 type enum can only assume the values declared in the definition. 379 Each definition is a different type. Only enumerateds of the same 380 type may be assigned or compared. Every element of an enumerated must 381 be assigned a value, as demonstrated in the following example. Since 382 the elements of the enumerated are not ordered, they can be assigned 383 any unique value, in any order. 385 enum { e1(v1), e2(v2), ... , en(vn) [[, (n)]] } Te; 387 Enumerateds occupy as much space in the byte stream as would its 388 maximal defined ordinal value. The following definition would cause 389 one byte to be used to carry fields of type Color. 391 enum { red(3), blue(5), white(7) } Color; 393 One may optionally specify a value without its associated tag to 394 force the width definition without defining a superfluous element. 395 In the following example, Taste will consume two bytes in the data 396 stream but can only assume the values 1, 2 or 4. 398 enum { sweet(1), sour(2), bitter(4), (32000) } Taste; 400 The names of the elements of an enumeration are scoped within the 401 defined type. In the first example, a fully qualified reference to 402 the second element of the enumeration would be Color.blue. Such 403 qualification is not required if the target of the assignment is well 404 specified. 406 Color color = Color.blue; /* overspecified, legal */ 407 Color color = blue; /* correct, type implicit */ 409 For enumerateds that are never converted to external representation, 410 the numerical information may be omitted. 412 enum { low, medium, high } Amount; 414 4.6. Constructed types 416 Structure types may be constructed from primitive types for 417 convenience. Each specification declares a new, unique type. The 418 syntax for definition is much like that of C. 420 struct { 421 T1 f1; 422 T2 f2; 423 ... 424 Tn fn; 425 } [[T]]; 426 The fields within a structure may be qualified using the type's name 427 using a syntax much like that available for enumerateds. For example, 428 T.f2 refers to the second field of the previous declaration. 429 Structure definitions may be embedded. 431 4.6.1. Variants 433 Defined structures may have variants based on some knowledge that is 434 available within the environment. The selector must be an enumerated 435 type that defines the possible variants the structure defines. There 436 must be a case arm for every element of the enumeration declared in 437 the select. The body of the variant structure may be given a label 438 for reference. The mechanism by which the variant is selected at 439 runtime is not prescribed by the presentation language. 441 struct { 442 T1 f1; 443 T2 f2; 444 .... 445 Tn fn; 446 select (E) { 447 case e1: Te1; 448 case e2: Te2; 449 .... 450 case en: Ten; 451 } [[fv]]; 452 } [[Tv]]; 454 For example: 456 enum { apple, orange } VariantTag; 457 struct { 458 uint16 number; 459 opaque string<0..10>; /* variable length */ 460 } V1; 461 struct { 462 uint32 number; 463 opaque string[10]; /* fixed length */ 464 } V2; 465 struct { 466 select (VariantTag) { /* value of selector is implicit */ 467 case apple: V1; /* VariantBody, tag = apple */ 468 case orange: V2; /* VariantBody, tag = orange */ 469 } variant_body; /* optional label on variant */ 470 } VariantRecord; 472 Variant structures may be qualified (narrowed) by specifying a value 473 for the selector prior to the type. For example, a 474 orange VariantRecord 476 is a narrowed type of a VariantRecord containing a variant_body of 477 type V2. 479 4.7. Cryptographic attributes 481 The five cryptographic operations digital signing, stream cipher 482 encryption, block cipher encryption, authenticated encryption with 483 additional data (AEAD) encryption and public key encryption are 484 designated digitally-signed, stream-ciphered, block-ciphered, aead- 485 ciphered, and public-key-encrypted, respectively. A field's 486 cryptographic processing is specified by prepending an appropriate 487 key word designation before the field's type specification. 488 Cryptographic keys are implied by the current session state (see 489 Section 6.1). 491 In digital signing, one-way hash functions are used as input for a 492 signing algorithm. A digitally-signed element is encoded as an opaque 493 vector <0..2^16-1>, where the length is specified by the signing 494 algorithm and key. 496 In RSA signing, the output of the chosen hash function is encoded as 497 a PKCS #1 DigestInfo and then signed using block type 01 as described 498 in Section 8.1 as described in [PKCS1A]. 500 Note: the standard reference for PKCS#1 is now RFC 3447 [PKCS1B]. 501 However, to minimize differences with TLS 1.0 text, we are using the 502 terminology of RFC 2313 [PKCS1A]. 504 In DSS, the 20 bytes of the SHA-1 hash are run directly through the 505 Digital Signing Algorithm with no additional hashing. This produces 506 two values, r and s. The DSS signature is an opaque vector, as above, 507 the contents of which are the DER encoding of: 509 Dss-Sig-Value ::= SEQUENCE { 510 r INTEGER, 511 s INTEGER 512 } 514 In stream cipher encryption, the plaintext is exclusive-ORed with an 515 identical amount of output generated from a cryptographically-secure 516 keyed pseudorandom number generator. 518 In block cipher encryption, every block of plaintext encrypts to a 519 block of ciphertext. All block cipher encryption is done in CBC 520 (Cipher Block Chaining) mode, and all items which are block-ciphered 521 will be an exact multiple of the cipher block length. 523 In AEAD encryption, the plaintext is simultaneously encrypted and 524 integrity protected. The input may be of any length and the output is 525 generally larger than the input in order to accomodate the integrity 526 check value. 528 In public key encryption, a public key algorithm is used to encrypt 529 data in such a way that it can be decrypted only with the matching 530 private key. A public-key-encrypted element is encoded as an opaque 531 vector <0..2^16-1>, where the length is specified by the signing 532 algorithm and key. 534 An RSA encrypted value is encoded with PKCS #1 block type 2 as 535 described in [PKCS1A]. 537 In the following example: 539 stream-ciphered struct { 540 uint8 field1; 541 uint8 field2; 542 digitally-signed opaque hash[20]; 543 } UserType; 545 The contents of hash are used as input for the signing algorithm, 546 then the entire structure is encrypted with a stream cipher. The 547 length of this structure, in bytes would be equal to 2 bytes for 548 field1 and field2, plus two bytes for the length of the signature, 549 plus the length of the output of the signing algorithm. This is known 550 due to the fact that the algorithm and key used for the signing are 551 known prior to encoding or decoding this structure. 553 4.8. Constants 555 Typed constants can be defined for purposes of specification by 556 declaring a symbol of the desired type and assigning values to it. 557 Under-specified types (opaque, variable length vectors, and 558 structures that contain opaque) cannot be assigned values. No fields 559 of a multi-element structure or vector may be elided. 561 For example, 563 struct { 564 uint8 f1; 565 uint8 f2; 566 } Example1; 568 Example1 ex1 = {1, 4}; /* assigns f1 = 1, f2 = 4 */ 570 5. HMAC and the pseudorandom function 571 A number of operations in the TLS record and handshake layer required 572 a keyed MAC; this is a secure digest of some data protected by a 573 secret. Forging the MAC is infeasible without knowledge of the MAC 574 secret. The construction we use for this operation is known as HMAC, 575 described in [HMAC]. 577 In addition, a construction is required to do expansion of secrets 578 into blocks of data for the purposes of key generation or validation. 579 This pseudo-random function (PRF) takes as input a secret, a seed, 580 and an identifying label and produces an output of arbitrary length. 582 First, we define a data expansion function, P_hash(secret, data) 583 which uses a single hash function to expand a secret and seed into an 584 arbitrary quantity of output: 586 P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + 587 HMAC_hash(secret, A(2) + seed) + 588 HMAC_hash(secret, A(3) + seed) + ... 590 Where + indicates concatenation. 592 A() is defined as: 593 A(0) = seed 594 A(i) = HMAC_hash(secret, A(i-1)) 596 P_hash can be iterated as many times as is necessary to produce the 597 required quantity of data. For example, if P_SHA-1 was being used to 598 create 64 bytes of data, it would have to be iterated 4 times 599 (through A(4)), creating 80 bytes of output data; the last 16 bytes 600 of the final iteration would then be discarded, leaving 64 bytes of 601 output data. 603 TLS's PRF is created by applying P_hash to the secret S as: 605 PRF(secret, label, seed) = P_(secret, label + seed) 607 Unless the cipher suite definition specifies otherwise, the hash 608 function used in P MUST be the same hash function selected for the 609 HMAC in the cipher suite. For existing cipher suites (which use MD5 610 or SHA-1), the hash MUST be SHA-1. New ciphers which do not use HMAC 611 MUST explicitly specify a PRF. 613 The label is an ASCII string. It should be included in the exact form 614 it is given without a length byte or trailing null character. For 615 example, the label "slithy toves" would be processed by hashing the 616 following bytes: 618 73 6C 69 74 68 79 20 74 6F 76 65 73 619 6. The TLS Record Protocol 621 The TLS Record Protocol is a layered protocol. At each layer, 622 messages may include fields for length, description, and content. 623 The Record Protocol takes messages to be transmitted, fragments the 624 data into manageable blocks, optionally compresses the data, applies 625 a MAC, encrypts, and transmits the result. Received data is 626 decrypted, verified, decompressed, and reassembled, then delivered to 627 higher level clients. 629 Four record protocol clients are described in this document: the 630 handshake protocol, the alert protocol, the change cipher spec 631 protocol, and the application data protocol. In order to allow 632 extension of the TLS protocol, additional record types can be 633 supported by the record protocol. Any new record types SHOULD 634 allocate type values immediately beyond the ContentType values for 635 the four record types described here (see Appendix A.1). All such 636 values must be defined by RFC 2434 Standards Action. See section 11 637 for IANA Considerations for ContentType values. 639 If a TLS implementation receives a record type it does not 640 understand, it SHOULD just ignore it. Any protocol designed for use 641 over TLS MUST be carefully designed to deal with all possible attacks 642 against it. Note that because the type and length of a record are 643 not protected by encryption, care SHOULD be taken to minimize the 644 value of traffic analysis of these values. 646 6.1. Connection states 648 A TLS connection state is the operating environment of the TLS Record 649 Protocol. It specifies a compression algorithm, encryption algorithm, 650 and MAC algorithm. In addition, the parameters for these algorithms 651 are known: the MAC secret and the bulk encryption keys for the 652 connection in both the read and the write directions. Logically, 653 there are always four connection states outstanding: the current read 654 and write states, and the pending read and write states. All records 655 are processed under the current read and write states. The security 656 parameters for the pending states can be set by the TLS Handshake 657 Protocol, and the Change Cipher Spec can selectively make either of 658 the pending states current, in which case the appropriate current 659 state is disposed of and replaced with the pending state; the pending 660 state is then reinitialized to an empty state. It is illegal to make 661 a state which has not been initialized with security parameters a 662 current state. The initial current state always specifies that no 663 encryption, compression, or MAC will be used. 665 The security parameters for a TLS Connection read and write state are 666 set by providing the following values: 668 connection end 669 Whether this entity is considered the "client" or the "server" in 670 this connection. 672 bulk encryption algorithm 673 An algorithm to be used for bulk encryption. This specification 674 includes the key size of this algorithm, how much of that key is 675 secret, whether it is a block, stream, or AEAD cipher, the block 676 size of the cipher (if appropriate). 678 MAC algorithm 679 An algorithm to be used for message authentication. This 680 specification includes the size of the hash which is returned by 681 the MAC algorithm. 683 compression algorithm 684 An algorithm to be used for data compression. This specification 685 must include all information the algorithm requires to do 686 compression. 688 master secret 689 A 48 byte secret shared between the two peers in the connection. 691 client random 692 A 32 byte value provided by the client. 694 server random 695 A 32 byte value provided by the server. 697 These parameters are defined in the presentation language as: 699 enum { server, client } ConnectionEnd; 701 enum { null, rc4, rc2, des, 3des, des40, idea, aes } BulkCipherAlgorithm; 703 enum { stream, block, aead } CipherType; 705 enum { null, md5, sha, sha256, sha384, sha512} MACAlgorithm; 707 /* The use of "sha" above is historical and denotes SHA-1 */ 709 enum { null(0), (255) } CompressionMethod; 711 /* The algorithms specified in CompressionMethod, 712 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 714 struct { 715 ConnectionEnd entity; 716 BulkCipherAlgorithm bulk_cipher_algorithm; 717 CipherType cipher_type; 718 uint8 key_size; 719 uint8 key_material_length; 720 MACAlgorithm mac_algorithm; 721 uint8 hash_size; 722 CompressionMethod compression_algorithm; 723 opaque master_secret[48]; 724 opaque client_random[32]; 725 opaque server_random[32]; 726 } SecurityParameters; 728 The record layer will use the security parameters to generate the 729 following four items: 731 client write MAC secret 732 server write MAC secret 733 client write key 734 server write key 736 The client write parameters are used by the server when receiving and 737 processing records and vice-versa. The algorithm used for generating 738 these items from the security parameters is described in section 6.3. 740 Once the security parameters have been set and the keys have been 741 generated, the connection states can be instantiated by making them 742 the current states. These current states MUST be updated for each 743 record processed. Each connection state includes the following 744 elements: 746 compression state 747 The current state of the compression algorithm. 749 cipher state 750 The current state of the encryption algorithm. This will consist 751 of the scheduled key for that connection. For stream ciphers, 752 this will also contain whatever the necessary state information 753 is to allow the stream to continue to encrypt or decrypt data. 755 MAC secret 756 The MAC secret for this connection as generated above. 758 sequence number 759 Each connection state contains a sequence number, which is 760 maintained separately for read and write states. The sequence 761 number MUST be set to zero whenever a connection state is made 762 the active state. Sequence numbers are of type uint64 and may not 763 exceed 2^64-1. Sequence numbers do not wrap. If a TLS 764 implementation would need to wrap a sequence number it must 765 renegotiate instead. A sequence number is incremented after each 766 record: specifically, the first record which is transmitted under 767 a particular connection state MUST use sequence number 0. 769 6.2. Record layer 771 The TLS Record Layer receives uninterpreted data from higher layers 772 in non-empty blocks of arbitrary size. 774 6.2.1. Fragmentation 776 The record layer fragments information blocks into TLSPlaintext 777 records carrying data in chunks of 2^14 bytes or less. Client message 778 boundaries are not preserved in the record layer (i.e., multiple 779 client messages of the same ContentType MAY be coalesced into a 780 single TLSPlaintext record, or a single message MAY be fragmented 781 across several records). 783 struct { 784 uint8 major, minor; 785 } ProtocolVersion; 787 enum { 788 change_cipher_spec(20), alert(21), handshake(22), 789 application_data(23), (255) 790 } ContentType; 792 struct { 793 ContentType type; 794 ProtocolVersion version; 795 uint16 length; 796 opaque fragment[TLSPlaintext.length]; 797 } TLSPlaintext; 799 type 800 The higher level protocol used to process the enclosed fragment. 802 version 803 The version of the protocol being employed. This document 804 describes TLS Version 1.2, which uses the version { 3, 3 }. The 805 version value 3.3 is historical, deriving from the use of 3.1 for 806 TLS 1.0. (See Appendix A.1). 808 length 809 The length (in bytes) of the following TLSPlaintext.fragment. 810 The length should not exceed 2^14. 812 fragment 813 The application data. This data is transparent and treated as an 814 independent block to be dealt with by the higher level protocol 815 specified by the type field. 817 Note: Data of different TLS Record layer content types MAY be 818 interleaved. Application data is generally of lower precedence 819 for transmission than other content types. However, records MUST 820 be delivered to the network in the same order as they are 821 protected by the record layer. Recipients MUST receive and 822 process interleaved application layer traffic during handshakes 823 subsequent to the first one on a connection. 825 6.2.2. Record compression and decompression 827 All records are compressed using the compression algorithm defined in 828 the current session state. There is always an active compression 829 algorithm; however, initially it is defined as 830 CompressionMethod.null. The compression algorithm translates a 831 TLSPlaintext structure into a TLSCompressed structure. Compression 832 functions are initialized with default state information whenever a 833 connection state is made active. 835 Compression must be lossless and may not increase the content length 836 by more than 1024 bytes. If the decompression function encounters a 837 TLSCompressed.fragment that would decompress to a length in excess of 838 2^14 bytes, it should report a fatal decompression failure error. 840 struct { 841 ContentType type; /* same as TLSPlaintext.type */ 842 ProtocolVersion version;/* same as TLSPlaintext.version */ 843 uint16 length; 844 opaque fragment[TLSCompressed.length]; 845 } TLSCompressed; 847 length 848 The length (in bytes) of the following TLSCompressed.fragment. 849 The length should not exceed 2^14 + 1024. 851 fragment 852 The compressed form of TLSPlaintext.fragment. 854 Note: A CompressionMethod.null operation is an identity operation; no 855 fields are altered. 857 Implementation note: 858 Decompression functions are responsible for ensuring that 859 messages cannot cause internal buffer overflows. 861 6.2.3. Record payload protection 863 The encryption and MAC functions translate a TLSCompressed structure 864 into a TLSCiphertext. The decryption functions reverse the process. 865 The MAC of the record also includes a sequence number so that 866 missing, extra or repeated messages are detectable. 868 struct { 869 ContentType type; 870 ProtocolVersion version; 871 uint16 length; 872 select (CipherSpec.cipher_type) { 873 case stream: GenericStreamCipher; 874 case block: GenericBlockCipher; 875 case aead: GenericAEADCipher; 876 } fragment; 877 } TLSCiphertext; 879 type 880 The type field is identical to TLSCompressed.type. 882 version 883 The version field is identical to TLSCompressed.version. 885 length 886 The length (in bytes) of the following TLSCiphertext.fragment. 887 The length may not exceed 2^14 + 2048. 889 fragment 890 The encrypted form of TLSCompressed.fragment, with the MAC. 892 6.2.3.1. Null or standard stream cipher 894 Stream ciphers (including BulkCipherAlgorithm.null - see Appendix 895 A.6) convert TLSCompressed.fragment structures to and from stream 896 TLSCiphertext.fragment structures. 898 stream-ciphered struct { 899 opaque content[TLSCompressed.length]; 900 opaque MAC[CipherSpec.hash_size]; 901 } GenericStreamCipher; 903 The MAC is generated as: 905 HMAC_hash(MAC_write_secret, seq_num + TLSCompressed.type + 906 TLSCompressed.version + TLSCompressed.length + 907 TLSCompressed.fragment)); 909 where "+" denotes concatenation. 911 seq_num 912 The sequence number for this record. 914 hash 915 The hashing algorithm specified by 916 SecurityParameters.mac_algorithm. 918 Note that the MAC is computed before encryption. The stream cipher 919 encrypts the entire block, including the MAC. For stream ciphers that 920 do not use a synchronization vector (such as RC4), the stream cipher 921 state from the end of one record is simply used on the subsequent 922 packet. If the CipherSuite is TLS_NULL_WITH_NULL_NULL, encryption 923 consists of the identity operation (i.e., the data is not encrypted 924 and the MAC size is zero implying that no MAC is used). 925 TLSCiphertext.length is TLSCompressed.length plus 926 CipherSpec.hash_size. 928 6.2.3.2. CBC block cipher 930 For block ciphers (such as RC2, DES, or AES), the encryption and MAC 931 functions convert TLSCompressed.fragment structures to and from block 932 TLSCiphertext.fragment structures. 934 block-ciphered struct { 935 opaque IV[CipherSpec.block_length]; 936 opaque content[TLSCompressed.length]; 937 opaque MAC[CipherSpec.hash_size]; 938 uint8 padding[GenericBlockCipher.padding_length]; 939 uint8 padding_length; 940 } GenericBlockCipher; 942 The MAC is generated as described in Section 6.2.3.1. 944 IV 945 TLS 1.2 uses an explicit IV in order to prevent the attacks described 946 by [CBCATT]. We recommend the following equivalently strong 947 procedures. For clarity we use the following notation. 949 IV -- the transmitted value of the IV field in the 950 GenericBlockCipher structure. 951 CBC residue -- the last ciphertext block of the previous record 952 mask -- the actual value which the cipher XORs with the 953 plaintext prior to encryption of the first cipher block 954 of the record. 956 In versions of TLS prior to 1.1, there was no IV field and the CBC residue 957 and mask were one and the same. See Sections 6.1, 6.2.3.2 and 6.3, 958 of [TLS1.0] for details of TLS 1.0 IV handling. 960 One of the following two algorithms SHOULD be used to generate the 961 per-record IV: 963 (1) Generate a cryptographically strong random string R of 964 length CipherSpec.block_length. Place R 965 in the IV field. Set the mask to R. Thus, the first 966 cipher block will be encrypted as E(R XOR Data). 968 (2) Generate a cryptographically strong random number R of 969 length CipherSpec.block_length and prepend it to the plaintext 970 prior to encryption. In 971 this case either: 973 (a) The cipher may use a fixed mask such as zero. 974 (b) The CBC residue from the previous record may be used 975 as the mask. This preserves maximum code compatibility 976 with TLS 1.0 and SSL 3. It also has the advantage that 977 it does not require the ability to quickly reset the IV, 978 which is known to be a problem on some systems. 980 In either 2(a) or 2(b) the data (R || data) is fed into the 981 encryption process. The first cipher block (containing 982 E(mask XOR R) is placed in the IV field. The first 983 block of content contains E(IV XOR data) 985 The following alternative procedure MAY be used: However, it has 986 not been demonstrated to be equivalently cryptographically strong 987 to the above procedures. The sender prepends a fixed block F to 988 the plaintext (or alternatively a block generated with a weak 989 PRNG). He then encrypts as in (2) above, using the CBC residue 990 from the previous block as the mask for the prepended block. Note 991 that in this case the mask for the first record transmitted by 992 the application (the Finished) MUST be generated using a 993 cryptographically strong PRNG. 995 The decryption operation for all three alternatives is the same. 996 The receiver decrypts the entire GenericBlockCipher structure and 997 then discards the first cipher block, corresponding to the IV 998 component. 1000 padding 1001 Padding that is added to force the length of the plaintext to be 1002 an integral multiple of the block cipher's block length. The 1003 padding MAY be any length up to 255 bytes long, as long as it 1004 results in the TLSCiphertext.length being an integral multiple of 1005 the block length. Lengths longer than necessary might be 1006 desirable to frustrate attacks on a protocol based on analysis of 1007 the lengths of exchanged messages. Each uint8 in the padding data 1008 vector MUST be filled with the padding length value. The receiver 1009 MUST check this padding and SHOULD use the bad_record_mac alert 1010 to indicate padding errors. 1012 padding_length 1013 The padding length MUST be such that the total size of the 1014 GenericBlockCipher structure is a multiple of the cipher's block 1015 length. Legal values range from zero to 255, inclusive. This 1016 length specifies the length of the padding field exclusive of the 1017 padding_length field itself. 1019 The encrypted data length (TLSCiphertext.length) is one more than the 1020 sum of TLSCompressed.length, CipherSpec.hash_size, and 1021 padding_length. 1023 Example: If the block length is 8 bytes, the content length 1024 (TLSCompressed.length) is 61 bytes, and the MAC length is 20 1025 bytes, the length before padding is 82 bytes (this does not 1026 include the IV, which may or may not be encrypted, as 1027 discussed above). Thus, the padding length modulo 8 must be 1028 equal to 6 in order to make the total length an even multiple 1029 of 8 bytes (the block length). The padding length can be 6, 1030 14, 22, and so on, through 254. If the padding length were the 1031 minimum necessary, 6, the padding would be 6 bytes, each 1032 containing the value 6. Thus, the last 8 octets of the 1033 GenericBlockCipher before block encryption would be xx 06 06 1034 06 06 06 06 06, where xx is the last octet of the MAC. 1036 Note: With block ciphers in CBC mode (Cipher Block Chaining), 1037 it is critical that the entire plaintext of the record be known 1038 before any ciphertext is transmitted. Otherwise it is possible 1039 for the attacker to mount the attack described in [CBCATT]. 1041 Implementation Note: Canvel et. al. [CBCTIME] have demonstrated a 1042 timing attack on CBC padding based on the time required to 1043 compute the MAC. In order to defend against this attack, 1044 implementations MUST ensure that record processing time is 1045 essentially the same whether or not the padding is correct. In 1046 general, the best way to to do this is to compute the MAC even if 1047 the padding is incorrect, and only then reject the packet. For 1048 instance, if the pad appears to be incorrect the implementation 1049 might assume a zero-length pad and then compute the MAC. This 1050 leaves a small timing channel, since MAC performance depends to 1051 some extent on the size of the data fragment, but it is not 1052 believed to be large enough to be exploitable due to the large 1053 block size of existing MACs and the small size of the timing 1054 signal. 1056 6.2.3.3. AEAD ciphers 1058 For AEAD [AEAD] ciphers (such as [CCM] or [GCM]) the AEAD function 1059 converts TLSCompressed.fragment structures to and from AEAD 1060 TLSCiphertext.fragment structures. 1062 aead-ciphered struct { 1063 opaque IV[CipherSpec.iv_length]; 1064 opaque aead_output[AEADEncrypted.length]; 1065 } GenericAEADCipher; 1067 AEAD ciphers take as input a single key, optional IV (depending on 1068 the cipher), plaintext, and "additional data" to be included in the 1069 authentication check. I.e., 1071 AEADEncrypted = AEAD-Encrypt(key, IV, plaintext, 1072 additional_data) 1074 The key is either the client_write_key or the server_write_key. When 1075 AEAD algorithms are used the MAC keys are of zero length and are not 1076 used. The length of the IV depends on the cipher suite. If it is 1077 required it MUST be generated using a cryptographically strong random 1078 number generator. Note that the IV may be zero length. The plaintext 1079 is the TLSCompressed.fragment. The additional_data is defined as 1080 follows: 1082 additional_data = seq_num + TLSCompressed.type + 1083 TLSCompressed.version + TLSCompressed.length; 1085 Where "+" denotes concatenation. 1087 AEADEncrypted.length will generally be larger than 1088 TLSCompressed.length, but by an amount that varies with the cipher 1089 and the required padding (if any). AEAD algorithms MUST NOT produce 1090 an expansion of greater than 1024 bytes. 1092 In order to decrypt and verify, the cipher takes as input the key, 1093 IV, the "additional_data", and the AEADEncrypted value. The output is 1094 either the plaintext or an error indicating that the decryption 1095 failed. There is no separate integrity check. I.e., 1097 TLSCompressed.fragment = AEAD-Decrypt(write_key, IV, AEADEncrypted, 1098 TLSCiphertext.type + TLSCiphertext.version + 1099 TLSCiphertext.length); 1100 If the decryption fails, a fatal bad_record_mac alert MUST be 1101 generated. 1103 6.3. Key calculation 1105 The Record Protocol requires an algorithm to generate keys, and MAC 1106 secrets from the security parameters provided by the handshake 1107 protocol. 1109 The master secret is hashed into a sequence of secure bytes, which 1110 are assigned to the MAC secrets and keys required by the current 1111 connection state (see Appendix A.6). CipherSpecs require a client 1112 write MAC secret, a server write MAC secret, a client write key, and 1113 a server write key, which are generated from the master secret in 1114 that order. Unused values are empty. 1116 When generating keys and MAC secrets, the master secret is used as an 1117 entropy source. 1119 To generate the key material, compute 1121 key_block = PRF(SecurityParameters.master_secret, 1122 "key expansion", 1123 SecurityParameters.server_random + 1124 SecurityParameters.client_random); 1126 until enough output has been generated. Then the key_block is 1127 partitioned as follows: 1129 client_write_MAC_secret[SecurityParameters.hash_size] 1130 server_write_MAC_secret[SecurityParameters.hash_size] 1131 client_write_key[SecurityParameters.key_material_length] 1132 server_write_key[SecurityParameters.key_material_length] 1134 Implementation note: 1135 The currently defined which requires the most material is 1136 AES_256_CBC_SHA, defined in [TLSAES]. It requires 2 x 32 byte 1137 keys and 2 x 20 byte MAC secrets, for a total 104 bytes of key 1138 material. 1140 7. The TLS Handshaking Protocols 1142 TLS has three subprotocols which are used to allow peers to agree 1143 upon security parameters for the record layer, authenticate 1144 themselves, instantiate negotiated security parameters, and 1145 report error conditions to each other. 1147 The Handshake Protocol is responsible for negotiating a session, 1148 which consists of the following items: 1150 session identifier 1151 An arbitrary byte sequence chosen by the server to identify an 1152 active or resumable session state. 1154 peer certificate 1155 X509v3 [X509] certificate of the peer. This element of the 1156 state may be null. 1158 compression method 1159 The algorithm used to compress data prior to encryption. 1161 cipher spec 1162 Specifies the bulk data encryption algorithm (such as null, 1163 DES, etc.) and a MAC algorithm (such as MD5 or SHA). It also 1164 defines cryptographic attributes such as the hash_size. (See 1165 Appendix A.6 for formal definition) 1167 master secret 1168 48-byte secret shared between the client and server. 1170 is resumable 1171 A flag indicating whether the session can be used to initiate 1172 new connections. 1174 These items are then used to create security parameters for use by 1175 the Record Layer when protecting application data. Many connections 1176 can be instantiated using the same session through the resumption 1177 feature of the TLS Handshake Protocol. 1179 7.1. Change cipher spec protocol 1181 The change cipher spec protocol exists to signal transitions in 1182 ciphering strategies. The protocol consists of a single message, 1183 which is encrypted and compressed under the current (not the pending) 1184 connection state. The message consists of a single byte of value 1. 1186 struct { 1187 enum { change_cipher_spec(1), (255) } type; 1188 } ChangeCipherSpec; 1190 The change cipher spec message is sent by both the client and server 1191 to notify the receiving party that subsequent records will be 1192 protected under the newly negotiated CipherSpec and keys. Reception 1193 of this message causes the receiver to instruct the Record Layer to 1194 immediately copy the read pending state into the read current state. 1196 Immediately after sending this message, the sender MUST instruct the 1197 record layer to make the write pending state the write active state. 1198 (See section 6.1.) The change cipher spec message is sent during the 1199 handshake after the security parameters have been agreed upon, but 1200 before the verifying finished message is sent (see section 7.4.11 1202 Note: if a rehandshake occurs while data is flowing on a connection, 1203 the communicating parties may continue to send data using the old 1204 CipherSpec. However, once the ChangeCipherSpec has been sent, the new 1205 CipherSpec MUST be used. The first side to send the ChangeCipherSpec 1206 does not know that the other side has finished computing the new 1207 keying material (e.g. if it has to perform a time consuming public 1208 key operation). Thus, a small window of time during which the 1209 recipient must buffer the data MAY exist. In practice, with modern 1210 machines this interval is likely to be fairly short. 1212 7.2. Alert protocol 1214 One of the content types supported by the TLS Record layer is the 1215 alert type. Alert messages convey the severity of the message and a 1216 description of the alert. Alert messages with a level of fatal result 1217 in the immediate termination of the connection. In this case, other 1218 connections corresponding to the session may continue, but the 1219 session identifier MUST be invalidated, preventing the failed session 1220 from being used to establish new connections. Like other messages, 1221 alert messages are encrypted and compressed, as specified by the 1222 current connection state. 1224 enum { warning(1), fatal(2), (255) } AlertLevel; 1226 enum { 1227 close_notify(0), 1228 unexpected_message(10), 1229 bad_record_mac(20), 1230 decryption_failed(21), 1231 record_overflow(22), 1232 decompression_failure(30), 1233 handshake_failure(40), 1234 no_certificate_RESERVED (41), 1235 bad_certificate(42), 1236 unsupported_certificate(43), 1237 certificate_revoked(44), 1238 certificate_expired(45), 1239 certificate_unknown(46), 1240 illegal_parameter(47), 1241 unknown_ca(48), 1242 access_denied(49), 1243 decode_error(50), 1244 decrypt_error(51), 1245 export_restriction_RESERVED(60), 1246 protocol_version(70), 1247 insufficient_security(71), 1248 internal_error(80), 1249 user_canceled(90), 1250 no_renegotiation(100), 1251 unsupported_extension(110), /* new */ 1252 certificate_unobtainable(111), /* new */ 1253 unrecognized_name(112), /* new */ 1254 bad_certificate_status_response(113), /* new */ 1255 bad_certificate_hash_value(114), /* new */ 1256 (255) 1257 } AlertDescription; 1259 struct { 1260 AlertLevel level; 1261 AlertDescription description; 1262 } Alert; 1264 7.2.1. Closure alerts 1266 The client and the server must share knowledge that the connection is 1267 ending in order to avoid a truncation attack. Either party may 1268 initiate the exchange of closing messages. 1270 close_notify 1271 This message notifies the recipient that the sender will not send 1272 any more messages on this connection. Note that as of TLS 1.1, 1273 failure to properly close a connection no longer requires that a 1274 session not be resumed. This is a change from TLS 1.0 to conform 1275 with widespread implementation practice. 1277 Either party may initiate a close by sending a close_notify alert. 1278 Any data received after a closure alert is ignored. 1280 Unless some other fatal alert has been transmitted, each party is 1281 required to send a close_notify alert before closing the write side 1282 of the connection. The other party MUST respond with a close_notify 1283 alert of its own and close down the connection immediately, 1284 discarding any pending writes. It is not required for the initiator 1285 of the close to wait for the responding close_notify alert before 1286 closing the read side of the connection. 1288 If the application protocol using TLS provides that any data may be 1289 carried over the underlying transport after the TLS connection is 1290 closed, the TLS implementation must receive the responding 1291 close_notify alert before indicating to the application layer that 1292 the TLS connection has ended. If the application protocol will not 1293 transfer any additional data, but will only close the underlying 1294 transport connection, then the implementation MAY choose to close the 1295 transport without waiting for the responding close_notify. No part of 1296 this standard should be taken to dictate the manner in which a usage 1297 profile for TLS manages its data transport, including when 1298 connections are opened or closed. 1300 Note: It is assumed that closing a connection reliably delivers 1301 pending data before destroying the transport. 1303 7.2.2. Error alerts 1305 Error handling in the TLS Handshake protocol is very simple. When an 1306 error is detected, the detecting party sends a message to the other 1307 party. Upon transmission or receipt of an fatal alert message, both 1308 parties immediately close the connection. Servers and clients MUST 1309 forget any session-identifiers, keys, and secrets associated with a 1310 failed connection. Thus, any connection terminated with a fatal alert 1311 MUST NOT be resumed. The following error alerts are defined: 1313 unexpected_message 1314 An inappropriate message was received. This alert is always fatal 1315 and should never be observed in communication between proper 1316 implementations. 1318 bad_record_mac 1319 This alert is returned if a record is received with an incorrect 1320 MAC. This alert also MUST be returned if an alert is sent because 1321 a TLSCiphertext decrypted in an invalid way: either it wasn't an 1322 even multiple of the block length, or its padding values, when 1323 checked, weren't correct. This message is always fatal. 1325 decryption_failed 1326 This alert MAY be returned if a TLSCiphertext decrypted in an 1327 invalid way: either it wasn't an even multiple of the block 1328 length, or its padding values, when checked, weren't correct. 1329 This message is always fatal. 1331 Note: Differentiating between bad_record_mac and 1332 decryption_failed alerts may permit certain attacks against CBC 1333 mode as used in TLS [CBCATT]. It is preferable to uniformly use 1334 the bad_record_mac alert to hide the specific type of the error. 1336 record_overflow 1337 A TLSCiphertext record was received which had a length more than 1338 2^14+2048 bytes, or a record decrypted to a TLSCompressed record 1339 with more than 2^14+1024 bytes. This message is always fatal. 1341 decompression_failure 1342 The decompression function received improper input (e.g. data 1343 that would expand to excessive length). This message is always 1344 fatal. 1346 handshake_failure 1347 Reception of a handshake_failure alert message indicates that the 1348 sender was unable to negotiate an acceptable set of security 1349 parameters given the options available. This is a fatal error. 1351 no_certificate_RESERVED 1352 This alert was used in SSLv3 but not in TLS. It should not be 1353 sent by compliant implementations. 1355 bad_certificate 1356 A certificate was corrupt, contained signatures that did not 1357 verify correctly, etc. 1359 unsupported_certificate 1360 A certificate was of an unsupported type. 1362 certificate_revoked 1363 A certificate was revoked by its signer. 1365 certificate_expired 1366 A certificate has expired or is not currently valid. 1368 certificate_unknown 1369 Some other (unspecified) issue arose in processing the 1370 certificate, rendering it unacceptable. 1372 illegal_parameter 1373 A field in the handshake was out of range or inconsistent with 1374 other fields. This is always fatal. 1376 unknown_ca 1377 A valid certificate chain or partial chain was received, but the 1378 certificate was not accepted because the CA certificate could not 1379 be located or couldn't be matched with a known, trusted CA. This 1380 message is always fatal. 1382 access_denied 1383 A valid certificate was received, but when access control was 1384 applied, the sender decided not to proceed with negotiation. 1385 This message is always fatal. 1387 decode_error 1388 A message could not be decoded because some field was out of the 1389 specified range or the length of the message was incorrect. This 1390 message is always fatal. 1392 decrypt_error 1393 A handshake cryptographic operation failed, including being 1394 unable to correctly verify a signature, decrypt a key exchange, 1395 or validate a finished message. 1397 export_restriction_RESERVED 1398 This alert was used in TLS 1.0 but not TLS 1.1. 1400 protocol_version 1401 The protocol version the client has attempted to negotiate is 1402 recognized, but not supported. (For example, old protocol 1403 versions might be avoided for security reasons). This message is 1404 always fatal. 1406 insufficient_security 1407 Returned instead of handshake_failure when a negotiation has 1408 failed specifically because the server requires ciphers more 1409 secure than those supported by the client. This message is always 1410 fatal. 1412 internal_error 1413 An internal error unrelated to the peer or the correctness of the 1414 protocol makes it impossible to continue (such as a memory 1415 allocation failure). This message is always fatal. 1417 user_canceled 1418 This handshake is being canceled for some reason unrelated to a 1419 protocol failure. If the user cancels an operation after the 1420 handshake is complete, just closing the connection by sending a 1421 close_notify is more appropriate. This alert should be followed 1422 by a close_notify. This message is generally a warning. 1424 no_renegotiation 1425 Sent by the client in response to a hello request or by the 1426 server in response to a client hello after initial handshaking. 1427 Either of these would normally lead to renegotiation; when that 1428 is not appropriate, the recipient should respond with this alert; 1429 at that point, the original requester can decide whether to 1430 proceed with the connection. One case where this would be 1431 appropriate would be where a server has spawned a process to 1432 satisfy a request; the process might receive security parameters 1433 (key length, authentication, etc.) at startup and it might be 1434 difficult to communicate changes to these parameters after that 1435 point. This message is always a warning. 1437 The following error alerts apply only to the extensions described 1438 in Section XXX. To avoid "breaking" existing clients and servers, 1439 these alerts MUST NOT be sent unless the sending party has 1440 received an extended hello message from the party they are 1441 communicating with. 1443 unsupported_extension 1444 sent by clients that receive an extended server hello containing 1445 an extension that they did not put in the corresponding client 1446 hello (see Section 2.3). This message is always fatal. 1448 unrecognized_name 1449 sent by servers that receive a server_name extension request, but 1450 do not recognize the server name. This message MAY be fatal. 1452 certificate_unobtainable 1453 sent by servers who are unable to retrieve a certificate chain 1454 from the URL supplied by the client (see Section 3.3). This 1455 message MAY be fatal - for example if client authentication is 1456 required by the server for the handshake to continue and the 1457 server is unable to retrieve the certificate chain, it may send a 1458 fatal alert. 1460 bad_certificate_status_response 1461 sent by clients that receive an invalid certificate status 1462 response (see Section 3.6). This message is always fatal. 1464 bad_certificate_hash_value 1465 sent by servers when a certificate hash does not match a client 1466 provided certificate_hash. This message is always fatal. 1468 For all errors where an alert level is not explicitly specified, the 1469 sending party MAY determine at its discretion whether this is a fatal 1470 error or not; if an alert with a level of warning is received, the 1471 receiving party MAY decide at its discretion whether to treat this as 1472 a fatal error or not. However, all messages which are transmitted 1473 with a level of fatal MUST be treated as fatal messages. 1475 New alerts values MUST be defined by RFC 2434 Standards Action. See 1476 Section 11 for IANA Considerations for alert values. 1478 7.3. Handshake Protocol overview 1480 The cryptographic parameters of the session state are produced by the 1481 TLS Handshake Protocol, which operates on top of the TLS Record 1482 Layer. When a TLS client and server first start communicating, they 1483 agree on a protocol version, select cryptographic algorithms, 1484 optionally authenticate each other, and use public-key encryption 1485 techniques to generate shared secrets. 1487 The TLS Handshake Protocol involves the following steps: 1489 - Exchange hello messages to agree on algorithms, exchange random 1490 values, and check for session resumption. 1492 - Exchange the necessary cryptographic parameters to allow the 1493 client and server to agree on a premaster secret. 1495 - Exchange certificates and cryptographic information to allow the 1496 client and server to authenticate themselves. 1498 - Generate a master secret from the premaster secret and exchanged 1499 random values. 1501 - Provide security parameters to the record layer. 1503 - Allow the client and server to verify that their peer has 1504 calculated the same security parameters and that the handshake 1505 occurred without tampering by an attacker. 1507 Note that higher layers should not be overly reliant on TLS always 1508 negotiating the strongest possible connection between two peers: 1509 there are a number of ways a man in the middle attacker can attempt 1510 to make two entities drop down to the least secure method they 1511 support. The protocol has been designed to minimize this risk, but 1512 there are still attacks available: for example, an attacker could 1513 block access to the port a secure service runs on, or attempt to get 1514 the peers to negotiate an unauthenticated connection. The fundamental 1515 rule is that higher levels must be cognizant of what their security 1516 requirements are and never transmit information over a channel less 1517 secure than what they require. The TLS protocol is secure, in that 1518 any cipher suite offers its promised level of security: if you 1519 negotiate 3DES with a 1024 bit RSA key exchange with a host whose 1520 certificate you have verified, you can expect to be that secure. 1522 However, you SHOULD never send data over a link encrypted with 40 bit 1523 security unless you feel that data is worth no more than the effort 1524 required to break that encryption. 1526 These goals are achieved by the handshake protocol, which can be 1527 summarized as follows: The client sends a client hello message to 1528 which the server must respond with a server hello message, or else a 1529 fatal error will occur and the connection will fail. The client hello 1530 and server hello are used to establish security enhancement 1531 capabilities between client and server. The client hello and server 1532 hello establish the following attributes: Protocol Version, Session 1533 ID, Cipher Suite, and Compression Method. Additionally, two random 1534 values are generated and exchanged: ClientHello.random and 1535 ServerHello.random. 1537 The actual key exchange uses up to four messages: the server 1538 certificate, the server key exchange, the client certificate, and the 1539 client key exchange. New key exchange methods can be created by 1540 specifying a format for these messages and defining the use of the 1541 messages to allow the client and server to agree upon a shared 1542 secret. This secret MUST be quite long; currently defined key 1543 exchange methods exchange secrets which range from 48 to 128 bytes in 1544 length. 1546 Following the hello messages, the server will send its certificate, 1547 if it is to be authenticated. Additionally, a server key exchange 1548 message may be sent, if it is required (e.g. if their server has no 1549 certificate, or if its certificate is for signing only). If the 1550 server is authenticated, it may request a certificate from the 1551 client, if that is appropriate to the cipher suite selected. Now the 1552 server will send the server hello done message, indicating that the 1553 hello-message phase of the handshake is complete. The server will 1554 then wait for a client response. If the server has sent a certificate 1555 request message, the client must send the certificate message. The 1556 client key exchange message is now sent, and the content of that 1557 message will depend on the public key algorithm selected between the 1558 client hello and the server hello. If the client has sent a 1559 certificate with signing ability, a digitally-signed certificate 1560 verify message is sent to explicitly verify the certificate. 1562 At this point, a change cipher spec message is sent by the client, 1563 and the client copies the pending Cipher Spec into the current Cipher 1564 Spec. The client then immediately sends the finished message under 1565 the new algorithms, keys, and secrets. In response, the server will 1566 send its own change cipher spec message, transfer the pending to the 1567 current Cipher Spec, and send its finished message under the new 1568 Cipher Spec. At this point, the handshake is complete and the client 1569 and server may begin to exchange application layer data. (See flow 1570 chart below.) Application data MUST NOT be sent prior to the 1571 completion of the first handshake (before a cipher suite other 1572 TLS_NULL_WITH_NULL_NULL is established). 1573 Client Server 1575 ClientHello --------> 1576 ServerHello 1577 Certificate* 1578 CertificateStatus* 1579 ServerKeyExchange* 1580 CertificateRequest* 1581 <-------- ServerHelloDone 1582 Certificate* 1583 CertificateURL* 1584 ClientKeyExchange 1585 CertificateVerify* 1586 [ChangeCipherSpec] 1587 Finished --------> 1588 [ChangeCipherSpec] 1589 <-------- Finished 1590 Application Data <-------> Application Data 1592 Fig. 1 - Message flow for a full handshake 1594 * Indicates optional or situation-dependent messages that are not 1595 always sent. 1597 Note: To help avoid pipeline stalls, ChangeCipherSpec is an 1598 independent TLS Protocol content type, and is not actually a TLS 1599 handshake message. 1601 When the client and server decide to resume a previous session or 1602 duplicate an existing session (instead of negotiating new security 1603 parameters) the message flow is as follows: 1605 The client sends a ClientHello using the Session ID of the session to 1606 be resumed. The server then checks its session cache for a match. If 1607 a match is found, and the server is willing to re-establish the 1608 connection under the specified session state, it will send a 1609 ServerHello with the same Session ID value. At this point, both 1610 client and server MUST send change cipher spec messages and proceed 1611 directly to finished messages. Once the re-establishment is complete, 1612 the client and server MAY begin to exchange application layer data. 1613 (See flow chart below.) If a Session ID match is not found, the 1614 server generates a new session ID and the TLS client and server 1615 perform a full handshake. 1617 Client Server 1619 ClientHello --------> 1620 ServerHello 1621 [ChangeCipherSpec] 1622 <-------- Finished 1623 [ChangeCipherSpec] 1624 Finished --------> 1625 Application Data <-------> Application Data 1627 Fig. 2 - Message flow for an abbreviated handshake 1629 The contents and significance of each message will be presented in 1630 detail in the following sections. 1632 7.4. Handshake protocol 1634 The TLS Handshake Protocol is one of the defined higher level clients 1635 of the TLS Record Protocol. This protocol is used to negotiate the 1636 secure attributes of a session. Handshake messages are supplied to 1637 the TLS Record Layer, where they are encapsulated within one or more 1638 TLSPlaintext structures, which are processed and transmitted as 1639 specified by the current active session state. 1641 enum { 1642 hello_request(0), client_hello(1), server_hello(2), 1643 certificate(11), server_key_exchange (12), 1644 certificate_request(13), server_hello_done(14), 1645 certificate_verify(15), client_key_exchange(16), 1646 finished(20), certificate_url(21), certificate_status(22), 1647 (255) 1648 } HandshakeType; 1650 struct { 1651 HandshakeType msg_type; /* handshake type */ 1652 uint24 length; /* bytes in message */ 1653 select (HandshakeType) { 1654 case hello_request: HelloRequest; 1655 case client_hello: ClientHello; 1656 case server_hello: ServerHello; 1657 case certificate: Certificate; 1658 case server_key_exchange: ServerKeyExchange; 1659 case certificate_request: CertificateRequest; 1660 case server_hello_done: ServerHelloDone; 1661 case certificate_verify: CertificateVerify; 1662 case client_key_exchange: ClientKeyExchange; 1663 case finished: Finished; 1664 case certificate_url: CertificateURL; 1665 case certificate_status: CertificateStatus; 1666 } body; 1667 } Handshake; 1669 The handshake protocol messages are presented below in the order they 1670 MUST be sent; sending handshake messages in an unexpected order 1671 results in a fatal error. Unneeded handshake messages can be omitted, 1672 however. Note one exception to the ordering: the Certificate message 1673 is used twice in the handshake (from server to client, then from 1674 client to server), but described only in its first position. The one 1675 message which is not bound by these ordering rules is the Hello 1676 Request message, which can be sent at any time, but which should be 1677 ignored by the client if it arrives in the middle of a handshake. 1679 New Handshake message type values MUST be defined via RFC 2434 1680 Standards Action. See Section 11 for IANA Considerations for these 1681 values. 1683 7.4.1. Hello messages 1685 The hello phase messages are used to exchange security enhancement 1686 capabilities between the client and server. When a new session 1687 begins, the Record Layer's connection state encryption, hash, and 1688 compression algorithms are initialized to null. The current 1689 connection state is used for renegotiation messages. 1691 7.4.1.1. Hello request 1693 When this message will be sent: 1694 The hello request message MAY be sent by the server at any time. 1696 Meaning of this message: 1697 Hello request is a simple notification that the client should 1698 begin the negotiation process anew by sending a client hello 1699 message when convenient. This message will be ignored by the 1700 client if the client is currently negotiating a session. This 1701 message may be ignored by the client if it does not wish to 1702 renegotiate a session, or the client may, if it wishes, respond 1703 with a no_renegotiation alert. Since handshake messages are 1704 intended to have transmission precedence over application data, 1705 it is expected that the negotiation will begin before no more 1706 than a few records are received from the client. If the server 1707 sends a hello request but does not receive a client hello in 1708 response, it may close the connection with a fatal alert. 1710 After sending a hello request, servers SHOULD not repeat the request 1711 until the subsequent handshake negotiation is complete. 1713 Structure of this message: 1714 struct { } HelloRequest; 1716 Note: This message MUST NOT be included in the message hashes which are 1717 maintained throughout the handshake and used in the finished 1718 messages and the certificate verify message. 1720 7.4.1.2. Client hello 1722 When this message will be sent: 1723 When a client first connects to a server it is required to send 1724 the client hello as its first message. The client can also send a 1725 client hello in response to a hello request or on its own 1726 initiative in order to renegotiate the security parameters in an 1727 existing connection. 1729 Structure of this message: 1730 The client hello message includes a random structure, which is 1731 used later in the protocol. 1733 struct { 1734 uint32 gmt_unix_time; 1735 opaque random_bytes[28]; 1736 } Random; 1738 gmt_unix_time 1739 The current time and date in standard UNIX 32-bit format (seconds 1740 since the midnight starting Jan 1, 1970, GMT, ignoring leap 1741 seconds) according to the sender's internal clock. Clocks are not 1742 required to be set correctly by the basic TLS Protocol; higher 1743 level or application protocols may define additional 1744 requirements. 1746 random_bytes 1747 28 bytes generated by a secure random number generator. 1749 The client hello message includes a variable length session 1750 identifier. If not empty, the value identifies a session between the 1751 same client and server whose security parameters the client wishes to 1752 reuse. The session identifier MAY be from an earlier connection, this 1753 connection, or another currently active connection. The second option 1754 is useful if the client only wishes to update the random structures 1755 and derived values of a connection, while the third option makes it 1756 possible to establish several independent secure connections without 1757 repeating the full handshake protocol. These independent connections 1758 may occur sequentially or simultaneously; a SessionID becomes valid 1759 when the handshake negotiating it completes with the exchange of 1760 Finished messages and persists until removed due to aging or because 1761 a fatal error was encountered on a connection associated with the 1762 session. The actual contents of the SessionID are defined by the 1763 server. 1765 opaque SessionID<0..32>; 1767 Warning: 1768 Because the SessionID is transmitted without encryption or 1769 immediate MAC protection, servers MUST not place confidential 1770 information in session identifiers or let the contents of fake 1771 session identifiers cause any breach of security. (Note that the 1772 content of the handshake as a whole, including the SessionID, is 1773 protected by the Finished messages exchanged at the end of the 1774 handshake.) 1776 The CipherSuite list, passed from the client to the server in the 1777 client hello message, contains the combinations of cryptographic 1778 algorithms supported by the client in order of the client's 1779 preference (favorite choice first). Each CipherSuite defines a key 1780 exchange algorithm, a bulk encryption algorithm (including secret key 1781 length) and a MAC algorithm. The server will select a cipher suite 1782 or, if no acceptable choices are presented, return a handshake 1783 failure alert and close the connection. 1785 uint8 CipherSuite[2]; /* Cryptographic suite selector */ 1787 The client hello includes a list of compression algorithms supported 1788 by the client, ordered according to the client's preference. 1790 enum { null(0), (255) } CompressionMethod; 1792 struct { 1793 ProtocolVersion client_version; 1794 Random random; 1795 SessionID session_id; 1796 CipherSuite cipher_suites<2..2^16-1>; 1797 CompressionMethod compression_methods<1..2^8-1>; 1798 } ClientHello; 1800 If the client wishes to use extensions (see Section XXX), 1801 it may send an ExtendedClientHello: 1803 struct { 1804 ProtocolVersion client_version; 1805 Random random; 1806 SessionID session_id; 1807 CipherSuite cipher_suites<2..2^16-1>; 1808 CompressionMethod compression_methods<1..2^8-1>; 1809 Extension client_hello_extension_list<0..2^16-1>; 1810 } ExtendedClientHello; 1812 These two messages can be distinguished by determining whether there 1813 are bytes following what would be the end of the ClientHello. 1815 client_version 1816 The version of the TLS protocol by which the client wishes to 1817 communicate during this session. This SHOULD be the latest 1818 (highest valued) version supported by the client. For this 1819 version of the specification, the version will be 3.2 (See 1820 Appendix E for details about backward compatibility). 1822 random 1823 A client-generated random structure. 1825 session_id 1826 The ID of a session the client wishes to use for this connection. 1827 This field should be empty if no session_id is available or the 1828 client wishes to generate new security parameters. 1830 cipher_suites 1831 This is a list of the cryptographic options supported by the 1832 client, with the client's first preference first. If the 1833 session_id field is not empty (implying a session resumption 1834 request) this vector MUST include at least the cipher_suite from 1835 that session. Values are defined in Appendix A.5. 1837 compression_methods 1838 This is a list of the compression methods supported by the 1839 client, sorted by client preference. If the session_id field is 1840 not empty (implying a session resumption request) it must include 1841 the compression_method from that session. This vector must 1842 contain, and all implementations must support, 1843 CompressionMethod.null. Thus, a client and server will always be 1844 able to agree on a compression method. 1846 client_hello_extension_list 1847 Clients MAY request extended functionality from servers by 1848 sending data in the client_hello_extension_list. Here the new 1849 "client_hello_extension_list" field contains a list of 1850 extensions. The actual "Extension" format is defined in Section 1851 XXX. 1853 In the event that a client requests additional functionality 1854 using the extended client hello, and this functionality is not 1855 supplied by the server, the client MAY abort the handshake. 1857 A server that supports the extensions mechanism MUST accept only 1858 client hello messages in either the original or extended 1859 ClientHello ormat, and (as for all other messages) MUST check 1860 that the amount of data in the message precisely matches one of 1861 these formats; if not then it MUST send a fatal "decode_error" 1862 alert. 1864 After sending the client hello message, the client waits for a server 1865 hello message. Any other handshake message returned by the server 1866 except for a hello request is treated as a fatal error. 1868 7.4.1.3. Server hello 1870 When this message will be sent: 1871 The server will send this message in response to a client hello 1872 message when it was able to find an acceptable set of algorithms. If 1873 it cannot find such a match, it will respond with a handshake failure 1874 alert. 1876 Structure of this message: 1877 struct { 1878 ProtocolVersion server_version; 1879 Random random; 1880 SessionID session_id; 1881 CipherSuite cipher_suite; 1882 CompressionMethod compression_method; 1883 } ServerHello; 1885 If the server is sending an extension, it should use the 1886 ExtendedServerHello: 1888 struct { 1889 ProtocolVersion server_version; 1890 Random random; 1891 SessionID session_id; 1892 CipherSuite cipher_suite; 1893 CompressionMethod compression_method; 1894 Extension server_hello_extension_list<0..2^16-1>; 1895 } ExtendedServerHello; 1897 These two messages can be distinguished by determining whether there 1898 are bytes following what would be the end of the ServerHello. 1900 server_version 1901 This field will contain the lower of that suggested by the client in 1902 the client hello and the highest supported by the server. For this 1903 version of the specification, the version is 3.2 (See Appendix E for 1904 details about backward compatibility). 1906 random 1907 This structure is generated by the server and MUST be independently 1908 generated from the ClientHello.random. 1910 session_id 1911 This is the identity of the session corresponding to this connection. 1912 If the ClientHello.session_id was non-empty, the server will look in 1913 its session cache for a match. If a match is found and the server is 1914 willing to establish the new connection using the specified session 1915 state, the server will respond with the same value as was supplied by 1916 the client. This indicates a resumed session and dictates that the 1917 parties must proceed directly to the finished messages. Otherwise 1918 this field will contain a different value identifying the new 1919 session. The server may return an empty session_id to indicate that 1920 the session will not be cached and therefore cannot be resumed. If a 1921 session is resumed, it must be resumed using the same cipher suite it 1922 was originally negotiated with. 1924 cipher_suite 1925 The single cipher suite selected by the server from the list in 1926 ClientHello.cipher_suites. For resumed sessions this field is the 1927 value from the state of the session being resumed. 1929 compression_method 1930 The single compression algorithm selected by the server from the list 1931 in ClientHello.compression_methods. For resumed sessions this field 1932 is the value from the resumed session state. 1934 server_hello_extension_list 1935 A list of extensions. Note that only extensions offered by the client 1936 can appear in the server's list. 1938 7.4.1.4 Hello Extensions 1940 The extension format for extended client hellos and extended server 1941 hellos is: 1943 struct { 1944 ExtensionType extension_type; 1945 opaque extension_data<0..2^16-1>; 1946 } Extension; 1947 Here: 1949 - "extension_type" identifies the particular extension type. 1951 - "extension_data" contains information specific to the particular 1952 extension type. 1954 The extension types defined in this document are: 1956 enum { 1957 server_name(0), max_fragment_length(1), 1958 client_certificate_url(2), trusted_ca_keys(3), 1959 truncated_hmac(4), status_request(5), 1960 cert_hash_types(6), (65535) 1961 } ExtensionType; 1963 The list of defined extension types is maintained by the IANA. The 1964 current list can be found at (http://www.iana.org/assignments/tls- 1965 extensions). See sections 7.4.1.4.8 and 11.1 for more information on 1966 how new values are added. 1968 Note that for all extension types (including those defined in 1969 future), the extension type MUST NOT appear in the extended server 1970 hello unless the same extension type appeared in the corresponding 1971 client hello. Thus clients MUST abort the handshake if they receive 1972 an extension type in the extended server hello that they did not 1973 request in the associated (extended) client hello. 1975 Nonetheless "server oriented" extensions may be provided in the 1976 future within this framework - such an extension, say of type x, 1977 would require the client to first send an extension of type x in the 1978 (extended) client hello with empty extension_data to indicate that it 1979 supports the extension type. In this case the client is offering the 1980 capability to understand the extension type, and the server is taking 1981 the client up on its offer. 1983 Also note that when multiple extensions of different types are 1984 present in the extended client hello or the extended server hello, 1985 the extensions may appear in any order. There MUST NOT be more than 1986 one extension of the same type. 1988 An extended client hello may be sent both when starting a new session 1989 and when requesting session resumption. Indeed a client that 1990 requests resumption of a session does not in general know whether the 1991 server will accept this request, and therefore it SHOULD send an 1992 extended client hello if it would normally do so for a new session. 1993 In general the specification of each extension type must include a 1994 discussion of the effect of the extension both during new sessions 1995 and during resumed sessions. 1997 Note also that all the extensions defined in this document are 1998 relevant only when a session is initiated. When a client includes one 1999 or more of the defined extension types in an extended client hello 2000 while requesting session resumption: 2002 - If the resumption request is denied, the use of the extensions 2003 is negotiated as normal. 2005 - If, on the other hand, the older session is resumed, then the 2006 server MUST ignore the extensions and send a server hello 2007 containing none of the extension types; in this case the 2008 functionality of these extensions negotiated during the original 2009 session initiation is applied to the resumed session. 2011 7.4.1.4.1 Server Name Indication 2013 [TLS1.1] does not provide a mechanism for a client to tell a server 2014 the name of the server it is contacting. It may be desirable for 2015 clients to provide this information to facilitate secure connections 2016 to servers that host multiple 'virtual' servers at a single 2017 underlying network address. 2019 In order to provide the server name, clients MAY include an extension 2020 of type "server_name" in the (extended) client hello. The 2021 "extension_data" field of this extension SHALL contain 2022 "ServerNameList" where: 2024 struct { 2025 NameType name_type; 2026 select (name_type) { 2027 case host_name: HostName; 2028 } name; 2029 } ServerName; 2031 enum { 2032 host_name(0), (255) 2033 } NameType; 2035 opaque HostName<1..2^16-1>; 2037 struct { 2038 ServerName server_name_list<1..2^16-1> 2039 } ServerNameList; 2041 Currently the only server names supported are DNS hostnames, however 2042 this does not imply any dependency of TLS on DNS, and other name 2043 types may be added in the future (by an RFC that Updates this 2044 document). TLS MAY treat provided server names as opaque data and 2045 pass the names and types to the application. 2047 "HostName" contains the fully qualified DNS hostname of the server, 2048 as understood by the client. The hostname is represented as a byte 2049 string using UTF-8 encoding [UTF8], without a trailing dot. 2051 If the hostname labels contain only US-ASCII characters, then the 2052 client MUST ensure that labels are separated only by the byte 0x2E, 2053 representing the dot character U+002E (requirement 1 in section 3.1 2054 of [IDNA] notwithstanding). If the server needs to match the HostName 2055 against names that contain non-US-ASCII characters, it MUST perform 2056 the conversion operation described in section 4 of [IDNA], treating 2057 the HostName as a "query string" (i.e. the AllowUnassigned flag MUST 2058 be set). Note that IDNA allows labels to be separated by any of the 2059 Unicode characters U+002E, U+3002, U+FF0E, and U+FF61, therefore 2060 servers MUST accept any of these characters as a label separator. If 2061 the server only needs to match the HostName against names containing 2062 exclusively ASCII characters, it MUST compare ASCII names case- 2063 insensitively. 2065 Literal IPv4 and IPv6 addresses are not permitted in "HostName". It 2066 is RECOMMENDED that clients include an extension of type 2067 "server_name" in the client hello whenever they locate a server by a 2068 supported name type. 2070 A server that receives a client hello containing the "server_name" 2071 extension, MAY use the information contained in the extension to 2072 guide its selection of an appropriate certificate to return to the 2073 client, and/or other aspects of security policy. In this event, the 2074 server SHALL include an extension of type "server_name" in the 2075 (extended) server hello. The "extension_data" field of this 2076 extension SHALL be empty. 2078 If the server understood the client hello extension but does not 2079 recognize the server name, it SHOULD send an "unrecognized_name" 2080 alert (which MAY be fatal). 2082 If an application negotiates a server name using an application 2083 protocol, then upgrades to TLS, and a server_name extension is sent, 2084 then the extension SHOULD contain the same name that was negotiated 2085 in the application protocol. If the server_name is established in 2086 the TLS session handshake, the client SHOULD NOT attempt to request a 2087 different server name at the application layer. 2089 7.4.1.4.2 Maximum Fragment Length Negotiation 2090 By default, TLS uses fixed maximum plaintext fragment length of 2^14 2091 bytes. It may be desirable for constrained clients to negotiate a 2092 smaller maximum fragment length due to memory limitations or 2093 bandwidth limitations. 2095 In order to negotiate smaller maximum fragment lengths, clients MAY 2096 include an extension of type "max_fragment_length" in the (extended) 2097 client hello. The "extension_data" field of this extension SHALL 2098 contain: 2100 enum{ 2101 2^9(1), 2^10(2), 2^11(3), 2^12(4), (255) 2102 } MaxFragmentLength; 2104 whose value is the desired maximum fragment length. The allowed 2105 values for this field are: 2^9, 2^10, 2^11, and 2^12. 2107 Servers that receive an extended client hello containing a 2108 "max_fragment_length" extension, MAY accept the requested maximum 2109 fragment length by including an extension of type 2110 "max_fragment_length" in the (extended) server hello. The 2111 "extension_data" field of this extension SHALL contain 2112 "MaxFragmentLength" whose value is the same as the requested maximum 2113 fragment length. 2115 If a server receives a maximum fragment length negotiation request 2116 for a value other than the allowed values, it MUST abort the 2117 handshake with an "illegal_parameter" alert. Similarly, if a client 2118 receives a maximum fragment length negotiation response that differs 2119 from the length it requested, it MUST also abort the handshake with 2120 an "illegal_parameter" alert. 2122 Once a maximum fragment length other than 2^14 has been successfully 2123 negotiated, the client and server MUST immediately begin fragmenting 2124 messages (including handshake messages), to ensure that no fragment 2125 larger than the negotiated length is sent. Note that TLS already 2126 requires clients and servers to support fragmentation of handshake 2127 messages. 2129 The negotiated length applies for the duration of the session 2130 including session resumptions. 2132 The negotiated length limits the input that the record layer may 2133 process without fragmentation (that is, the maximum value of 2134 TLSPlaintext.length; see [TLS] section 6.2.1). Note that the output 2135 of the record layer may be larger. For example, if the negotiated 2136 length is 2^9=512, then for currently defined cipher suites and when 2137 null compression is used, the record layer output can be at most 793 2138 bytes: 5 bytes of headers, 512 bytes of application data, 256 bytes 2139 of padding, and 20 bytes of MAC. That means that in this event a TLS 2140 record layer peer receiving a TLS record layer message larger than 2141 793 bytes may discard the message and send a "record_overflow" alert, 2142 without decrypting the message. 2144 7.4.1.4.3 Client Certificate URLs 2146 Ordinarily, when client authentication is performed, client 2147 certificates are sent by clients to servers during the TLS handshake. 2148 It may be desirable for constrained clients to send certificate URLs 2149 in place of certificates, so that they do not need to store their 2150 certificates and can therefore save memory. 2152 In order to negotiate to send certificate URLs to a server, clients 2153 MAY include an extension of type "client_certificate_url" in the 2154 (extended) client hello. The "extension_data" field of this 2155 extension SHALL be empty. 2157 (Note that it is necessary to negotiate use of client certificate 2158 URLs in order to avoid "breaking" existing TLS 1.0 servers.) 2160 Servers that receive an extended client hello containing a 2161 "client_certificate_url" extension, MAY indicate that they are 2162 willing to accept certificate URLs by including an extension of type 2163 "client_certificate_url" in the (extended) server hello. The 2164 "extension_data" field of this extension SHALL be empty. 2166 After negotiation of the use of client certificate URLs has been 2167 successfully completed (by exchanging hellos including 2168 "client_certificate_url" extensions), clients MAY send a 2169 "CertificateURL" message in place of a "Certificate" message. See 2170 Section XXX. 2172 7.4.1.4.4 Trusted CA Indication 2174 Constrained clients that, due to memory limitations, possess only a 2175 small number of CA root keys, may wish to indicate to servers which 2176 root keys they possess, in order to avoid repeated handshake 2177 failures. 2179 In order to indicate which CA root keys they possess, clients MAY 2180 include an extension of type "trusted_ca_keys" in the (extended) 2181 client hello. The "extension_data" field of this extension SHALL 2182 contain "TrustedAuthorities" where: 2184 struct { 2185 TrustedAuthority trusted_authorities_list<0..2^16-1>; 2186 } TrustedAuthorities; 2188 struct { 2189 IdentifierType identifier_type; 2190 select (identifier_type) { 2191 case pre_agreed: struct {}; 2192 case key_sha1_hash: SHA1Hash; 2193 case x509_name: DistinguishedName; 2194 case cert_sha1_hash: SHA1Hash; 2195 } identifier; 2196 } TrustedAuthority; 2198 enum { 2199 pre_agreed(0), key_sha1_hash(1), x509_name(2), 2200 cert_sha1_hash(3), (255) 2201 } IdentifierType; 2203 opaque DistinguishedName<1..2^16-1>; 2205 Here "TrustedAuthorities" provides a list of CA root key identifiers 2206 that the client possesses. Each CA root key is identified via 2207 either: 2209 - "pre_agreed" - no CA root key identity supplied. 2211 - "key_sha1_hash" - contains the SHA-1 hash of the CA root key. 2212 For 2213 DSA and ECDSA keys, this is the hash of the "subjectPublicKey" 2214 value. For RSA keys, the hash is of the big-endian byte string 2215 representation of the modulus without any initial 0-valued bytes. 2216 (This copies the key hash formats deployed in other 2217 environments.) 2219 - "x509_name" - contains the DER-encoded X.509 DistinguishedName 2220 of 2221 the CA. 2223 - "cert_sha1_hash" - contains the SHA-1 hash of a DER-encoded 2224 Certificate containing the CA root key. 2226 Note that clients may include none, some, or all of the CA root keys 2227 they possess in this extension. 2229 Note also that it is possible that a key hash or a Distinguished Name 2230 alone may not uniquely identify a certificate issuer - for example if 2231 a particular CA has multiple key pairs - however here we assume this 2232 is the case following the use of Distinguished Names to identify 2233 certificate issuers in TLS. 2235 The option to include no CA root keys is included to allow the client 2236 to indicate possession of some pre-defined set of CA root keys. 2238 Servers that receive a client hello containing the "trusted_ca_keys" 2239 extension, MAY use the information contained in the extension to 2240 guide their selection of an appropriate certificate chain to return 2241 to the client. In this event, the server SHALL include an extension 2242 of type "trusted_ca_keys" in the (extended) server hello. The 2243 "extension_data" field of this extension SHALL be empty. 2245 7.4.1.4.5 Truncated HMAC 2247 Currently defined TLS cipher suites use the MAC construction HMAC 2248 with either MD5 or SHA-1 [HMAC] to authenticate record layer 2249 communications. In TLS the entire output of the hash function is 2250 used as the MAC tag. However it may be desirable in constrained 2251 environments to save bandwidth by truncating the output of the hash 2252 function to 80 bits when forming MAC tags. 2254 In order to negotiate the use of 80-bit truncated HMAC, clients MAY 2255 include an extension of type "truncated_hmac" in the extended client 2256 hello. The "extension_data" field of this extension SHALL be empty. 2258 Servers that receive an extended hello containing a "truncated_hmac" 2259 extension, MAY agree to use a truncated HMAC by including an 2260 extension of type "truncated_hmac", with empty "extension_data", in 2261 the extended server hello. 2263 Note that if new cipher suites are added that do not use HMAC, and 2264 the session negotiates one of these cipher suites, this extension 2265 will have no effect. It is strongly recommended that any new cipher 2266 suites using other MACs consider the MAC size as an integral part of 2267 the cipher suite definition, taking into account both security and 2268 bandwidth considerations. 2270 If HMAC truncation has been successfully negotiated during a TLS 2271 handshake, and the negotiated cipher suite uses HMAC, both the client 2272 and the server pass this fact to the TLS record layer along with the 2273 other negotiated security parameters. Subsequently during the 2274 session, clients and servers MUST use truncated HMACs, calculated as 2275 specified in [HMAC]. That is, CipherSpec.hash_size is 10 bytes, and 2276 only the first 10 bytes of the HMAC output are transmitted and 2277 checked. Note that this extension does not affect the calculation of 2278 the PRF as part of handshaking or key derivation. 2280 The negotiated HMAC truncation size applies for the duration of the 2281 session including session resumptions. 2283 7.4.1.4.6 Certificate Status Request 2285 Constrained clients may wish to use a certificate-status protocol 2286 such as OCSP [OCSP] to check the validity of server certificates, in 2287 order to avoid transmission of CRLs and therefore save bandwidth on 2288 constrained networks. This extension allows for such information to 2289 be sent in the TLS handshake, saving roundtrips and resources. 2291 In order to indicate their desire to receive certificate status 2292 information, clients MAY include an extension of type 2293 "status_request" in the (extended) client hello. The 2294 "extension_data" field of this extension SHALL contain 2295 "CertificateStatusRequest" where: 2297 struct { 2298 CertificateStatusType status_type; 2299 select (status_type) { 2300 case ocsp: OCSPStatusRequest; 2301 } request; 2302 } CertificateStatusRequest; 2304 enum { ocsp(1), (255) } CertificateStatusType; 2306 struct { 2307 ResponderID responder_id_list<0..2^16-1>; 2308 Extensions request_extensions; 2309 } OCSPStatusRequest; 2311 opaque ResponderID<1..2^16-1>; 2313 In the OCSPStatusRequest, the "ResponderIDs" provides a list of OCSP 2314 responders that the client trusts. A zero-length "responder_id_list" 2315 sequence has the special meaning that the responders are implicitly 2316 known to the server - e.g., by prior arrangement. "Extensions" is a 2317 DER encoding of OCSP request extensions. 2319 Both "ResponderID" and "Extensions" are DER-encoded ASN.1 types as 2320 defined in [OCSP]. "Extensions" is imported from [PKIX]. A zero- 2321 length "request_extensions" value means that there are no extensions 2322 (as opposed to a zero-length ASN.1 SEQUENCE, which is not valid for 2323 the "Extensions" type). 2325 In the case of the "id-pkix-ocsp-nonce" OCSP extension, [OCSP] is 2326 unclear about its encoding; for clarification, the nonce MUST be a 2327 DER-encoded OCTET STRING, which is encapsulated as another OCTET 2328 STRING (note that implementations based on an existing OCSP client 2329 will need to be checked for conformance to this requirement). 2331 Servers that receive a client hello containing the "status_request" 2332 extension, MAY return a suitable certificate status response to the 2333 client along with their certificate. If OCSP is requested, they 2334 SHOULD use the information contained in the extension when selecting 2335 an OCSP responder, and SHOULD include request_extensions in the OCSP 2336 request. 2338 Servers return a certificate response along with their certificate by 2339 sending a "CertificateStatus" message immediately after the 2340 "Certificate" message (and before any "ServerKeyExchange" or 2341 "CertificateRequest" messages). Section XXX describes the 2342 CertificateStatus message. 2344 7.4.1.4.7 Cert Hash Types 2346 The client MAY use the "cert_hash_types" to indicate to the server 2347 which hash functions may be used in the signature on the server's 2348 certificate. The "extension_data" field of this extension contains: 2350 enum{ 2351 md5(0), sha1(1), sha256(2), sha384(3), sha512(4), (255) 2352 } HashType; 2354 struct { 2355 HashType<255> types; 2356 } CertHashTypes; 2358 These values indicate support for MD5 [MD5], SHA-1, SHA-256, SHA-384, 2359 and SHA-512 [SHA] respectively. The server MUST NOT send this 2360 extension. 2362 Clients SHOULD send this extension if they support any algorithm 2363 other than SHA-1. If this extension is not used, servers SHOULD 2364 assume that the client supports only SHA-1. Note: this is a change 2365 from TLS 1.1 where there are no explicit rules but as a practical 2366 matter one can assume that the peer supports MD5 and SHA-1. 2368 HashType values are divided into three groups: 2370 1. Values from 0 (zero) through 63 decimal (0x3F) inclusive are 2371 reserved for IETF Standards Track protocols. 2373 2. Values from 64 decimal (0x40) through 223 decimal (0xDF) inclusive 2374 are reserved for assignment for non-Standards Track methods. 2376 3. Values from 224 decimal (0xE0) through 255 decimal (0xFF) 2377 inclusive are reserved for private use. 2379 Additional information describing the role of IANA in the 2380 allocation of HashType code points is described 2381 in Section 11. 2383 7.4.1.4.8 Procedure for Defining New Extensions 2385 The list of extension types, as defined in Section 2.3, is 2386 maintained by the Internet Assigned Numbers Authority (IANA). Thus 2387 an application needs to be made to the IANA in order to obtain a new 2388 extension type value. Since there are subtle (and not so subtle) 2389 interactions that may occur in this protocol between new features and 2390 existing features which may result in a significant reduction in 2391 overall security, new values SHALL be defined only through the IETF 2392 Consensus process specified in [IANA]. 2394 (This means that new assignments can be made only via RFCs approved 2395 by the IESG.) 2397 The following considerations should be taken into account when 2398 designing new extensions: 2400 - All of the extensions defined in this document follow the 2401 convention that for each extension that a client requests and that 2402 the server understands, the server replies with an extension of 2403 the same type. 2405 - Some cases where a server does not agree to an extension are error 2406 conditions, and some simply a refusal to support a particular 2407 feature. In general error alerts should be used for the former, 2408 and a field in the server extension response for the latter. 2410 - Extensions should as far as possible be designed to prevent any 2411 attack that forces use (or non-use) of a particular feature by 2412 manipulation of handshake messages. This principle should be 2413 followed regardless of whether the feature is believed to cause a 2414 security problem. 2416 Often the fact that the extension fields are included in the 2417 inputs to the Finished message hashes will be sufficient, but 2418 extreme care is needed when the extension changes the meaning of 2419 messages sent in the handshake phase. Designers and implementors 2420 should be aware of the fact that until the handshake has been 2421 authenticated, active attackers can modify messages and insert, 2422 remove, or replace extensions. 2424 - It would be technically possible to use extensions to change major 2425 aspects of the design of TLS; for example the design of cipher 2426 suite negotiation. This is not recommended; it would be more 2427 appropriate to define a new version of TLS - particularly since 2428 the TLS handshake algorithms have specific protection against 2429 version rollback attacks based on the version number, and the 2430 possibility of version rollback should be a significant 2431 consideration in any major design change. 2433 7.4.2. Server certificate 2435 When this message will be sent: 2436 The server MUST send a certificate whenever the agreed-upon key 2437 exchange method is not an anonymous one. This message will 2438 always immediately follow the server hello message. 2440 Meaning of this message: 2441 The certificate type MUST be appropriate for the selected cipher 2442 suite's key exchange algorithm, and is generally an X.509v3 2443 certificate. It MUST contain a key which matches the key 2444 exchange method, as follows. Unless otherwise specified, the 2445 signing 2446 algorithm for the certificate MUST be the same as the 2447 algorithm for the certificate key. Unless otherwise specified, 2448 the public key MAY be of any length. 2450 Key Exchange Algorithm Certificate Key Type 2452 RSA RSA public key; the certificate MUST 2453 allow the key to be used for encryption. 2455 DHE_DSS DSS public key. 2457 DHE_RSA RSA public key which can be used for 2458 signing. 2460 DH_DSS Diffie-Hellman key. The algorithm used 2461 to sign the certificate MUST be DSS. 2463 DH_RSA Diffie-Hellman key. The algorithm used 2464 to sign the certificate MUST be RSA. 2466 All certificate profiles, key and cryptographic formats are defined 2467 by the IETF PKIX working group [PKIX]. When a key usage extension is 2468 present, the digitalSignature bit MUST be set for the key to be 2469 eligible for signing, as described above, and the keyEncipherment bit 2470 MUST be present to allow encryption, as described above. The 2471 keyAgreement bit must be set on Diffie-Hellman certificates. 2473 As CipherSuites which specify new key exchange methods are specified 2474 for the TLS Protocol, they will imply certificate format and the 2475 required encoded keying information. 2477 Structure of this message: 2478 opaque ASN.1Cert<1..2^24-1>; 2480 struct { 2481 ASN.1Cert certificate_list<0..2^24-1>; 2482 } Certificate; 2484 certificate_list 2485 This is a sequence (chain) of X.509v3 certificates. The sender's 2486 certificate must come first in the list. Each following 2487 certificate must directly certify the one preceding it. Because 2488 certificate validation requires that root keys be distributed 2489 independently, the self-signed certificate which specifies the 2490 root certificate authority may optionally be omitted from the 2491 chain, under the assumption that the remote end must already 2492 possess it in order to validate it in any case. 2494 The same message type and structure will be used for the client's 2495 response to a certificate request message. Note that a client MAY 2496 send no certificates if it does not have an appropriate certificate 2497 to send in response to the server's authentication request. 2499 Note: PKCS #7 [PKCS7] is not used as the format for the certificate 2500 vector because PKCS #6 [PKCS6] extended certificates are not 2501 used. Also PKCS #7 defines a SET rather than a SEQUENCE, making 2502 the task of parsing the list more difficult. 2504 7.4.3. Server key exchange message 2506 When this message will be sent: 2507 This message will be sent immediately after the server 2508 certificate message (or the server hello message, if this is an 2509 anonymous negotiation). 2511 The server key exchange message is sent by the server only when 2512 the server certificate message (if sent) does not contain enough 2513 data to allow the client to exchange a premaster secret. This is 2514 true for the following key exchange methods: 2516 DHE_DSS 2517 DHE_RSA 2518 DH_anon 2520 It is not legal to send the server key exchange message for the 2521 following key exchange methods: 2523 RSA 2524 DH_DSS 2525 DH_RSA 2527 Meaning of this message: 2528 This message conveys cryptographic information to allow the 2529 client to communicate the premaster secret: either an RSA public 2530 key to encrypt the premaster secret with, or a Diffie-Hellman 2531 public key with which the client can complete a key exchange 2532 (with the result being the premaster secret.) 2534 As additional CipherSuites are defined for TLS which include new key 2535 exchange algorithms, the server key exchange message will be sent if 2536 and only if the certificate type associated with the key exchange 2537 algorithm does not provide enough information for the client to 2538 exchange a premaster secret. 2540 If the SignatureAlgorithm being used to sign the ServerKeyExchange 2541 message is DSA, the hash function used MUST be SHA-1. If the 2542 SignatureAlgorithm it must be the same hash function used in the 2543 signature of the server's certificate (found in the Certificate) 2544 message. This algorithm is denoted Hash below. Hash.length is the 2545 length of the output of that algorithm. 2547 Structure of this message: 2548 enum { rsa, diffie_hellman } KeyExchangeAlgorithm; 2550 struct { 2551 opaque rsa_modulus<1..2^16-1>; 2552 opaque rsa_exponent<1..2^16-1>; 2553 } ServerRSAParams; 2555 rsa_modulus 2556 The modulus of the server's temporary RSA key. 2558 rsa_exponent 2559 The public exponent of the server's temporary RSA key. 2561 struct { 2562 opaque dh_p<1..2^16-1>; 2563 opaque dh_g<1..2^16-1>; 2564 opaque dh_Ys<1..2^16-1>; 2565 } ServerDHParams; /* Ephemeral DH parameters */ 2567 dh_p 2568 The prime modulus used for the Diffie-Hellman operation. 2570 dh_g 2571 The generator used for the Diffie-Hellman operation. 2573 dh_Ys 2574 The server's Diffie-Hellman public value (g^X mod p). 2576 struct { 2577 select (KeyExchangeAlgorithm) { 2578 case diffie_hellman: 2579 ServerDHParams params; 2580 Signature signed_params; 2581 case rsa: 2582 ServerRSAParams params; 2583 Signature signed_params; 2584 }; 2585 } ServerKeyExchange; 2587 struct { 2588 select (KeyExchangeAlgorithm) { 2589 case diffie_hellman: 2590 ServerDHParams params; 2591 case rsa: 2592 ServerRSAParams params; 2593 }; 2594 } ServerParams; 2596 params 2597 The server's key exchange parameters. 2599 signed_params 2600 For non-anonymous key exchanges, a hash of the corresponding 2601 params value, with the signature appropriate to that hash 2602 applied. 2604 hash 2605 Hash(ClientHello.random + ServerHello.random + ServerParams) 2607 sha_hash 2608 SHA1(ClientHello.random + ServerHello.random + ServerParams) 2610 enum { anonymous, rsa, dsa } SignatureAlgorithm; 2612 struct { 2613 select (SignatureAlgorithm) { 2614 case anonymous: struct { }; 2615 case rsa: 2616 digitally-signed struct { 2617 opaque hash[Hash.length]; 2618 }; 2619 case dsa: 2620 digitally-signed struct { 2621 opaque sha_hash[20]; 2622 }; 2623 }; 2624 }; 2625 } Signature; 2627 7.4.4. CertificateStatus 2629 If a server returns a 2630 "CertificateStatus" message, then the server MUST have included an 2631 extension of type "status_request" with empty "extension_data" in the 2632 extended server hello. 2634 struct { 2635 CertificateStatusType status_type; 2636 select (status_type) { 2637 case ocsp: OCSPResponse; 2638 } response; 2639 } CertificateStatus; 2641 opaque OCSPResponse<1..2^24-1>; 2643 An "ocsp_response" contains a complete, DER-encoded OCSP response 2644 (using the ASN.1 type OCSPResponse defined in [OCSP]). Note that 2645 only one OCSP response may be sent. 2647 The "CertificateStatus" message is conveyed using the handshake 2648 message type "certificate_status". 2650 Note that a server MAY also choose not to send a "CertificateStatus" 2651 message, even if it receives a "status_request" extension in the 2652 client hello message. 2654 Note in addition that servers MUST NOT send the "CertificateStatus" 2655 message unless it received a "status_request" extension in the client 2656 hello message. 2658 Clients requesting an OCSP response, and receiving an OCSP response 2659 in a "CertificateStatus" message MUST check the OCSP response and 2660 abort the handshake if the response is not satisfactory. 2662 7.4.5. Certificate request 2663 When this message will be sent: 2664 A non-anonymous server can optionally request a certificate from 2665 the client, if appropriate for the selected cipher suite. This 2666 message, if sent, will immediately follow the Server Key Exchange 2667 message (if it is sent; otherwise, the Server Certificate 2668 message). 2670 Structure of this message: 2671 enum { 2672 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 2673 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 2674 fortezza_dms_RESERVED(20), 2675 (255) 2676 } ClientCertificateType; 2678 opaque DistinguishedName<1..2^16-1>; 2680 struct { 2681 ClientCertificateType certificate_types<1..2^8-1>; 2682 HashType certificate_hash<1..2^8-1>; 2683 DistinguishedName certificate_authorities<0..2^16-1>; 2684 } CertificateRequest; 2686 certificate_types 2687 This field is a list of the types of certificates requested, 2688 sorted in order of the server's preference. 2690 certificate_types 2691 A list of the types of certificate types which the client may 2692 offer. 2693 rsa_sign a certificate containing an RSA key 2694 dss_sign a certificate containing a DSS key 2695 rsa_fixed_dh a certificate signed with RSA and containing 2696 a static DH key. 2697 dss_fixed_dh a certificate signed with DSS and containing 2698 a static DH key 2700 Certificate types rsa_sign and dss_sign SHOULD contain 2701 certificates signed with the same algorithm. However, this is 2702 not required. This is a holdover from TLS 1.0 and 1.1. 2704 certificate_hash 2705 A list of acceptable hash algorithms to be used in 2706 certificate signatures. 2708 certificate_authorities 2709 A list of the distinguished names of acceptable certificate 2710 authorities. These distinguished names may specify a desired 2711 distinguished name for a root CA or for a subordinate CA; 2712 thus, this message can be used both to describe known roots 2713 and a desired authorization space. If the 2714 certificate_authorities list is empty then the client MAY 2715 send any certificate of the appropriate 2716 ClientCertificateType, unless there is some external 2717 arrangement to the contrary. 2719 ClientCertificateType values are divided into three groups: 2721 1. Values from 0 (zero) through 63 decimal (0x3F) inclusive are 2722 reserved for IETF Standards Track protocols. 2724 2. Values from 64 decimal (0x40) through 223 decimal (0xDF) 2725 inclusive are reserved for assignment for non-Standards 2726 Track methods. 2728 3. Values from 224 decimal (0xE0) through 255 decimal (0xFF) 2729 inclusive are reserved for private use. 2731 Additional information describing the role of IANA in the 2732 allocation of ClientCertificateType code points is described 2733 in Section 11. 2735 Note: Values listed as RESERVED may not be used. They were used in 2736 SSLv3. 2738 Note: DistinguishedName is derived from [X501]. DistinguishedNames are 2739 represented in DER-encoded format. 2741 Note: It is a fatal handshake_failure alert for an anonymous server to 2742 request client authentication. 2744 7.4.6. Server hello done 2746 When this message will be sent: 2747 The server hello done message is sent by the server to indicate 2748 the end of the server hello and associated messages. After 2749 sending this message the server will wait for a client response. 2751 Meaning of this message: 2752 This message means that the server is done sending messages to 2753 support the key exchange, and the client can proceed with its 2754 phase of the key exchange. 2756 Upon receipt of the server hello done message the client SHOULD 2757 verify that the server provided a valid certificate if required 2758 and check that the server hello parameters are acceptable. 2760 Structure of this message: 2761 struct { } ServerHelloDone; 2763 7.4.7. Client certificate 2765 When this message will be sent: 2766 This is the first message the client can send after receiving a 2767 server hello done message. This message is only sent if the 2768 server requests a certificate. If no suitable certificate is 2769 available, the client SHOULD send a certificate message 2770 containing no certificates. That is, the certificate_list 2771 structure has a length of zero. If client authentication is 2772 required by the server for the handshake to continue, it may 2773 respond with a fatal handshake failure alert. Client certificates 2774 are sent using the Certificate structure defined in Section 2775 7.4.2. 2777 Note: When using a static Diffie-Hellman based key exchange method 2778 (DH_DSS or DH_RSA), if client authentication is requested, the 2779 Diffie-Hellman group and generator encoded in the client's 2780 certificate MUST match the server specified Diffie-Hellman 2781 parameters if the client's parameters are to be used for the key 2782 exchange. 2784 7.4.8. Client Certificate URLs 2786 After negotiation of the use of client certificate URLs has been 2787 successfully completed (by exchanging hellos including 2788 "client_certificate_url" extensions), clients MAY send a 2789 "CertificateURL" message in place of a "Certificate" message. 2791 enum { 2792 individual_certs(0), pkipath(1), (255) 2793 } CertChainType; 2795 enum { 2796 false(0), true(1) 2797 } Boolean; 2799 struct { 2800 CertChainType type; 2801 URLAndOptionalHash url_and_hash_list<1..2^16-1>; 2802 } CertificateURL; 2803 struct { 2804 opaque url<1..2^16-1>; 2805 Boolean hash_present; 2806 select (hash_present) { 2807 case false: struct {}; 2808 case true: SHA1Hash; 2809 } hash; 2810 } URLAndOptionalHash; 2812 opaque SHA1Hash[20]; 2814 Here "url_and_hash_list" contains a sequence of URLs and optional 2815 hashes. 2817 When X.509 certificates are used, there are two possibilities: 2819 - if CertificateURL.type is "individual_certs", each URL refers to 2820 a single DER-encoded X.509v3 certificate, with the URL for the 2821 client's certificate first, or 2823 - if CertificateURL.type is "pkipath", the list contains a single 2824 URL referring to a DER-encoded certificate chain, using the type 2825 PkiPath described in Section 8. 2827 When any other certificate format is used, the specification that 2828 describes use of that format in TLS should define the encoding format 2829 of certificates or certificate chains, and any constraint on their 2830 ordering. 2832 The hash corresponding to each URL at the client's discretion is 2833 either not present or is the SHA-1 hash of the certificate or 2834 certificate chain (in the case of X.509 certificates, the DER-encoded 2835 certificate or the DER-encoded PkiPath). 2837 Note that when a list of URLs for X.509 certificates is used, the 2838 ordering of URLs is the same as that used in the TLS Certificate 2839 message (see [TLS] Section 7.4.2), but opposite to the order in which 2840 certificates are encoded in PkiPath. In either case, the self-signed 2841 root certificate MAY be omitted from the chain, under the assumption 2842 that the server must already possess it in order to validate it. 2844 Servers receiving "CertificateURL" SHALL attempt to retrieve the 2845 client's certificate chain from the URLs, and then process the 2846 certificate chain as usual. A cached copy of the content of any URL 2847 in the chain MAY be used, provided that a SHA-1 hash is present for 2848 that URL and it matches the hash of the cached copy. 2850 Servers that support this extension MUST support the http: URL scheme 2851 for certificate URLs, and MAY support other schemes. Use of other 2852 schemes than "http", "https", or "ftp" may create unexpected 2853 problems. 2855 If the protocol used is HTTP, then the HTTP server can be configured 2856 to use the Cache-Control and Expires directives described in [HTTP] 2857 to specify whether and for how long certificates or certificate 2858 chains should be cached. 2860 The TLS server is not required to follow HTTP redirects when 2861 retrieving the certificates or certificate chain. The URLs used in 2862 this extension SHOULD therefore be chosen not to depend on such 2863 redirects. 2865 If the protocol used to retrieve certificates or certificate chains 2866 returns a MIME formatted response (as HTTP does), then the following 2867 MIME Content-Types SHALL be used: when a single X.509v3 certificate 2868 is returned, the Content-Type is "application/pkix-cert" [PKIOP], and 2869 when a chain of X.509v3 certificates is returned, the Content-Type is 2870 "application/pkix-pkipath" (see Section XXX). 2872 If a SHA-1 hash is present for an URL, then the server MUST check 2873 that the SHA-1 hash of the contents of the object retrieved from that 2874 URL (after decoding any MIME Content-Transfer-Encoding) matches the 2875 given hash. If any retrieved object does not have the correct SHA-1 2876 hash, the server MUST abort the handshake with a 2877 "bad_certificate_hash_value" alert. 2879 Note that clients may choose to send either "Certificate" or 2880 "CertificateURL" after successfully negotiating the option to send 2881 certificate URLs. The option to send a certificate is included to 2882 provide flexibility to clients possessing multiple certificates. 2884 If a server encounters an unreasonable delay in obtaining 2885 certificates in a given CertificateURL, it SHOULD time out and signal 2886 a "certificate_unobtainable" error alert. 2888 7.4.9. Client key exchange message 2890 When this message will be sent: 2891 This message is always sent by the client. It MUST immediately follow 2892 the client certificate message, if it is sent. Otherwise it MUST be 2893 the first message sent by the client after it receives the server 2894 hello done message. 2896 Meaning of this message: 2897 With this message, the premaster secret is set, either though direct 2898 transmission of the RSA-encrypted secret, or by the transmission of 2899 Diffie-Hellman parameters which will allow each side to agree upon 2900 the same premaster secret. When the key exchange method is DH_RSA or 2901 DH_DSS, client certification has been requested, and the client was 2902 able to respond with a certificate which contained a Diffie-Hellman 2903 public key whose parameters (group and generator) matched those 2904 specified by the server in its certificate, this message MUST not 2905 contain any data. 2907 Structure of this message: 2908 The choice of messages depends on which key exchange method has been 2909 selected. See Section 7.4.3 for the KeyExchangeAlgorithm definition. 2911 struct { 2912 select (KeyExchangeAlgorithm) { 2913 case rsa: EncryptedPreMasterSecret; 2914 case diffie_hellman: ClientDiffieHellmanPublic; 2915 } exchange_keys; 2916 } ClientKeyExchange; 2918 7.4.9.1. RSA encrypted premaster secret message 2920 Meaning of this message: 2921 If RSA is being used for key agreement and authentication, the client 2922 generates a 48-byte premaster secret, encrypts it using the public 2923 key from the server's certificate or the temporary RSA key provided 2924 in a server key exchange message, and sends the result in an 2925 encrypted premaster secret message. This structure is a variant of 2926 the client key exchange message, not a message in itself. 2928 Structure of this message: 2929 struct { 2930 ProtocolVersion client_version; 2931 opaque random[46]; 2932 } PreMasterSecret; 2934 client_version 2935 The latest (newest) version supported by the client. This is 2936 used to detect version roll-back attacks. Upon receiving the 2937 premaster secret, the server SHOULD check that this value 2938 matches the value transmitted by the client in the client 2939 hello message. 2941 random 2942 46 securely-generated random bytes. 2944 struct { 2945 public-key-encrypted PreMasterSecret pre_master_secret; 2946 } EncryptedPreMasterSecret; 2947 pre_master_secret 2948 This random value is generated by the client and is used to 2949 generate the master secret, as specified in Section 8.1. 2951 Note: An attack discovered by Daniel Bleichenbacher [BLEI] can be used 2952 to attack a TLS server which is using PKCS#1 v 1.5 encoded RSA. 2953 The attack takes advantage of the fact that by failing in 2954 different ways, a TLS server can be coerced into revealing 2955 whether a particular message, when decrypted, is properly PKCS#1 2956 v1.5 formatted or not. 2958 The best way to avoid vulnerability to this attack is to treat 2959 incorrectly formatted messages in a manner indistinguishable from 2960 correctly formatted RSA blocks. Thus, when it receives an 2961 incorrectly formatted RSA block, a server should generate a 2962 random 48-byte value and proceed using it as the premaster 2963 secret. Thus, the server will act identically whether the 2964 received RSA block is correctly encoded or not. 2966 [PKCS1B] defines a newer version of PKCS#1 encoding that is more 2967 secure against the Bleichenbacher attack. However, for maximal 2968 compatibility with TLS 1.0, TLS 1.1 retains the original 2969 encoding. No variants of the Bleichenbacher attack are known to 2970 exist provided that the above recommendations are followed. 2972 Implementation Note: public-key-encrypted data is represented as an 2973 opaque vector <0..2^16-1> (see section 4.7). Thus the RSA- 2974 encrypted PreMasterSecret in a ClientKeyExchange is preceded by 2975 two length bytes. These bytes are redundant in the case of RSA 2976 because the EncryptedPreMasterSecret is the only data in the 2977 ClientKeyExchange and its length can therefore be unambiguously 2978 determined. The SSLv3 specification was not clear about the 2979 encoding of public-key-encrypted data and therefore many SSLv3 2980 implementations do not include the the length bytes, encoding the 2981 RSA encrypted data directly in the ClientKeyExchange message. 2983 This specification requires correct encoding of the 2984 EncryptedPreMasterSecret complete with length bytes. The 2985 resulting PDU is incompatible with many SSLv3 implementations. 2986 Implementors upgrading from SSLv3 must modify their 2987 implementations to generate and accept the correct encoding. 2988 Implementors who wish to be compatible with both SSLv3 and TLS 2989 should make their implementation's behavior dependent on the 2990 protocol version. 2992 Implementation Note: It is now known that remote timing-based attacks 2993 on SSL are possible, at least when the client and server are on 2994 the same LAN. Accordingly, implementations which use static RSA 2995 keys SHOULD use RSA blinding or some other anti-timing technique, 2996 as described in [TIMING]. 2998 Note: The version number in the PreMasterSecret MUST be the version 2999 offered by the client in the ClientHello.version, not the version 3000 negotiated for the connection. This feature is designed to 3001 prevent rollback attacks. Unfortunately, many implementations use 3002 the negotiated version instead and therefore checking the version 3003 number may lead to failure to interoperate with such incorrect 3004 client implementations. Client implementations MUST and Server 3005 implementations MAY check the version number. In practice, since 3006 the TLS handshake MACs prevent downgrade and no good attacks are 3007 known on those MACs, ambiguity is not considered a serious 3008 security risk. Note that if servers choose to to check the 3009 version number, they should randomize the PreMasterSecret in case 3010 of error, rather than generate an alert, in order to avoid 3011 variants on the Bleichenbacher attack. [KPR03] 3013 7.4.9.2. Client Diffie-Hellman public value 3015 Meaning of this message: 3016 This structure conveys the client's Diffie-Hellman public value 3017 (Yc) if it was not already included in the client's certificate. 3018 The encoding used for Yc is determined by the enumerated 3019 PublicValueEncoding. This structure is a variant of the client 3020 key exchange message, not a message in itself. 3022 Structure of this message: 3023 enum { implicit, explicit } PublicValueEncoding; 3025 implicit 3026 If the client certificate already contains a suitable Diffie- 3027 Hellman key, then Yc is implicit and does not need to be sent 3028 again. In this case, the client key exchange message will be 3029 sent, but MUST be empty. 3031 explicit 3032 Yc needs to be sent. 3034 struct { 3035 select (PublicValueEncoding) { 3036 case implicit: struct { }; 3037 case explicit: opaque dh_Yc<1..2^16-1>; 3038 } dh_public; 3039 } ClientDiffieHellmanPublic; 3041 dh_Yc 3042 The client's Diffie-Hellman public value (Yc). 3044 7.4.10. Certificate verify 3046 When this message will be sent: 3047 This message is used to provide explicit verification of a client 3048 certificate. This message is only sent following a client 3049 certificate that has signing capability (i.e. all certificates 3050 except those containing fixed Diffie-Hellman parameters). When 3051 sent, it MUST immediately follow the client key exchange message. 3053 Structure of this message: 3054 struct { 3055 Signature signature; 3056 } CertificateVerify; 3058 The Signature type is defined in 7.4.3. If the SignatureAlgorithm 3059 is DSA, then the sha_hash value must be used. If it is RSA, 3060 the same function (denoted Hash) must be used as was used to 3061 create the signature for the client's certificate. 3063 CertificateVerify.signature.hash 3064 Hash(handshake_messages); 3066 CertificateVerify.signature.sha_hash 3067 SHA(handshake_messages); 3069 Here handshake_messages refers to all handshake messages sent or 3070 received starting at client hello up to but not including this 3071 message, including the type and length fields of the handshake 3072 messages. This is the concatenation of all the Handshake structures 3073 as defined in 7.4 exchanged thus far. 3075 7.4.10. Finished 3077 When this message will be sent: 3078 A finished message is always sent immediately after a change 3079 cipher spec message to verify that the key exchange and 3080 authentication processes were successful. It is essential that a 3081 change cipher spec message be received between the other 3082 handshake messages and the Finished message. 3084 Meaning of this message: 3085 The finished message is the first protected with the just- 3086 negotiated algorithms, keys, and secrets. Recipients of finished 3087 messages MUST verify that the contents are correct. Once a side 3088 has sent its Finished message and received and validated the 3089 Finished message from its peer, it may begin to send and receive 3090 application data over the connection. 3092 struct { 3093 opaque verify_data[12]; 3094 } Finished; 3096 verify_data 3097 PRF(master_secret, finished_label, Hash(handshake_messages))[0..11]; 3099 finished_label 3100 For Finished messages sent by the client, the string "client 3101 finished". For Finished messages sent by the server, the 3102 string "server finished". 3104 Hash denotes the negotiated hash used for the PRF. If a new 3105 PRF is defined, then this hash MUST be specified. 3107 handshake_messages 3108 All of the data from all messages in this handshake (not 3109 including any HelloRequest messages) up to but not including 3110 this message. This is only data visible at the handshake 3111 layer and does not include record layer headers. This is the 3112 concatenation of all the Handshake structures as defined in 3113 7.4 exchanged thus far. 3115 It is a fatal error if a finished message is not preceded by a change 3116 cipher spec message at the appropriate point in the handshake. 3118 The value handshake_messages includes all handshake messages starting 3119 at client hello up to, but not including, this finished message. This 3120 may be different from handshake_messages in Section 7.4.10 because it 3121 would include the certificate verify message (if sent). Also, the 3122 handshake_messages for the finished message sent by the client will 3123 be different from that for the finished message sent by the server, 3124 because the one which is sent second will include the prior one. 3126 Note: Change cipher spec messages, alerts and any other record types 3127 are not handshake messages and are not included in the hash 3128 computations. Also, Hello Request messages are omitted from 3129 handshake hashes. 3131 8. Cryptographic computations 3133 In order to begin connection protection, the TLS Record Protocol 3134 requires specification of a suite of algorithms, a master secret, and 3135 the client and server random values. The authentication, encryption, 3136 and MAC algorithms are determined by the cipher_suite selected by the 3137 server and revealed in the server hello message. The compression 3138 algorithm is negotiated in the hello messages, and the random values 3139 are exchanged in the hello messages. All that remains is to calculate 3140 the master secret. 3142 8.1. Computing the master secret 3144 For all key exchange methods, the same algorithm is used to convert 3145 the pre_master_secret into the master_secret. The pre_master_secret 3146 should be deleted from memory once the master_secret has been 3147 computed. 3149 master_secret = PRF(pre_master_secret, "master secret", 3150 ClientHello.random + ServerHello.random) 3151 [0..47]; 3153 The master secret is always exactly 48 bytes in length. The length of 3154 the premaster secret will vary depending on key exchange method. 3156 8.1.1. RSA 3158 When RSA is used for server authentication and key exchange, a 3159 48-byte pre_master_secret is generated by the client, encrypted under 3160 the server's public key, and sent to the server. The server uses its 3161 private key to decrypt the pre_master_secret. Both parties then 3162 convert the pre_master_secret into the master_secret, as specified 3163 above. 3165 RSA digital signatures are performed using PKCS #1 [PKCS1] block type 3166 1. RSA public key encryption is performed using PKCS #1 block type 2. 3168 8.1.2. Diffie-Hellman 3170 A conventional Diffie-Hellman computation is performed. The 3171 negotiated key (Z) is used as the pre_master_secret, and is converted 3172 into the master_secret, as specified above. Leading bytes of Z that 3173 contain all zero bits are stripped before it is used as the 3174 pre_master_secret. 3176 Note: Diffie-Hellman parameters are specified by the server, and may 3177 be either ephemeral or contained within the server's certificate. 3179 9. Mandatory Cipher Suites 3181 In the absence of an application profile standard specifying 3182 otherwise, a TLS compliant application MUST implement the cipher 3183 suite TLS_RSA_WITH_3DES_EDE_CBC_SHA. 3185 10. Application data protocol 3187 Application data messages are carried by the Record Layer and are 3188 fragmented, compressed and encrypted based on the current connection 3189 state. The messages are treated as transparent data to the record 3190 layer. 3192 11. IANA Considerations 3194 This document describes a number of new registries to be created by 3195 IANA. We recommend that they be placed as individual registries items 3196 under a common TLS category. 3198 Section 7.4.5 describes a TLS HashType Registry to be maintained by 3199 the IANA, as defining a number of such code point identifiers. 3200 HashType identifiers with values in the range 0-63 (decimal) 3201 inclusive are assigned via RFC 2434 Standards Action. Values from the 3202 range 64-223 (decimal) inclusive are assigned via [RFC 2434] 3203 Specification Required. Identifier values from 224-255 (decimal) 3204 inclusive are reserved for RFC 2434 Private Use. The registry will be 3205 initially populated with the values in this document, Section 7.4.5. 3207 Section 7.4.5 describes a TLS ClientCertificateType Registry to be 3208 maintained by the IANA, as defining a number of such code point 3209 identifiers. ClientCertificateType identifiers with values in the 3210 range 0-63 (decimal) inclusive are assigned via RFC 2434 Standards 3211 Action. Values from the range 64-223 (decimal) inclusive are assigned 3212 via [RFC 2434] Specification Required. Identifier values from 3213 224-255 (decimal) inclusive are reserved for RFC 2434 Private Use. 3214 The registry will be initially populated with the values in this 3215 document, Section 7.4.5. 3217 Section A.5 describes a TLS Cipher Suite Registry to be maintained by 3218 the IANA, as well as defining a number of such cipher suite 3219 identifiers. Cipher suite values with the first byte in the range 3220 0-191 (decimal) inclusive are assigned via RFC 2434 Standards Action. 3221 Values with the first byte in the range 192-254 (decimal) are 3222 assigned via RFC 2434 Specification Required. Values with the first 3223 byte 255 (decimal) are reserved for RFC 2434 Private Use. The 3224 registry will be initially populated with the values from Section A.5 3225 of this document, [TLSAES], and Section 3 of [TLSKRB]. 3227 Section 6 requires that all ContentType values be defined by RFC 2434 3228 Standards Action. IANA SHOULD create a TLS ContentType registry, 3229 initially populated with values from Section 6.2.1 of this document. 3230 Future values MUST be allocated via Standards Action as described in 3231 [RFC 2434]. 3233 Section 7.2.2 requires that all Alert values be defined by RFC 2434 3234 Standards Action. IANA SHOULD create a TLS Alert registry, initially 3235 populated with values from Section 7.2 of this document and Section 4 3236 of [TLSEXT]. Future values MUST be allocated via Standards Action as 3237 described in [RFC 2434]. 3239 Section 7.4 requires that all HandshakeType values be defined by RFC 3240 2434 Standards Action. IANA SHOULD create a TLS HandshakeType 3241 registry, initially populated with values from Section 7.4 of this 3242 document and Section 2.4 of [TLSEXT]. Future values MUST be 3243 allocated via Standards Action as described in [RFC2434]. 3245 11.1 Extensions 3247 Sections XXX and XXX describes a registry of ExtensionType values to 3248 be maintained by the IANA. ExtensionType values are to be assigned 3249 via IETF Consensus as defined in RFC 2434 [IANA]. The initial 3250 registry corresponds to the definition of "ExtensionType" in Section 3251 2.3. 3253 The MIME type "application/pkix-pkipath" has been registered by the 3254 IANA with the following template: 3256 To: ietf-types@iana.org Subject: Registration of MIME media type 3257 application/pkix-pkipath 3259 MIME media type name: application 3260 MIME subtype name: pkix-pkipath 3262 Optional parameters: version (default value is "1") 3264 Encoding considerations: 3265 This MIME type is a DER encoding of the ASN.1 type PkiPath, 3266 defined as follows: 3267 PkiPath ::= SEQUENCE OF Certificate 3268 PkiPath is used to represent a certification path. Within the 3269 sequence, the order of certificates is such that the subject of 3270 the first certificate is the issuer of the second certificate, 3271 etc. 3273 This is identical to the definition published in [X509-4th-TC1]; 3274 note that it is different from that in [X509-4th]. 3276 All Certificates MUST conform to [PKIX]. (This should be 3277 interpreted as a requirement to encode only PKIX-conformant 3278 certificates using this type. It does not necessarily require 3279 that all certificates that are not strictly PKIX-conformant must 3280 be rejected by relying parties, although the security consequences 3281 of accepting any such certificates should be considered 3282 carefully.) 3283 DER (as opposed to BER) encoding MUST be used. If this type is 3284 sent over a 7-bit transport, base64 encoding SHOULD be used. 3286 Security considerations: 3287 The security considerations of [X509-4th] and [PKIX] (or any 3288 updates to them) apply, as well as those of any protocol that uses 3289 this type (e.g., TLS). 3291 Note that this type only specifies a certificate chain that can be 3292 assessed for validity according to the relying party's existing 3293 configuration of trusted CAs; it is not intended to be used to 3294 specify any change to that configuration. 3296 Interoperability considerations: 3297 No specific interoperability problems are known with this type, 3298 but for recommendations relating to X.509 certificates in general, 3299 see [PKIX]. 3301 Published specification: this memo, and [PKIX]. 3303 Applications which use this media type: TLS. It may also be used by 3304 other protocols, or for general interchange of PKIX certificate 3306 Additional information: 3307 Magic number(s): DER-encoded ASN.1 can be easily recognized. 3308 Further parsing is required to distinguish from other ASN.1 3309 types. 3310 File extension(s): .pkipath 3311 Macintosh File Type Code(s): not specified 3313 Person & email address to contact for further information: 3314 Magnus Nystrom 3316 Intended usage: COMMON 3318 Change controller: 3319 IESG 3320 A. Protocol constant values 3322 This section describes protocol types and constants. 3324 A.1. Record layer 3326 struct { 3327 uint8 major, minor; 3328 } ProtocolVersion; 3330 ProtocolVersion version = { 3, 3 }; /* TLS v1.2*/ 3332 enum { 3333 change_cipher_spec(20), alert(21), handshake(22), 3334 application_data(23), (255) 3335 } ContentType; 3337 struct { 3338 ContentType type; 3339 ProtocolVersion version; 3340 uint16 length; 3341 opaque fragment[TLSPlaintext.length]; 3342 } TLSPlaintext; 3344 struct { 3345 ContentType type; 3346 ProtocolVersion version; 3347 uint16 length; 3348 opaque fragment[TLSCompressed.length]; 3349 } TLSCompressed; 3351 struct { 3352 ContentType type; 3353 ProtocolVersion version; 3354 uint16 length; 3355 select (CipherSpec.cipher_type) { 3356 case stream: GenericStreamCipher; 3357 case block: GenericBlockCipher; 3358 } fragment; 3359 } TLSCiphertext; 3361 stream-ciphered struct { 3362 opaque content[TLSCompressed.length]; 3363 opaque MAC[CipherSpec.hash_size]; 3364 } GenericStreamCipher; 3366 block-ciphered struct { 3367 opaque IV[CipherSpec.block_length]; 3368 opaque content[TLSCompressed.length]; 3369 opaque MAC[CipherSpec.hash_size]; 3370 uint8 padding[GenericBlockCipher.padding_length]; 3371 uint8 padding_length; 3372 } GenericBlockCipher; 3374 aead-ciphered struct { 3375 opaque IV[CipherSpec.iv_length]; 3376 opaque aead_output[AEADEncrypted.length]; 3377 } GenericAEADCipher; 3379 A.2. Change cipher specs message 3381 struct { 3382 enum { change_cipher_spec(1), (255) } type; 3383 } ChangeCipherSpec; 3385 A.3. Alert messages 3387 enum { warning(1), fatal(2), (255) } AlertLevel; 3389 enum { 3390 close_notify(0), 3391 unexpected_message(10), 3392 bad_record_mac(20), 3393 decryption_failed(21), 3394 record_overflow(22), 3395 decompression_failure(30), 3396 handshake_failure(40), 3397 no_certificate_RESERVED (41), 3398 bad_certificate(42), 3399 unsupported_certificate(43), 3400 certificate_revoked(44), 3401 certificate_expired(45), 3402 certificate_unknown(46), 3403 illegal_parameter(47), 3404 unknown_ca(48), 3405 access_denied(49), 3406 decode_error(50), 3407 decrypt_error(51), 3408 export_restriction_RESERVED(60), 3409 protocol_version(70), 3410 insufficient_security(71), 3411 internal_error(80), 3412 user_canceled(90), 3413 no_renegotiation(100), 3414 unsupported_extension(110), /* new */ 3415 certificate_unobtainable(111), /* new */ 3416 unrecognized_name(112), /* new */ 3417 bad_certificate_status_response(113), /* new */ 3418 bad_certificate_hash_value(114), /* new */ 3419 (255) 3420 } AlertDescription; 3422 struct { 3423 AlertLevel level; 3424 AlertDescription description; 3425 } Alert; 3426 A.4. Handshake protocol 3428 enum { 3429 hello_request(0), client_hello(1), server_hello(2), 3430 certificate(11), server_key_exchange (12), 3431 certificate_request(13), server_hello_done(14), 3432 certificate_verify(15), client_key_exchange(16), 3433 finished(20), certificate_url(21), certificate_status(22), 3434 (255) 3435 } HandshakeType; 3437 struct { 3438 HandshakeType msg_type; 3439 uint24 length; 3440 select (HandshakeType) { 3441 case hello_request: HelloRequest; 3442 case client_hello: ClientHello; 3443 case server_hello: ServerHello; 3444 case certificate: Certificate; 3445 case server_key_exchange: ServerKeyExchange; 3446 case certificate_request: CertificateRequest; 3447 case server_hello_done: ServerHelloDone; 3448 case certificate_verify: CertificateVerify; 3449 case client_key_exchange: ClientKeyExchange; 3450 case finished: Finished; 3451 case certificate_url: CertificateURL; 3452 case certificate_status: CertificateStatus; 3453 } body; 3454 } Handshake; 3456 A.4.1. Hello messages 3458 struct { } HelloRequest; 3460 struct { 3461 uint32 gmt_unix_time; 3462 opaque random_bytes[28]; 3463 } Random; 3465 opaque SessionID<0..32>; 3467 uint8 CipherSuite[2]; 3469 enum { null(0), (255) } CompressionMethod; 3471 struct { 3472 ProtocolVersion client_version; 3473 Random random; 3474 SessionID session_id; 3475 CipherSuite cipher_suites<2..2^16-1>; 3476 CompressionMethod compression_methods<1..2^8-1>; 3477 Extension client_hello_extension_list<0..2^16-1>; 3478 } ClientHello; 3480 struct { 3481 ProtocolVersion client_version; 3482 Random random; 3483 SessionID session_id; 3484 CipherSuite cipher_suites<2..2^16-1>; 3485 CompressionMethod compression_methods<1..2^8-1>; 3486 Extension client_hello_extension_list<0..2^16-1>; 3487 } ExtendedClientHello; 3489 struct { 3490 ProtocolVersion server_version; 3491 Random random; 3492 SessionID session_id; 3493 CipherSuite cipher_suite; 3494 CompressionMethod compression_method; 3495 } ServerHello; 3497 struct { 3498 ProtocolVersion server_version; 3499 Random random; 3500 SessionID session_id; 3501 CipherSuite cipher_suite; 3502 CompressionMethod compression_method; 3503 Extension server_hello_extension_list<0..2^16-1>; 3504 } ExtendedServerHello; 3506 struct { 3507 ExtensionType extension_type; 3508 opaque extension_data<0..2^16-1>; 3509 } Extension; 3511 enum { 3512 server_name(0), max_fragment_length(1), 3513 client_certificate_url(2), trusted_ca_keys(3), 3514 truncated_hmac(4), status_request(5), 3515 cert_hash_types(6), (65535) 3516 } ExtensionType; 3518 struct { 3519 NameType name_type; 3520 select (name_type) { 3521 case host_name: HostName; 3522 } name; 3523 } ServerName; 3525 enum { 3526 host_name(0), (255) 3527 } NameType; 3529 opaque HostName<1..2^16-1>; 3531 struct { 3532 ServerName server_name_list<1..2^16-1> 3533 } ServerNameList; 3535 enum{ 3536 2^9(1), 2^10(2), 2^11(3), 2^12(4), (255) 3537 } MaxFragmentLength; 3539 struct { 3540 TrustedAuthority trusted_authorities_list<0..2^16-1>; 3541 } TrustedAuthorities; 3543 struct { 3544 IdentifierType identifier_type; 3545 select (identifier_type) { 3546 case pre_agreed: struct {}; 3547 case key_sha1_hash: SHA1Hash; 3548 case x509_name: DistinguishedName; 3549 case cert_sha1_hash: SHA1Hash; 3550 } identifier; 3551 } TrustedAuthority; 3553 enum { 3554 pre_agreed(0), key_sha1_hash(1), x509_name(2), 3555 cert_sha1_hash(3), (255) 3556 } IdentifierType; 3558 struct { 3559 CertificateStatusType status_type; 3560 select (status_type) { 3561 case ocsp: OCSPStatusRequest; 3562 } request; 3563 } CertificateStatusRequest; 3565 enum { ocsp(1), (255) } CertificateStatusType; 3567 struct { 3568 ResponderID responder_id_list<0..2^16-1>; 3569 Extensions request_extensions; 3570 } OCSPStatusRequest; 3572 opaque ResponderID<1..2^16-1>; 3573 A.4.2. Server authentication and key exchange messages 3575 opaque ASN.1Cert<2^24-1>; 3577 struct { 3578 ASN.1Cert certificate_list<0..2^24-1>; 3579 } Certificate; 3581 struct { 3582 CertificateStatusType status_type; 3583 select (status_type) { 3584 case ocsp: OCSPResponse; 3585 } response; 3586 } CertificateStatus; 3588 opaque OCSPResponse<1..2^24-1>; 3590 enum { rsa, diffie_hellman } KeyExchangeAlgorithm; 3592 struct { 3593 opaque rsa_modulus<1..2^16-1>; 3594 opaque rsa_exponent<1..2^16-1>; 3595 } ServerRSAParams; 3597 struct { 3598 opaque dh_p<1..2^16-1>; 3599 opaque dh_g<1..2^16-1>; 3600 opaque dh_Ys<1..2^16-1>; 3601 } ServerDHParams; 3603 struct { 3604 select (KeyExchangeAlgorithm) { 3605 case diffie_hellman: 3606 ServerDHParams params; 3607 Signature signed_params; 3608 case rsa: 3609 ServerRSAParams params; 3610 Signature signed_params; 3611 }; 3612 } ServerKeyExchange; 3614 enum { anonymous, rsa, dsa } SignatureAlgorithm; 3616 struct { 3617 select (KeyExchangeAlgorithm) { 3618 case diffie_hellman: 3619 ServerDHParams params; 3620 case rsa: 3621 ServerRSAParams params; 3622 }; 3623 } ServerParams; 3625 struct { 3626 select (SignatureAlgorithm) { 3627 case anonymous: struct { }; 3628 case rsa: 3629 digitally-signed struct { 3630 opaque hash[Hash.length]; 3631 }; 3632 case dsa: 3633 digitally-signed struct { 3634 opaque sha_hash[20]; 3635 }; 3636 }; 3637 }; 3638 } Signature; 3640 enum { 3641 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 3642 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 3643 fortezza_dms_RESERVED(20), 3644 (255) 3645 } ClientCertificateType; 3647 opaque DistinguishedName<1..2^16-1>; 3649 struct { 3650 ClientCertificateType certificate_types<1..2^8-1>; 3651 DistinguishedName certificate_authorities<0..2^16-1>; 3652 } CertificateRequest; 3654 struct { } ServerHelloDone; 3656 A.4.3. Client authentication and key exchange messages 3658 struct { 3659 select (KeyExchangeAlgorithm) { 3660 case rsa: EncryptedPreMasterSecret; 3661 case diffie_hellman: ClientDiffieHellmanPublic; 3662 } exchange_keys; 3663 } ClientKeyExchange; 3665 struct { 3666 ProtocolVersion client_version; 3667 opaque random[46]; 3668 } PreMasterSecret; 3670 struct { 3671 public-key-encrypted PreMasterSecret pre_master_secret; 3672 } EncryptedPreMasterSecret; 3674 enum { implicit, explicit } PublicValueEncoding; 3676 struct { 3677 select (PublicValueEncoding) { 3678 case implicit: struct {}; 3679 case explicit: opaque DH_Yc<1..2^16-1>; 3680 } dh_public; 3681 } ClientDiffieHellmanPublic; 3683 enum { 3684 individual_certs(0), pkipath(1), (255) 3685 } CertChainType; 3687 enum { 3688 false(0), true(1) 3689 } Boolean; 3691 struct { 3692 CertChainType type; 3693 URLAndOptionalHash url_and_hash_list<1..2^16-1>; 3694 } CertificateURL; 3696 struct { 3697 opaque url<1..2^16-1>; 3698 Boolean hash_present; 3699 select (hash_present) { 3700 case false: struct {}; 3701 case true: SHA1Hash; 3702 } hash; 3703 } URLAndOptionalHash; 3705 opaque SHA1Hash[20]; 3707 struct { 3708 Signature signature; 3709 } CertificateVerify; 3711 A.4.4. Handshake finalization message 3713 struct { 3714 opaque verify_data[12]; 3715 } Finished; 3717 A.5. The CipherSuite 3719 The following values define the CipherSuite codes used in the client 3720 hello and server hello messages. 3722 A CipherSuite defines a cipher specification supported in TLS Version 3723 1.1. 3725 TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a 3726 TLS connection during the first handshake on that channel, but must 3727 not be negotiated, as it provides no more protection than an 3728 unsecured connection. 3730 CipherSuite TLS_NULL_WITH_NULL_NULL = { 0x00,0x00 }; 3732 The following CipherSuite definitions require that the server provide 3733 an RSA certificate that can be used for key exchange. The server may 3734 request either an RSA or a DSS signature-capable certificate in the 3735 certificate request message. 3737 CipherSuite TLS_RSA_WITH_NULL_MD5 = { 0x00,0x01 }; 3738 CipherSuite TLS_RSA_WITH_NULL_SHA = { 0x00,0x02 }; 3739 CipherSuite TLS_RSA_WITH_RC4_128_MD5 = { 0x00,0x04 }; 3740 CipherSuite TLS_RSA_WITH_RC4_128_SHA = { 0x00,0x05 }; 3741 CipherSuite TLS_RSA_WITH_IDEA_CBC_SHA = { 0x00,0x07 }; 3742 CipherSuite TLS_RSA_WITH_DES_CBC_SHA = { 0x00,0x09 }; 3743 CipherSuite TLS_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0A }; 3744 CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x2F }; 3745 CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x35 }; 3746 The following CipherSuite definitions are used for server- 3747 authenticated (and optionally client-authenticated) Diffie-Hellman. 3748 DH denotes cipher suites in which the server's certificate contains 3749 the Diffie-Hellman parameters signed by the certificate authority 3750 (CA). DHE denotes ephemeral Diffie-Hellman, where the Diffie-Hellman 3751 parameters are signed by a DSS or RSA certificate, which has been 3752 signed by the CA. The signing algorithm used is specified after the 3753 DH or DHE parameter. The server can request an RSA or DSS signature- 3754 capable certificate from the client for client authentication or it 3755 may request a Diffie-Hellman certificate. Any Diffie-Hellman 3756 certificate provided by the client must use the parameters (group and 3757 generator) described by the server. 3759 CipherSuite TLS_DH_DSS_WITH_DES_CBC_SHA = { 0x00,0x0C }; 3760 CipherSuite TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0D }; 3761 CipherSuite TLS_DH_RSA_WITH_DES_CBC_SHA = { 0x00,0x0F }; 3762 CipherSuite TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x10 }; 3763 CipherSuite TLS_DHE_DSS_WITH_DES_CBC_SHA = { 0x00,0x12 }; 3764 CipherSuite TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x13 }; 3765 CipherSuite TLS_DHE_RSA_WITH_DES_CBC_SHA = { 0x00,0x15 }; 3766 CipherSuite TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x16 }; 3767 CipherSuite TLS_DH_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x30 }; 3768 CipherSuite TLS_DH_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x31 }; 3769 CipherSuite TLS_DHE_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x32 }; 3770 CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x33 }; 3771 CipherSuite TLS_DH_anon_WITH_AES_128_CBC_SHA = { 0x00, 0x34 }; 3772 CipherSuite TLS_DH_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x36 }; 3773 CipherSuite TLS_DH_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x37 }; 3774 CipherSuite TLS_DHE_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x38 }; 3775 CipherSuite TLS_DHE_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x39 }; 3776 CipherSuite TLS_DH_anon_WITH_AES_256_CBC_SHA = { 0x00, 0x3A }; 3778 The following cipher suites are used for completely anonymous Diffie- 3779 Hellman communications in which neither party is authenticated. Note 3780 that this mode is vulnerable to man-in-the-middle attacks and is 3781 therefore deprecated. 3783 CipherSuite TLS_DH_anon_WITH_RC4_128_MD5 = { 0x00,0x18 }; 3784 CipherSuite TLS_DH_anon_WITH_DES_CBC_SHA = { 0x00,0x1A }; 3785 CipherSuite TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = { 0x00,0x1B }; 3787 When SSLv3 and TLS 1.0 were designed, the United States restricted 3788 the export of cryptographic software containing certain strong 3789 encryption algorithms. A series of cipher suites were designed to 3790 operate at reduced key lengths in order to comply with those 3791 regulations. Due to advances in computer performance, these 3792 algorithms are now unacceptably weak and export restrictions have 3793 since been loosened. TLS 1.1 implementations MUST NOT negotiate these 3794 cipher suites in TLS 1.1 mode. However, for backward compatibility 3795 they may be offered in the ClientHello for use with TLS 1.0 or SSLv3 3796 only servers. TLS 1.1 clients MUST check that the server did not 3797 choose one of these cipher suites during the handshake. These 3798 ciphersuites are listed below for informational purposes and to 3799 reserve the numbers. 3801 CipherSuite TLS_RSA_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x03 }; 3802 CipherSuite TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = { 0x00,0x06 }; 3803 CipherSuite TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x08 }; 3804 CipherSuite TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0B }; 3805 CipherSuite TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0E }; 3806 CipherSuite TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x11 }; 3807 CipherSuite TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x14 }; 3808 CipherSuite TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x17 }; 3809 CipherSuite TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x19 }; 3810 The following cipher suites were defined in [TLSKRB] and are included 3811 here for completeness. See [TLSKRB] for details: 3813 CipherSuite TLS_KRB5_WITH_DES_CBC_SHA = { 0x00,0x1E }; 3814 CipherSuite TLS_KRB5_WITH_3DES_EDE_CBC_SHA = { 0x00,0x1F }; 3815 CipherSuite TLS_KRB5_WITH_RC4_128_SHA = { 0x00,0x20 }; 3816 CipherSuite TLS_KRB5_WITH_IDEA_CBC_SHA = { 0x00,0x21 }; 3817 CipherSuite TLS_KRB5_WITH_DES_CBC_MD5 = { 0x00,0x22 }; 3818 CipherSuite TLS_KRB5_WITH_3DES_EDE_CBC_MD5 = { 0x00,0x23 }; 3819 CipherSuite TLS_KRB5_WITH_RC4_128_MD5 = { 0x00,0x24 }; 3820 CipherSuite TLS_KRB5_WITH_IDEA_CBC_MD5 = { 0x00,0x25 }; 3822 The following exportable cipher suites were defined in [TLSKRB] and 3823 are included here for completeness. TLS 1.1 implementations MUST NOT 3824 negotiate these cipher suites. 3826 CipherSuite TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA = { 0x00,0x26 3827 }; 3828 CipherSuite TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA = { 0x00,0x27 3829 }; 3830 CipherSuite TLS_KRB5_EXPORT_WITH_RC4_40_SHA = { 0x00,0x28 3831 }; 3832 CipherSuite TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 = { 0x00,0x29 3833 }; 3834 CipherSuite TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 = { 0x00,0x2A 3835 }; 3836 CipherSuite TLS_KRB5_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x2B 3837 }; 3839 The cipher suite space is divided into three regions: 3841 1. Cipher suite values with first byte 0x00 (zero) 3842 through decimal 191 (0xBF) inclusive are reserved for the IETF 3843 Standards Track protocols. 3845 2. Cipher suite values with first byte decimal 192 (0xC0) 3846 through decimal 254 (0xFE) inclusive are reserved 3847 for assignment for non-Standards Track methods. 3849 3. Cipher suite values with first byte 0xFF are 3850 reserved for private use. 3851 Additional information describing the role of IANA in the allocation 3852 of cipher suite code points is described in Section 11. 3854 Note: The cipher suite values { 0x00, 0x1C } and { 0x00, 0x1D } are 3855 reserved to avoid collision with Fortezza-based cipher suites in SSL 3856 3. 3858 A.6. The Security Parameters 3860 These security parameters are determined by the TLS Handshake 3861 Protocol and provided as parameters to the TLS Record Layer in order 3862 to initialize a connection state. SecurityParameters includes: 3864 enum { null(0), (255) } CompressionMethod; 3866 enum { server, client } ConnectionEnd; 3868 enum { null, rc4, rc2, des, 3des, des40, aes, idea } 3869 BulkCipherAlgorithm; 3871 enum { stream, block } CipherType; 3873 enum { null, md5, sha } MACAlgorithm; 3875 /* The algorithms specified in CompressionMethod, 3876 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 3878 struct { 3879 ConnectionEnd entity; 3880 BulkCipherAlgorithm bulk_cipher_algorithm; 3881 CipherType cipher_type; 3882 uint8 key_size; 3883 uint8 key_material_length; 3884 MACAlgorithm mac_algorithm; 3885 uint8 hash_size; 3886 CompressionMethod compression_algorithm; 3887 opaque master_secret[48]; 3888 opaque client_random[32]; 3889 opaque server_random[32]; 3890 } SecurityParameters; 3891 B. Glossary 3893 Advanced Encryption Standard (AES) 3894 AES is a widely used symmetric encryption algorithm. 3895 AES is 3896 a block cipher with a 128, 192, or 256 bit keys and a 16 byte 3897 block size. [AES] TLS currently only supports the 128 and 256 3898 bit key sizes. 3900 application protocol 3901 An application protocol is a protocol that normally layers 3902 directly on top of the transport layer (e.g., TCP/IP). Examples 3903 include HTTP, TELNET, FTP, and SMTP. 3905 asymmetric cipher 3906 See public key cryptography. 3908 authentication 3909 Authentication is the ability of one entity to determine the 3910 identity of another entity. 3912 block cipher 3913 A block cipher is an algorithm that operates on plaintext in 3914 groups of bits, called blocks. 64 bits is a common block size. 3916 bulk cipher 3917 A symmetric encryption algorithm used to encrypt large quantities 3918 of data. 3920 cipher block chaining (CBC) 3921 CBC is a mode in which every plaintext block encrypted with a 3922 block cipher is first exclusive-ORed with the previous ciphertext 3923 block (or, in the case of the first block, with the 3924 initialization vector). For decryption, every block is first 3925 decrypted, then exclusive-ORed with the previous ciphertext block 3926 (or IV). 3928 certificate 3929 As part of the X.509 protocol (a.k.a. ISO Authentication 3930 framework), certificates are assigned by a trusted Certificate 3931 Authority and provide a strong binding between a party's identity 3932 or some other attributes and its public key. 3934 client 3935 The application entity that initiates a TLS connection to a 3936 server. This may or may not imply that the client initiated the 3937 underlying transport connection. The primary operational 3938 difference between the server and client is that the server is 3939 generally authenticated, while the client is only optionally 3940 authenticated. 3942 client write key 3943 The key used to encrypt data written by the client. 3945 client write MAC secret 3946 The secret data used to authenticate data written by the client. 3948 connection 3949 A connection is a transport (in the OSI layering model 3950 definition) that provides a suitable type of service. For TLS, 3951 such connections are peer to peer relationships. The connections 3952 are transient. Every connection is associated with one session. 3954 Data Encryption Standard 3955 DES is a very widely used symmetric encryption algorithm. DES is 3956 a block cipher with a 56 bit key and an 8 byte block size. Note 3957 that in TLS, for key generation purposes, DES is treated as 3958 having an 8 byte key length (64 bits), but it still only provides 3959 56 bits of protection. (The low bit of each key byte is presumed 3960 to be set to produce odd parity in that key byte.) DES can also 3961 be operated in a mode where three independent keys and three 3962 encryptions are used for each block of data; this uses 168 bits 3963 of key (24 bytes in the TLS key generation method) and provides 3964 the equivalent of 112 bits of security. [DES], [3DES] 3966 Digital Signature Standard (DSS) 3967 A standard for digital signing, including the Digital Signing 3968 Algorithm, approved by the National Institute of Standards and 3969 Technology, defined in NIST FIPS PUB 186, "Digital Signature 3970 Standard," published May, 1994 by the U.S. Dept. of Commerce. 3971 [DSS] 3973 digital signatures 3974 Digital signatures utilize public key cryptography and one-way 3975 hash functions to produce a signature of the data that can be 3976 authenticated, and is difficult to forge or repudiate. 3978 handshake 3979 An initial negotiation between client and server that establishes 3980 the parameters of their transactions. 3982 Initialization Vector (IV) 3983 When a block cipher is used in CBC mode, the initialization 3984 vector is exclusive-ORed with the first plaintext block prior to 3985 encryption. 3987 IDEA 3988 A 64-bit block cipher designed by Xuejia Lai and James Massey. 3989 [IDEA] 3991 Message Authentication Code (MAC) 3992 A Message Authentication Code is a one-way hash computed from a 3993 message and some secret data. It is difficult to forge without 3994 knowing the secret data. Its purpose is to detect if the message 3995 has been altered. 3997 master secret 3998 Secure secret data used for generating encryption keys, MAC 3999 secrets, and IVs. 4001 MD5 4002 MD5 is a secure hashing function that converts an arbitrarily 4003 long data stream into a digest of fixed size (16 bytes). [MD5] 4005 public key cryptography 4006 A class of cryptographic techniques employing two-key ciphers. 4007 Messages encrypted with the public key can only be decrypted with 4008 the associated private key. Conversely, messages signed with the 4009 private key can be verified with the public key. 4011 one-way hash function 4012 A one-way transformation that converts an arbitrary amount of 4013 data into a fixed-length hash. It is computationally hard to 4014 reverse the transformation or to find collisions. MD5 and SHA are 4015 examples of one-way hash functions. 4017 RC2 4018 A block cipher developed by Ron Rivest at RSA Data Security, Inc. 4019 [RSADSI] described in [RC2]. 4021 RC4 4022 A stream cipher invented by Ron Rivest. A compatible cipher is 4023 described in [SCH]. 4025 RSA 4026 A very widely used public-key algorithm that can be used for 4027 either encryption or digital signing. [RSA] 4029 server 4030 The server is the application entity that responds to requests 4031 for connections from clients. See also under client. 4033 session 4034 A TLS session is an association between a client and a server. 4035 Sessions are created by the handshake protocol. Sessions define a 4036 set of cryptographic security parameters, which can be shared 4037 among multiple connections. Sessions are used to avoid the 4038 expensive negotiation of new security parameters for each 4039 connection. 4041 session identifier 4042 A session identifier is a value generated by a server that 4043 identifies a particular session. 4045 server write key 4046 The key used to encrypt data written by the server. 4048 server write MAC secret 4049 The secret data used to authenticate data written by the server. 4051 SHA 4052 The Secure Hash Algorithm is defined in FIPS PUB 180-2. It 4053 produces a 20-byte output. Note that all references to SHA 4054 actually use the modified SHA-1 algorithm. [SHA] 4056 SSL 4057 Netscape's Secure Socket Layer protocol [SSL3]. TLS is based on 4058 SSL Version 3.0 4060 stream cipher 4061 An encryption algorithm that converts a key into a 4062 cryptographically-strong keystream, which is then exclusive-ORed 4063 with the plaintext. 4065 symmetric cipher 4066 See bulk cipher. 4068 Transport Layer Security (TLS) 4069 This protocol; also, the Transport Layer Security working group 4070 of the Internet Engineering Task Force (IETF). See "Comments" at 4071 the end of this document. 4073 C. CipherSuite definitions 4075 CipherSuite Key Cipher Hash 4076 Exchange 4078 TLS_NULL_WITH_NULL_NULL NULL NULL NULL 4079 TLS_RSA_WITH_NULL_MD5 RSA NULL MD5 4080 TLS_RSA_WITH_NULL_SHA RSA NULL SHA 4081 TLS_RSA_WITH_RC4_128_MD5 RSA RC4_128 MD5 4082 TLS_RSA_WITH_RC4_128_SHA RSA RC4_128 SHA 4083 TLS_RSA_WITH_IDEA_CBC_SHA RSA IDEA_CBC SHA 4084 TLS_RSA_WITH_DES_CBC_SHA RSA DES_CBC SHA 4085 TLS_RSA_WITH_3DES_EDE_CBC_SHA RSA 3DES_EDE_CBC SHA 4086 TLS_RSA_WITH_AES_128_CBC_SHA RSA AES_128_CBC SHA 4087 TLS_RSA_WITH_AES_256_SHA RSA AES_256_CBC SHA 4088 TLS_DH_DSS_WITH_DES_CBC_SHA DH_DSS DES_CBC SHA 4089 TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA DH_DSS 3DES_EDE_CBC SHA 4090 TLS_DH_RSA_WITH_DES_CBC_SHA DH_RSA DES_CBC SHA 4091 TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA DH_RSA 3DES_EDE_CBC SHA 4092 TLS_DHE_DSS_WITH_DES_CBC_SHA DHE_DSS DES_CBC SHA 4093 TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA DHE_DSS 3DES_EDE_CBC SHA 4094 TLS_DHE_RSA_WITH_DES_CBC_SHA DHE_RSA DES_CBC SHA 4095 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA DHE_RSA 3DES_EDE_CBC SHA 4096 TLS_DH_anon_WITH_RC4_128_MD5 DH_anon RC4_128 MD5 4097 TLS_DH_anon_WITH_DES_CBC_SHA DH_anon DES_CBC SHA 4098 TLS_DH_anon_WITH_3DES_EDE_CBC_SHA DH_anon 3DES_EDE_CBC SHA 4099 TLS_DH_DSS_WITH_AES_128_CBC_SHA DH_DSS AES_128_CBC SHA 4100 TLS_DH_RSA_WITH_AES_128_CBC_SHA DH_RSA AES_128_CBC SHA 4101 TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE_DSS AES_128_CBC SHA 4102 TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE_RSA AES_128_CBC SHA 4103 TLS_DH_anon_WITH_AES_128_CBC_SHA DH_anon AES_128_CBC SHA 4104 TLS_DH_DSS_WITH_AES_256_CBC_SHA DH_DSS AES_256_CBC SHA 4105 TLS_DH_RSA_WITH_AES_256_CBC_SHA DH_RSA AES_256_CBC SHA 4106 TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE_DSS AES_256_CBC SHA 4107 TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE_RSA AES_256_CBC SHA 4108 TLS_DH_anon_WITH_AES_256_CBC_SHA DH_anon AES_256_CBC SHA 4110 Key 4111 Exchange 4112 Algorithm Description Key size limit 4114 DHE_DSS Ephemeral DH with DSS signatures None 4115 DHE_RSA Ephemeral DH with RSA signatures None 4116 DH_anon Anonymous DH, no signatures None 4117 DH_DSS DH with DSS-based certificates None 4118 DH_RSA DH with RSA-based certificates None 4119 RSA = none 4120 NULL No key exchange N/A 4121 RSA RSA key exchange None 4123 Key Expanded IV Block 4124 Cipher Type Material Key Material Size Size 4126 NULL Stream 0 0 0 N/A 4127 IDEA_CBC Block 16 16 8 8 4128 RC2_CBC_40 Block 5 16 8 8 4129 RC4_40 Stream 5 16 0 N/A 4130 RC4_128 Stream 16 16 0 N/A 4131 DES40_CBC Block 5 8 8 8 4132 DES_CBC Block 8 8 8 8 4133 3DES_EDE_CBC Block 24 24 8 8 4135 Type 4136 Indicates whether this is a stream cipher or a block cipher 4137 running in CBC mode. 4139 Key Material 4140 The number of bytes from the key_block that are used for 4141 generating the write keys. 4143 Expanded Key Material 4144 The number of bytes actually fed into the encryption algorithm 4146 IV Size 4147 How much data needs to be generated for the initialization 4148 vector. Zero for stream ciphers; equal to the block size for 4149 block ciphers. 4151 Block Size 4152 The amount of data a block cipher enciphers in one chunk; a 4153 block cipher running in CBC mode can only encrypt an even 4154 multiple of its block size. 4156 Hash Hash Padding 4157 function Size Size 4158 NULL 0 0 4159 MD5 16 48 4160 SHA 20 40 4161 D. Implementation Notes 4163 The TLS protocol cannot prevent many common security mistakes. This 4164 section provides several recommendations to assist implementors. 4166 D.1 Random Number Generation and Seeding 4168 TLS requires a cryptographically-secure pseudorandom number generator 4169 (PRNG). Care must be taken in designing and seeding PRNGs. PRNGs 4170 based on secure hash operations, most notably MD5 and/or SHA, are 4171 acceptable, but cannot provide more security than the size of the 4172 random number generator state. (For example, MD5-based PRNGs usually 4173 provide 128 bits of state.) 4175 To estimate the amount of seed material being produced, add the 4176 number of bits of unpredictable information in each seed byte. For 4177 example, keystroke timing values taken from a PC compatible's 18.2 Hz 4178 timer provide 1 or 2 secure bits each, even though the total size of 4179 the counter value is 16 bits or more. To seed a 128-bit PRNG, one 4180 would thus require approximately 100 such timer values. 4182 [RANDOM] provides guidance on the generation of random values. 4184 D.2 Certificates and authentication 4186 Implementations are responsible for verifying the integrity of 4187 certificates and should generally support certificate revocation 4188 messages. Certificates should always be verified to ensure proper 4189 signing by a trusted Certificate Authority (CA). The selection and 4190 addition of trusted CAs should be done very carefully. Users should 4191 be able to view information about the certificate and root CA. 4193 D.3 CipherSuites 4195 TLS supports a range of key sizes and security levels, including some 4196 which provide no or minimal security. A proper implementation will 4197 probably not support many cipher suites. For example, 40-bit 4198 encryption is easily broken, so implementations requiring strong 4199 security should not allow 40-bit keys. Similarly, anonymous Diffie- 4200 Hellman is strongly discouraged because it cannot prevent man-in-the- 4201 middle attacks. Applications should also enforce minimum and maximum 4202 key sizes. For example, certificate chains containing 512-bit RSA 4203 keys or signatures are not appropriate for high-security 4204 applications. 4206 E. Backward Compatibility 4208 For historical reasons and in order to avoid a profligate consumption 4209 of reserved port numbers, application protocols which are secured by 4210 TLS, SSL 3.0, and SSL 2.0 all frequently share the same connection 4211 port: for example, the https protocol (HTTP secured by SSL or TLS) 4212 uses port 443 regardless of which security protocol it is using. 4213 Thus, some mechanism must be determined to distinguish and negotiate 4214 among the various protocols. 4216 TLS versions 1.2, 1.1, 1.0, and SSL 3.0 are very similar; thus, 4217 supporting them all at the same time is relatively easy. TLS clients 4218 who wish to negotiate with such older servers SHOULD send client 4219 hello messages using the SSL 3.0 record format and client hello 4220 structure, sending {3, 3} for the client version field to note that 4221 they support TLS 1.2 and {3, 0} for the record version field (because 4222 the SSLv3 record format is being used--although the cleartext record 4223 format is the same for all versions). If the server supports only a 4224 downrev version it will respond with a downrev 3.0 server hello; if 4225 it supports TLS 1.2 it will respond with a TLS 1.2 server hello. The 4226 negotiation then proceeds as appropriate for the negotiated protocol. 4228 Similarly, a TLS 1.2 server which wishes to interoperate with 4229 downrev clients SHOULD accept downrev client hello messages and 4230 respond with appropriate version fields. Note that the version in the 4231 server hello message and in the record header are the same. 4233 Whenever a client already knows the highest protocol known to a 4234 server (for example, when resuming a session), it SHOULD initiate the 4235 connection in that native protocol. 4237 TLS 1.1 clients that support SSL Version 2.0 servers MUST send SSL 4238 Version 2.0 client hello messages [SSL2]. TLS servers SHOULD accept 4239 either client hello format if they wish to support SSL 2.0 clients on 4240 the same connection port. The only deviations from the Version 2.0 4241 specification are the ability to specify a version with a value of 4242 three and the support for more ciphering types in the CipherSpec. 4244 Warning: The ability to send Version 2.0 client hello messages will be 4245 phased out with all due haste. Implementors SHOULD make every 4246 effort to move forward as quickly as possible. Version 3.0 4247 provides better mechanisms for moving to newer versions. 4249 The following cipher specifications are carryovers from SSL Version 4250 2.0. These are assumed to use RSA for key exchange and 4251 authentication. 4253 V2CipherSpec TLS_RC4_128_WITH_MD5 = { 0x01,0x00,0x80 }; 4254 V2CipherSpec TLS_RC4_128_EXPORT40_WITH_MD5 = { 0x02,0x00,0x80 }; 4255 V2CipherSpec TLS_RC2_CBC_128_CBC_WITH_MD5 = { 0x03,0x00,0x80 }; 4256 V2CipherSpec TLS_RC2_CBC_128_CBC_EXPORT40_WITH_MD5 4257 = { 0x04,0x00,0x80 }; 4258 V2CipherSpec TLS_IDEA_128_CBC_WITH_MD5 = { 0x05,0x00,0x80 }; 4259 V2CipherSpec TLS_DES_64_CBC_WITH_MD5 = { 0x06,0x00,0x40 }; 4260 V2CipherSpec TLS_DES_192_EDE3_CBC_WITH_MD5 = { 0x07,0x00,0xC0 }; 4262 Cipher specifications native to TLS can be included in Version 2.0 4263 client hello messages using the syntax below. Any V2CipherSpec 4264 element with its first byte equal to zero will be ignored by Version 4265 2.0 servers. Clients sending any of the above V2CipherSpecs SHOULD 4266 also include the TLS equivalent (see Appendix A.5): 4268 V2CipherSpec (see TLS name) = { 0x00, CipherSuite }; 4270 Note: TLS 1.2 clients may generate the SSLv2 EXPORT cipher suites in 4271 handshakes for backward compatibility but MUST NOT negotiate them in 4272 TLS 1.2 mode. 4274 E.1. Version 2 client hello 4276 The Version 2.0 client hello message is presented below using this 4277 document's presentation model. The true definition is still assumed 4278 to be the SSL Version 2.0 specification. Note that this message MUST 4279 be sent directly on the wire, not wrapped as an SSLv3 record 4281 uint8 V2CipherSpec[3]; 4283 struct { 4284 uint16 msg_length; 4285 uint8 msg_type; 4286 Version version; 4287 uint16 cipher_spec_length; 4288 uint16 session_id_length; 4289 uint16 challenge_length; 4290 V2CipherSpec cipher_specs[V2ClientHello.cipher_spec_length]; 4291 opaque session_id[V2ClientHello.session_id_length]; 4292 opaque challenge[V2ClientHello.challenge_length; 4293 } V2ClientHello; 4295 msg_length 4296 This field is the length of the following data in bytes. The high 4297 bit MUST be 1 and is not part of the length. 4299 msg_type 4300 This field, in conjunction with the version field, identifies a 4301 version 2 client hello message. The value SHOULD be one (1). 4303 version 4304 The highest version of the protocol supported by the client 4305 (equals ProtocolVersion.version, see Appendix A.1). 4307 cipher_spec_length 4308 This field is the total length of the field cipher_specs. It 4309 cannot be zero and MUST be a multiple of the V2CipherSpec length 4310 (3). 4312 session_id_length 4313 This field MUST have a value of zero. 4315 challenge_length 4316 The length in bytes of the client's challenge to the server to 4317 authenticate itself. When using the SSLv2 backward compatible 4318 handshake the client MUST use a 32-byte challenge. 4320 cipher_specs 4321 This is a list of all CipherSpecs the client is willing and able 4322 to use. There MUST be at least one CipherSpec acceptable to the 4323 server. 4325 session_id 4326 This field MUST be empty. 4328 challenge 4329 The client challenge to the server for the server to identify 4330 itself is a (nearly) arbitrary length random. The TLS server will 4331 right justify the challenge data to become the ClientHello.random 4332 data (padded with leading zeroes, if necessary), as specified in 4333 this protocol specification. If the length of the challenge is 4334 greater than 32 bytes, only the last 32 bytes are used. It is 4335 legitimate (but not necessary) for a V3 server to reject a V2 4336 ClientHello that has fewer than 16 bytes of challenge data. 4338 Note: Requests to resume a TLS session MUST use a TLS client hello. 4340 E.2. Avoiding man-in-the-middle version rollback 4342 When TLS clients fall back to Version 2.0 compatibility mode, they 4343 SHOULD use special PKCS #1 block formatting. This is done so that TLS 4344 servers will reject Version 2.0 sessions with TLS-capable clients. 4346 When TLS clients are in Version 2.0 compatibility mode, they set the 4347 right-hand (least-significant) 8 random bytes of the PKCS padding 4348 (not including the terminal null of the padding) for the RSA 4349 encryption of the ENCRYPTED-KEY-DATA field of the CLIENT-MASTER-KEY 4350 to 0x03 (the other padding bytes are random). After decrypting the 4351 ENCRYPTED-KEY-DATA field, servers that support TLS SHOULD issue an 4352 error if these eight padding bytes are 0x03. Version 2.0 servers 4353 receiving blocks padded in this manner will proceed normally. 4355 F. Security analysis 4357 The TLS protocol is designed to establish a secure connection between 4358 a client and a server communicating over an insecure channel. This 4359 document makes several traditional assumptions, including that 4360 attackers have substantial computational resources and cannot obtain 4361 secret information from sources outside the protocol. Attackers are 4362 assumed to have the ability to capture, modify, delete, replay, and 4363 otherwise tamper with messages sent over the communication channel. 4364 This appendix outlines how TLS has been designed to resist a variety 4365 of attacks. 4367 F.1. Handshake protocol 4369 The handshake protocol is responsible for selecting a CipherSpec and 4370 generating a Master Secret, which together comprise the primary 4371 cryptographic parameters associated with a secure session. The 4372 handshake protocol can also optionally authenticate parties who have 4373 certificates signed by a trusted certificate authority. 4375 F.1.1. Authentication and key exchange 4377 TLS supports three authentication modes: authentication of both 4378 parties, server authentication with an unauthenticated client, and 4379 total anonymity. Whenever the server is authenticated, the channel is 4380 secure against man-in-the-middle attacks, but completely anonymous 4381 sessions are inherently vulnerable to such attacks. Anonymous 4382 servers cannot authenticate clients. If the server is authenticated, 4383 its certificate message must provide a valid certificate chain 4384 leading to an acceptable certificate authority. Similarly, 4385 authenticated clients must supply an acceptable certificate to the 4386 server. Each party is responsible for verifying that the other's 4387 certificate is valid and has not expired or been revoked. 4389 The general goal of the key exchange process is to create a 4390 pre_master_secret known to the communicating parties and not to 4391 attackers. The pre_master_secret will be used to generate the 4392 master_secret (see Section 8.1). The master_secret is required to 4393 generate the finished messages, encryption keys, and MAC secrets (see 4394 Sections 7.4.10, 7.4.11 and 6.3). By sending a correct finished 4395 message, parties thus prove that they know the correct 4396 pre_master_secret. 4398 F.1.1.1. Anonymous key exchange 4400 Completely anonymous sessions can be established using RSA or Diffie- 4401 Hellman for key exchange. With anonymous RSA, the client encrypts a 4402 pre_master_secret with the server's uncertified public key extracted 4403 from the server key exchange message. The result is sent in a client 4404 key exchange message. Since eavesdroppers do not know the server's 4405 private key, it will be infeasible for them to decode the 4406 pre_master_secret. 4408 Note: No anonymous RSA Cipher Suites are defined in this document. 4410 With Diffie-Hellman, the server's public parameters are contained in 4411 the server key exchange message and the client's are sent in the 4412 client key exchange message. Eavesdroppers who do not know the 4413 private values should not be able to find the Diffie-Hellman result 4414 (i.e. the pre_master_secret). 4416 Warning: Completely anonymous connections only provide protection 4417 against passive eavesdropping. Unless an independent tamper- 4418 proof channel is used to verify that the finished messages 4419 were not replaced by an attacker, server authentication is 4420 required in environments where active man-in-the-middle 4421 attacks are a concern. 4423 F.1.1.2. RSA key exchange and authentication 4425 With RSA, key exchange and server authentication are combined. The 4426 public key may be either contained in the server's certificate or may 4427 be a temporary RSA key sent in a server key exchange message. When 4428 temporary RSA keys are used, they are signed by the server's RSA 4429 certificate. The signature includes the current ClientHello.random, 4430 so old signatures and temporary keys cannot be replayed. Servers may 4431 use a single temporary RSA key for multiple negotiation sessions. 4433 Note: The temporary RSA key option is useful if servers need large 4434 certificates but must comply with government-imposed size limits 4435 on keys used for key exchange. 4437 Note that if ephemeral RSA is not used, compromise of the server's 4438 static RSA key results in a loss of confidentiality for all sessions 4439 protected under that static key. TLS users desiring Perfect Forward 4440 Secrecy should use DHE cipher suites. The damage done by exposure of 4441 a private key can be limited by changing one's private key (and 4442 certificate) frequently. 4444 After verifying the server's certificate, the client encrypts a 4445 pre_master_secret with the server's public key. By successfully 4446 decoding the pre_master_secret and producing a correct finished 4447 message, the server demonstrates that it knows the private key 4448 corresponding to the server certificate. 4450 When RSA is used for key exchange, clients are authenticated using 4451 the certificate verify message (see Section 7.4.10). The client signs 4452 a value derived from the master_secret and all preceding handshake 4453 messages. These handshake messages include the server certificate, 4454 which binds the signature to the server, and ServerHello.random, 4455 which binds the signature to the current handshake process. 4457 F.1.1.3. Diffie-Hellman key exchange with authentication 4459 When Diffie-Hellman key exchange is used, the server can either 4460 supply a certificate containing fixed Diffie-Hellman parameters or 4461 can use the server key exchange message to send a set of temporary 4462 Diffie-Hellman parameters signed with a DSS or RSA certificate. 4463 Temporary parameters are hashed with the hello.random values before 4464 signing to ensure that attackers do not replay old parameters. In 4465 either case, the client can verify the certificate or signature to 4466 ensure that the parameters belong to the server. 4468 If the client has a certificate containing fixed Diffie-Hellman 4469 parameters, its certificate contains the information required to 4470 complete the key exchange. Note that in this case the client and 4471 server will generate the same Diffie-Hellman result (i.e., 4472 pre_master_secret) every time they communicate. To prevent the 4473 pre_master_secret from staying in memory any longer than necessary, 4474 it should be converted into the master_secret as soon as possible. 4475 Client Diffie-Hellman parameters must be compatible with those 4476 supplied by the server for the key exchange to work. 4478 If the client has a standard DSS or RSA certificate or is 4479 unauthenticated, it sends a set of temporary parameters to the server 4480 in the client key exchange message, then optionally uses a 4481 certificate verify message to authenticate itself. 4483 If the same DH keypair is to be used for multiple handshakes, either 4484 because the client or server has a certificate containing a fixed DH 4485 keypair or because the server is reusing DH keys, care must be taken 4486 to prevent small subgroup attacks. Implementations SHOULD follow the 4487 guidelines found in [SUBGROUP]. 4489 Small subgroup attacks are most easily avoided by using one of the 4490 DHE ciphersuites and generating a fresh DH private key (X) for each 4491 handshake. If a suitable base (such as 2) is chosen, g^X mod p can be 4492 computed very quickly so the performance cost is minimized. 4493 Additionally, using a fresh key for each handshake provides Perfect 4494 Forward Secrecy. Implementations SHOULD generate a new X for each 4495 handshake when using DHE ciphersuites. 4497 F.1.2. Version rollback attacks 4498 Because TLS includes substantial improvements over SSL Version 2.0, 4499 attackers may try to make TLS-capable clients and servers fall back 4500 to Version 2.0. This attack can occur if (and only if) two TLS- 4501 capable parties use an SSL 2.0 handshake. 4503 Although the solution using non-random PKCS #1 block type 2 message 4504 padding is inelegant, it provides a reasonably secure way for Version 4505 3.0 servers to detect the attack. This solution is not secure against 4506 attackers who can brute force the key and substitute a new ENCRYPTED- 4507 KEY-DATA message containing the same key (but with normal padding) 4508 before the application specified wait threshold has expired. Parties 4509 concerned about attacks of this scale should not be using 40-bit 4510 encryption keys anyway. Altering the padding of the least-significant 4511 8 bytes of the PKCS padding does not impact security for the size of 4512 the signed hashes and RSA key lengths used in the protocol, since 4513 this is essentially equivalent to increasing the input block size by 4514 8 bytes. 4516 F.1.3. Detecting attacks against the handshake protocol 4518 An attacker might try to influence the handshake exchange to make the 4519 parties select different encryption algorithms than they would 4520 normally chooses. 4522 For this attack, an attacker must actively change one or more 4523 handshake messages. If this occurs, the client and server will 4524 compute different values for the handshake message hashes. As a 4525 result, the parties will not accept each others' finished messages. 4526 Without the master_secret, the attacker cannot repair the finished 4527 messages, so the attack will be discovered. 4529 F.1.4. Resuming sessions 4531 When a connection is established by resuming a session, new 4532 ClientHello.random and ServerHello.random values are hashed with the 4533 session's master_secret. Provided that the master_secret has not been 4534 compromised and that the secure hash operations used to produce the 4535 encryption keys and MAC secrets are secure, the connection should be 4536 secure and effectively independent from previous connections. 4537 Attackers cannot use known encryption keys or MAC secrets to 4538 compromise the master_secret without breaking the secure hash 4539 operations (which use both SHA and MD5). 4541 Sessions cannot be resumed unless both the client and server agree. 4542 If either party suspects that the session may have been compromised, 4543 or that certificates may have expired or been revoked, it should 4544 force a full handshake. An upper limit of 24 hours is suggested for 4545 session ID lifetimes, since an attacker who obtains a master_secret 4546 may be able to impersonate the compromised party until the 4547 corresponding session ID is retired. Applications that may be run in 4548 relatively insecure environments should not write session IDs to 4549 stable storage. 4551 F.1.5 Extensions 4553 Security considerations for the extension mechanism in general, and 4554 the design of new extensions, are described in the previous section. 4555 A security analysis of each of the extensions defined in this 4556 document is given below. 4558 In general, implementers should continue to monitor the state of the 4559 art, and address any weaknesses identified. 4561 F.1.5.1 Security of server_name 4563 If a single server hosts several domains, then clearly it is 4564 necessary for the owners of each domain to ensure that this satisfies 4565 their security needs. Apart from this, server_name does not appear 4566 to introduce significant security issues. 4568 Implementations MUST ensure that a buffer overflow does not occur 4569 whatever the values of the length fields in server_name. 4571 Although this document specifies an encoding for internationalized 4572 hostnames in the server_name extension, it does not address any 4573 security issues associated with the use of internationalized 4574 hostnames in TLS - in particular, the consequences of "spoofed" names 4575 that are indistinguishable from another name when displayed or 4576 printed. It is recommended that server certificates not be issued 4577 for internationalized hostnames unless procedures are in place to 4578 mitigate the risk of spoofed hostnames. 4580 6.2. Security of max_fragment_length 4582 The maximum fragment length takes effect immediately, including for 4583 handshake messages. However, that does not introduce any security 4584 complications that are not already present in TLS, since [TLS] 4585 requires implementations to be able to handle fragmented handshake 4586 messages. 4588 Note that as described in section XXX, once a non-null cipher suite 4589 has been activated, the effective maximum fragment length depends on 4590 the cipher suite and compression method, as well as on the negotiated 4591 max_fragment_length. This must be taken into account when sizing 4592 buffers, and checking for buffer overflow. 4594 F.1.5.2 Security of client_certificate_url 4596 There are two major issues with this extension. 4598 The first major issue is whether or not clients should include 4599 certificate hashes when they send certificate URLs. 4601 When client authentication is used *without* the 4602 client_certificate_url extension, the client certificate chain is 4603 covered by the Finished message hashes. The purpose of including 4604 hashes and checking them against the retrieved certificate chain, is 4605 to ensure that the same property holds when this extension is used - 4606 i.e., that all of the information in the certificate chain retrieved 4607 by the server is as the client intended. 4609 On the other hand, omitting certificate hashes enables functionality 4610 that is desirable in some circumstances - for example clients can be 4611 issued daily certificates that are stored at a fixed URL and need not 4612 be provided to the client. Clients that choose to omit certificate 4613 hashes should be aware of the possibility of an attack in which the 4614 attacker obtains a valid certificate on the client's key that is 4615 different from the certificate the client intended to provide. 4616 Although TLS uses both MD5 and SHA-1 hashes in several other places, 4617 this was not believed to be necessary here. The property required of 4618 SHA-1 is second pre-image resistance. 4620 The second major issue is that support for client_certificate_url 4621 involves the server acting as a client in another URL protocol. The 4622 server therefore becomes subject to many of the same security 4623 concerns that clients of the URL scheme are subject to, with the 4624 added concern that the client can attempt to prompt the server to 4625 connect to some, possibly weird-looking URL. 4627 In general this issue means that an attacker might use the server to 4628 indirectly attack another host that is vulnerable to some security 4629 flaw. It also introduces the possibility of denial of service 4630 attacks in which an attacker makes many connections to the server, 4631 each of which results in the server attempting a connection to the 4632 target of the attack. 4634 Note that the server may be behind a firewall or otherwise able to 4635 access hosts that would not be directly accessible from the public 4636 Internet; this could exacerbate the potential security and denial of 4637 service problems described above, as well as allowing the existence 4638 of internal hosts to be confirmed when they would otherwise be 4639 hidden. 4641 The detailed security concerns involved will depend on the URL 4642 schemes supported by the server. In the case of HTTP, the concerns 4643 are similar to those that apply to a publicly accessible HTTP proxy 4644 server. In the case of HTTPS, the possibility for loops and 4645 deadlocks to be created exists and should be addressed. In the case 4646 of FTP, attacks similar to FTP bounce attacks arise. 4648 As a result of this issue, it is RECOMMENDED that the 4649 client_certificate_url extension should have to be specifically 4650 enabled by a server administrator, rather than being enabled by 4651 default. It is also RECOMMENDED that URI protocols be enabled by the 4652 administrator individually, and only a minimal set of protocols be 4653 enabled, with unusual protocols offering limited security or whose 4654 security is not well-understood being avoided. 4656 As discussed in [URI], URLs that specify ports other than the default 4657 may cause problems, as may very long URLs (which are more likely to 4658 be useful in exploiting buffer overflow bugs). 4660 Also note that HTTP caching proxies are common on the Internet, and 4661 some proxies do not check for the latest version of an object 4662 correctly. If a request using HTTP (or another caching protocol) 4663 goes through a misconfigured or otherwise broken proxy, the proxy may 4664 return an out-of-date response. 4666 F.1.5.4. Security of trusted_ca_keys 4668 It is possible that which CA root keys a client possesses could be 4669 regarded as confidential information. As a result, the CA root key 4670 indication extension should be used with care. 4672 The use of the SHA-1 certificate hash alternative ensures that each 4673 certificate is specified unambiguously. As for the previous 4674 extension, it was not believed necessary to use both MD5 and SHA-1 4675 hashes. 4677 F.1.5.5. Security of truncated_hmac 4679 It is possible that truncated MACs are weaker than "un-truncated" 4680 MACs. However, no significant weaknesses are currently known or 4681 expected to exist for HMAC with MD5 or SHA-1, truncated to 80 bits. 4683 Note that the output length of a MAC need not be as long as the 4684 length of a symmetric cipher key, since forging of MAC values cannot 4685 be done off-line: in TLS, a single failed MAC guess will cause the 4686 immediate termination of the TLS session. 4688 Since the MAC algorithm only takes effect after the handshake 4689 messages have been authenticated by the hashes in the Finished 4690 messages, it is not possible for an active attacker to force 4691 negotiation of the truncated HMAC extension where it would not 4692 otherwise be used (to the extent that the handshake authentication is 4693 secure). Therefore, in the event that any security problem were 4694 found with truncated HMAC in future, if either the client or the 4695 server for a given session were updated to take into account the 4696 problem, they would be able to veto use of this extension. 4698 F.1.5.6. Security of status_request 4700 If a client requests an OCSP response, it must take into account that 4701 an attacker's server using a compromised key could (and probably 4702 would) pretend not to support the extension. A client that requires 4703 OCSP validation of certificates SHOULD either contact the OCSP server 4704 directly in this case, or abort the handshake. 4706 Use of the OCSP nonce request extension (id-pkix-ocsp-nonce) may 4707 improve security against attacks that attempt to replay OCSP 4708 responses; see section 4.4.1 of [OCSP] for further details. 4710 F.2. Protecting application data 4712 The master_secret is hashed with the ClientHello.random and 4713 ServerHello.random to produce unique data encryption keys and MAC 4714 secrets for each connection. 4716 Outgoing data is protected with a MAC before transmission. To prevent 4717 message replay or modification attacks, the MAC is computed from the 4718 MAC secret, the sequence number, the message length, the message 4719 contents, and two fixed character strings. The message type field is 4720 necessary to ensure that messages intended for one TLS Record Layer 4721 client are not redirected to another. The sequence number ensures 4722 that attempts to delete or reorder messages will be detected. Since 4723 sequence numbers are 64-bits long, they should never overflow. 4724 Messages from one party cannot be inserted into the other's output, 4725 since they use independent MAC secrets. Similarly, the server-write 4726 and client-write keys are independent so stream cipher keys are used 4727 only once. 4729 If an attacker does break an encryption key, all messages encrypted 4730 with it can be read. Similarly, compromise of a MAC key can make 4731 message modification attacks possible. Because MACs are also 4732 encrypted, message-alteration attacks generally require breaking the 4733 encryption algorithm as well as the MAC. 4735 Note: MAC secrets may be larger than encryption keys, so messages can 4736 remain tamper resistant even if encryption keys are broken. 4738 F.3. Explicit IVs 4740 [CBCATT] describes a chosen plaintext attack on TLS that depends 4741 on knowing the IV for a record. Previous versions of TLS [TLS1.0] 4742 used the CBC residue of the previous record as the IV and 4743 therefore enabled this attack. This version uses an explicit IV 4744 in order to protect against this attack. 4746 F.4 Security of Composite Cipher Modes 4748 TLS secures transmitted application data via the use of symmetric 4749 encryption and authentication functions defined in the negotiated 4750 ciphersuite. The objective is to protect both the integrity and 4751 confidentiality of the transmitted data from malicious actions by 4752 active attackers in the network. It turns out that the order in 4753 which encryption and authentication functions are applied to the 4754 data plays an important role for achieving this goal [ENCAUTH]. 4756 The most robust method, called encrypt-then-authenticate, first 4757 applies encryption to the data and then applies a MAC to the 4758 ciphertext. This method ensures that the integrity and 4759 confidentiality goals are obtained with ANY pair of encryption 4760 and MAC functions provided that the former is secure against 4761 chosen plaintext attacks and the MAC is secure against chosen- 4762 message attacks. TLS uses another method, called authenticate- 4763 then-encrypt, in which first a MAC is computed on the plaintext 4764 and then the concatenation of plaintext and MAC is encrypted. 4765 This method has been proven secure for CERTAIN combinations of 4766 encryption functions and MAC functions, but is not guaranteed to 4767 be secure in general. In particular, it has been shown that there 4768 exist perfectly secure encryption functions (secure even in the 4769 information theoretic sense) that combined with any secure MAC 4770 function fail to provide the confidentiality goal against an 4771 active attack. Therefore, new ciphersuites and operation modes 4772 adopted into TLS need to be analyzed under the authenticate-then- 4773 encrypt method to verify that they achieve the stated integrity 4774 and confidentiality goals. 4776 Currently, the security of the authenticate-then-encrypt method 4777 has been proven for some important cases. One is the case of 4778 stream ciphers in which a computationally unpredictable pad of 4779 the length of the message plus the length of the MAC tag is 4780 produced using a pseudo-random generator and this pad is xor-ed 4781 with the concatenation of plaintext and MAC tag. The other is 4782 the case of CBC mode using a secure block cipher. In this case, 4783 security can be shown if one applies one CBC encryption pass to 4784 the concatenation of plaintext and MAC and uses a new, 4785 independent and unpredictable, IV for each new pair of plaintext 4786 and MAC. In previous versions of SSL, CBC mode was used properly 4787 EXCEPT that it used a predictable IV in the form of the last 4788 block of the previous ciphertext. This made TLS open to chosen 4789 plaintext attacks. This verson of the protocol is immune to 4790 those attacks. For exact details in the encryption modes proven 4791 secure see [ENCAUTH]. 4793 F.5 Denial of Service 4795 TLS is susceptible to a number of denial of service (DoS) 4796 attacks. In particular, an attacker who initiates a large number 4797 of TCP connections can cause a server to consume large amounts of 4798 CPU doing RSA decryption. However, because TLS is generally used 4799 over TCP, it is difficult for the attacker to hide his point of 4800 origin if proper TCP SYN randomization is used [SEQNUM] by the 4801 TCP stack. 4803 Because TLS runs over TCP, it is also susceptible to a number of 4804 denial of service attacks on individual connections. In 4805 particular, attackers can forge RSTs, terminating connections, or 4806 forge partial TLS records, causing the connection to stall. 4807 These attacks cannot in general be defended against by a TCP- 4808 using protocol. Implementors or users who are concerned with this 4809 class of attack should use IPsec AH [AH] or ESP [ESP]. 4811 F.6. Final notes 4813 For TLS to be able to provide a secure connection, both the client 4814 and server systems, keys, and applications must be secure. In 4815 addition, the implementation must be free of security errors. 4817 The system is only as strong as the weakest key exchange and 4818 authentication algorithm supported, and only trustworthy 4819 cryptographic functions should be used. Short public keys, 40-bit 4820 bulk encryption keys, and anonymous servers should be used with great 4821 caution. Implementations and users must be careful when deciding 4822 which certificates and certificate authorities are acceptable; a 4823 dishonest certificate authority can do tremendous damage. 4825 Security Considerations 4827 Security issues are discussed throughout this memo, especially in 4828 Appendices D, E, and F. 4830 Normative References 4831 [AES] National Institute of Standards and Technology, 4832 "Specification for the Advanced Encryption Standard (AES)" 4833 FIPS 197. November 26, 2001. 4835 [3DES] W. Tuchman, "Hellman Presents No Shortcut Solutions To DES," 4836 IEEE Spectrum, v. 16, n. 7, July 1979, pp40-41. 4838 [DES] ANSI X3.106, "American National Standard for Information 4839 Systems-Data Link Encryption," American National Standards 4840 Institute, 1983. 4842 [DSS] NIST FIPS PUB 186-2, "Digital Signature Standard," National 4843 Institute of Standards and Technology, U.S. Department of 4844 Commerce, 2000. 4846 [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 4847 Hashing for Message Authentication," RFC 2104, February 4848 1997. 4850 [HTTP] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, 4851 L., Leach, P. and T. Berners-Lee, "Hypertext Transfer 4852 Protocol -- HTTP/1.1", RFC 2616, June 1999. 4854 [IDEA] X. Lai, "On the Design and Security of Block Ciphers," ETH 4855 Series in Information Processing, v. 1, Konstanz: Hartung- 4856 Gorre Verlag, 1992. 4858 [IDNA] Faltstrom, P., Hoffman, P. and A. Costello, 4859 "Internationalizing Domain Names in Applications (IDNA)", 4860 RFC 3490, March 2003. 4862 [MD5] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321, 4863 April 1992. 4865 [OCSP] Myers, M., Ankney, R., Malpani, A., Galperin, S. and C. 4866 Adams, "Internet X.509 Public Key Infrastructure: Online 4867 Certificate Status Protocol - OCSP", RFC 2560, June 1999. 4869 [PKCS1A] B. Kaliski, "Public-Key Cryptography Standards (PKCS) #1: 4870 RSA Cryptography Specifications Version 1.5", RFC 2313, 4871 March 1998. 4873 [PKCS1B] J. Jonsson, B. Kaliski, "Public-Key Cryptography Standards 4874 (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 4875 3447, February 2003. 4877 [PKIOP] Housley, R. and P. Hoffman, "Internet X.509 Public Key 4878 Infrastructure - Operation Protocols: FTP and HTTP", RFC 4879 2585, May 1999. 4881 [PKIX] Housley, R., Ford, W., Polk, W. and D. Solo, "Internet 4882 Public Key Infrastructure: Part I: X.509 Certificate and CRL 4883 Profile", RFC 3280, April 2002. 4885 [RC2] Rivest, R., "A Description of the RC2(r) Encryption 4886 Algorithm", RFC 2268, January 1998. 4888 [SCH] B. Schneier. "Applied Cryptography: Protocols, Algorithms, 4889 and Source Code in C, 2ed", Published by John Wiley & Sons, 4890 Inc. 1996. 4892 [SHA] NIST FIPS PUB 180-2, "Secure Hash Standard," National 4893 Institute of Standards and Technology, U.S. Department of 4894 Commerce., August 2001. 4896 [REQ] Bradner, S., "Key words for use in RFCs to Indicate 4897 Requirement Levels", BCP 14, RFC 2119, March 1997. 4899 [RFC2434] T. Narten, H. Alvestrand, "Guidelines for Writing an IANA 4900 Considerations Section in RFCs", RFC 3434, October 1998. 4902 [TLSAES] Chown, P. "Advanced Encryption Standard (AES) Ciphersuites 4903 for Transport Layer Security (TLS)", RFC 3268, June 2002. 4905 [TLSEXT] Blake-Wilson, S., Nystrom, M, Hopwood, D., Mikkelsen, J., 4906 Wright, T., "Transport Layer Security (TLS) Extensions", RFC 4907 3546, June 2003. 4908 [TLSKRB] A. Medvinsky, M. Hur, "Addition of Kerberos Cipher Suites to 4909 Transport Layer Security (TLS)", RFC 2712, October 1999. 4911 [URI] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform 4912 Resource Identifiers (URI): Generic Syntax", RFC 2396, 4913 August 1998. 4915 [UTF8] Yergeau, F., "UTF-8, a transformation format of ISO 10646", 4916 RFC 3629, November 2003. 4918 [X509-4th] ITU-T Recommendation X.509 (2000) | ISO/IEC 9594- 8:2001, 4919 "Information Systems - Open Systems Interconnection - The 4920 Directory: Public key and Attribute certificate 4921 frameworks." 4923 [X509-4th-TC1] ITU-T Recommendation X.509(2000) Corrigendum 1(2001) | 4924 ISO/IEC 9594-8:2001/Cor.1:2002, Technical Corrigendum 1 to 4925 ISO/IEC 9594:8:2001. 4927 Informative References 4929 [AEAD] Mcgrew, D., "Authenticated Encryption", July 2006, draft- 4930 mcgrew-auth-enc-00.txt. 4932 [AH] Kent, S., and Atkinson, R., "IP Authentication Header", RFC 4933 2402, November 1998. 4935 [BLEI] Bleichenbacher D., "Chosen Ciphertext Attacks against 4936 Protocols Based on RSA Encryption Standard PKCS #1" in 4937 Advances in Cryptology -- CRYPTO'98, LNCS vol. 1462, pages: 4938 1-12, 1998. 4940 [CBCATT] Moeller, B., "Security of CBC Ciphersuites in SSL/TLS: 4941 Problems and Countermeasures", 4942 http://www.openssl.org/~bodo/tls-cbc.txt. 4944 [CBCTIME] Canvel, B., "Password Interception in a SSL/TLS Channel", 4945 http://lasecwww.epfl.ch/memo_ssl.shtml, 2003. 4947 [CCM] "NIST Special Publication 800-38C: The CCM Mode for 4948 Authentication and Confidentiality", 4949 http://csrc.nist.gov/publications/nistpubs/SP800-38C.pdf. 4951 [ENCAUTH] Krawczyk, H., "The Order of Encryption and Authentication 4952 for Protecting Communications (Or: How Secure is SSL?)", 4953 Crypto 2001. 4955 [ESP] Kent, S., and Atkinson, R., "IP Encapsulating Security 4956 Payload (ESP)", RFC 2406, November 1998. 4958 [GCM] "NIST Special Publication 800-38C: The CCM Mode for 4959 Authentication and Confidentiality", 4960 http://csrc.nist.gov/publications/nistpubs/SP800-38C.pdf. 4962 [KPR03] Klima, V., Pokorny, O., Rosa, T., "Attacking RSA-based 4963 Sessions in SSL/TLS", http://eprint.iacr.org/2003/052/, 4964 March 2003. 4966 [PKCS6] RSA Laboratories, "PKCS #6: RSA Extended Certificate Syntax 4967 Standard," version 1.5, November 1993. 4969 [PKCS7] RSA Laboratories, "PKCS #7: RSA Cryptographic Message Syntax 4970 Standard," version 1.5, November 1993. 4972 [RANDOM] D. Eastlake 3rd, S. Crocker, J. Schiller. "Randomness 4973 Recommendations for Security", RFC 1750, December 1994. 4975 [RSA] R. Rivest, A. Shamir, and L. M. Adleman, "A Method for 4976 Obtaining Digital Signatures and Public-Key Cryptosystems," 4977 Communications of the ACM, v. 21, n. 2, Feb 1978, pp. 4978 120-126. 4980 [SEQNUM] Bellovin. S., "Defending Against Sequence Number Attacks", 4981 RFC 1948, May 1996. 4983 [SSL2] Hickman, Kipp, "The SSL Protocol", Netscape Communications 4984 Corp., Feb 9, 1995. 4986 [SSL3] A. Frier, P. Karlton, and P. Kocher, "The SSL 3.0 Protocol", 4987 Netscape Communications Corp., Nov 18, 1996. 4989 [SUBGROUP] R. Zuccherato, "Methods for Avoiding the Small-Subgroup 4990 Attacks on the Diffie-Hellman Key Agreement Method for 4991 S/MIME", RFC 2785, March 2000. 4993 [TCP] Postel, J., "Transmission Control Protocol," STD 7, RFC 793, 4994 September 1981. 4996 [TIMING] Boneh, D., Brumley, D., "Remote timing attacks are 4997 practical", USENIX Security Symposium 2003. 4999 [TLS1.0] Dierks, T., and Allen, C., "The TLS Protocol, Version 1.0", 5000 RFC 2246, January 1999. 5002 [TLS1.1] Dierks, T., and Rescorla, E., "The TLS Protocol, Version 5003 1.1", RFC 4346, April, 2006. 5005 [X501] ITU-T Recommendation X.501: Information Technology - Open 5006 Systems Interconnection - The Directory: Models, 1993. 5008 [X509] ITU-T Recommendation X.509 (1997 E): Information Technology - 5009 Open Systems Interconnection - "The Directory - 5010 Authentication Framework". 1988. 5012 [XDR] R. Srinivansan, Sun Microsystems, "XDR: External Data 5013 Representation Standard", RFC 1832, August 1995. 5015 Credits 5017 Working Group Chairs 5018 Eric Rescorla 5019 EMail: ekr@networkresonance.com 5021 Pasi Eronen 5022 pasi.eronen@nokia.com 5024 Editors 5026 Tim Dierks Eric Rescorla 5027 Independent Network Resonance, Inc. 5029 EMail: tim@dierks.org EMail: ekr@networkresonance.com 5031 Other contributors 5033 Christopher Allen (co-editor of TLS 1.0) 5034 Alacrity Ventures 5035 ChristopherA@AlacrityManagement.com 5037 Martin Abadi 5038 University of California, Santa Cruz 5039 abadi@cs.ucsc.edu 5041 Steven M. Bellovin 5042 Columbia University 5043 smb@cs.columbia.edu 5045 Simon Blake-Wilson 5046 BCI 5047 EMail: sblakewilson@bcisse.com 5049 Ran Canetti 5050 IBM 5051 canetti@watson.ibm.com 5053 Pete Chown 5054 Skygate Technology Ltd 5055 pc@skygate.co.uk 5057 Taher Elgamal 5058 taher@securify.com 5059 Securify 5060 Anil Gangolli 5061 anil@busybuddha.org 5063 Kipp Hickman 5065 David Hopwood 5066 Independent Consultant 5067 EMail: david.hopwood@blueyonder.co.uk 5069 Phil Karlton (co-author of SSLv3) 5071 Paul Kocher (co-author of SSLv3) 5072 Cryptography Research 5073 paul@cryptography.com 5075 Hugo Krawczyk 5076 Technion Israel Institute of Technology 5077 hugo@ee.technion.ac.il 5079 Jan Mikkelsen 5080 Transactionware 5081 EMail: janm@transactionware.com 5083 Magnus Nystrom 5084 RSA Security 5085 EMail: magnus@rsasecurity.com 5087 Robert Relyea 5088 Netscape Communications 5089 relyea@netscape.com 5091 Jim Roskind 5092 Netscape Communications 5093 jar@netscape.com 5095 Michael Sabin 5097 Dan Simon 5098 Microsoft, Inc. 5099 dansimon@microsoft.com 5101 Tom Weinstein 5103 Tim Wright 5104 Vodafone 5105 EMail: timothy.wright@vodafone.com 5107 Comments 5108 The discussion list for the IETF TLS working group is located at the 5109 e-mail address . Information on the group and 5110 information on how to subscribe to the list is at 5111 5113 Archives of the list can be found at: 5114 5115 Intellectual Property Statement 5117 The IETF takes no position regarding the validity or scope of any 5118 Intellectual Property Rights or other rights that might be claimed to 5119 pertain to the implementation or use of the technology described in 5120 this document or the extent to which any license under such rights 5121 might or might not be available; nor does it represent that it has 5122 made any independent effort to identify any such rights. Information 5123 on the procedures with respect to rights in RFC documents can be 5124 found in BCP 78 and BCP 79. 5126 Copies of IPR disclosures made to the IETF Secretariat and any 5127 assurances of licenses to be made available, or the result of an 5128 attempt made to obtain a general license or permission for the use of 5129 such proprietary rights by implementers or users of this 5130 specification can be obtained from the IETF on-line IPR repository at 5131 http://www.ietf.org/ipr. 5133 The IETF invites any interested party to bring to its attention any 5134 copyrights, patents or patent applications, or other proprietary 5135 rights that may cover technology that may be required to implement 5136 this standard. Please address the information to the IETF at 5137 ietf-ipr@ietf.org. 5139 Disclaimer of Validity 5141 This document and the information contained herein are provided on an 5142 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 5143 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 5144 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 5145 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 5146 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 5147 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 5149 Copyright Statement 5151 Copyright (C) The Internet Society (2006). This document is subject 5152 to the rights, licenses and restrictions contained in BCP 78, and 5153 except as set forth therein, the authors retain all their rights. 5155 Acknowledgment 5157 Funding for the RFC Editor function is currently provided by the 5158 Internet Society.