idnits 2.17.00 (12 Aug 2021) /tmp/idnits3825/draft-ietf-tls-rfc4346-bis-04.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 14. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 4265. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4276. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4283. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4289. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 124 instances of too long lines in the document, the longest one being 8 characters in excess of 72. == There are 1 instance of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == Line 731 has weird spacing: '...gorithm bul...' == Line 2216 has weird spacing: '...ixed_dh a c...' == Line 2218 has weird spacing: '...ixed_dh a c...' == Line 3872 has weird spacing: '...tegrity and...' == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: If a TLS implementation receives a record type it does not understand, it SHOULD just ignore it. Any protocol designed for use over TLS MUST be carefully designed to deal with all possible attacks against it. Note that because the type and length of a record are not protected by encryption, care SHOULD be taken to minimize the value of traffic analysis of these values. Implementations MUST not send record types not defined in this document unless negotiated by some extension. == 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: length The length (in bytes) of the following TLSPlaintext.fragment. The length MUST not exceed 2^14. == 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: Implementations MUST not send zero-length fragments of Handshake, Alert, or Change Cipher Spec content types. Zero-length fragments of Application data MAY be sent as they are potentially useful as a traffic analysis countermeasure. == 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: Meaning of this message: Hello request is a simple notification that the client should begin the negotiation process anew by sending a client hello message when convenient. This message is not intended to establish which side is the client or server but merely to initiate a new negotiation. Servers SHOULD not send a HelloRequest immediately upon the client's initial connection. It is the client's job to send a ClientHello at that time. == 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 that 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 that 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. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a TLS connection during the first handshake on that channel, but MUST not be negotiated, as it provides no more protection than an unsecured connection. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- Couldn't find a document date in the document -- date freshness check skipped. -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC2119' is mentioned on line 199, but not defined -- Looks like a reference, but probably isn't: '0' on line 301 -- Looks like a reference, but probably isn't: '1' on line 301 -- Looks like a reference, but probably isn't: '3' on line 3552 -- Looks like a reference, but probably isn't: '9' on line 337 -- Looks like a reference, but probably isn't: '2' on line 2825 -- Looks like a reference, but probably isn't: '4' on line 373 -- Looks like a reference, but probably isn't: '8' on line 374 -- Looks like a reference, but probably isn't: '10' on line 474 -- Looks like a reference, but probably isn't: '20' on line 2907 -- Looks like a reference, but probably isn't: '48' on line 3139 -- Looks like a reference, but probably isn't: '32' on line 3141 == Missing Reference: 'ChangeCipherSpec' is mentioned on line 1588, but not defined -- Looks like a reference, but probably isn't: '28' on line 2820 == Missing Reference: 'IANA' is mentioned on line 1929, but not defined == Missing Reference: 'TBD' is mentioned on line 1931, but not defined -- Looks like a reference, but probably isn't: '46' on line 2939 -- Looks like a reference, but probably isn't: '12' on line 2962 == Missing Reference: 'RFC4346' is mentioned on line 2635, but not defined ** Obsolete undefined reference: RFC 4346 (Obsoleted by RFC 5246) == Missing Reference: 'RFC4366' is mentioned on line 2663, but not defined ** Obsolete undefined reference: RFC 4366 (Obsoleted by RFC 5246, RFC 6066) == Missing Reference: 'RSADSI' is mentioned on line 3274, but not defined == Missing Reference: 'Issue 22' is mentioned on line 3959, but not defined == Missing Reference: 'Issue 17' is mentioned on line 3962, but not defined == Missing Reference: 'Issue 25' is mentioned on line 3964, but not defined == Missing Reference: 'Issue 41' is mentioned on line 3966, but not defined == Unused Reference: 'REQ' is defined on line 4023, but no explicit reference was found in the text == Unused Reference: 'URI' is defined on line 4030, but no explicit reference was found in the text == Unused Reference: 'X509-4th' is defined on line 4034, but no explicit reference was found in the text == Unused Reference: 'X509-4th-TC1' is defined on line 4039, but no explicit reference was found in the text == Unused Reference: 'TLSEXT' is defined on line 4126, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' -- Possible downref: Non-RFC (?) normative reference: ref. '3DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DSS' ** Downref: Normative reference to an Informational RFC: RFC 2104 (ref. 'HMAC') -- Possible downref: Non-RFC (?) normative reference: ref. 'IDEA' ** Downref: Normative reference to an Informational RFC: RFC 1321 (ref. 'MD5') ** Obsolete normative reference: RFC 3447 (ref. 'PKCS1') (Obsoleted by RFC 8017) ** Obsolete normative reference: RFC 3280 (ref. 'PKIX') (Obsoleted by RFC 5280) ** Downref: Normative reference to an Informational RFC: RFC 2268 (ref. 'RC2') -- Possible downref: Non-RFC (?) normative reference: ref. 'SCH' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) ** 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: draft-mcgrew-auth-enc has been published as RFC 5116 -- Obsolete informational reference (is this intentional?): RFC 4307 (ref. 'IKEALG') (Obsoleted by RFC 8247) -- Obsolete informational reference (is this intentional?): RFC 1948 (ref. 'SEQNUM') (Obsoleted by RFC 6528) -- Obsolete informational reference (is this intentional?): RFC 3268 (ref. 'TLSAES') (Obsoleted by RFC 5246) -- Obsolete informational reference (is this intentional?): RFC 3546 (ref. 'TLSEXT') (Obsoleted by RFC 4366) -- Obsolete informational reference (is this intentional?): RFC 1832 (ref. 'XDR') (Obsoleted by RFC 4506) Summary: 11 errors (**), 0 flaws (~~), 31 warnings (==), 36 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 INTERNET-DRAFT Tim Dierks 2 Obsoletes (if approved): 4346 Independent 3 Intended status: Proposed Standard Eric Rescorla 4 Network Resonance, Inc. 5 July 2007 (Expires January 2008) 7 The TLS Protocol 8 Version 1.2 10 Status of this Memo 11 By submitting this Internet-Draft, each author represents that any 12 applicable patent or other IPR claims of which he or she is aware 13 have been or will be disclosed, and any of which he or she becomes 14 aware will be disclosed, in accordance with Section 6 of BCP 79. 16 Internet-Drafts are working documents of the Internet Engineering 17 Task Force (IETF), its areas, and its working groups. Note that 18 other groups may also distribute working documents as Internet- 19 Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six months 22 and may be updated, replaced, or obsoleted by other documents at any 23 time. It is inappropriate to use Internet-Drafts as reference 24 material or to cite them other than as "work in progress." 26 The list of current Internet-Drafts can be accessed at 27 http://www.ietf.org/ietf/1id-abstracts.txt. 29 The list of Internet-Draft Shadow Directories can be accessed at 30 http://www.ietf.org/shadow.html. 32 Copyright Notice 34 Copyright (C) The IETF Trust (2007). 36 Abstract 38 This document specifies Version 1.2 of the Transport Layer Security 39 (TLS) protocol. The TLS protocol provides communications security 40 over the Internet. The protocol allows client/server applications to 41 communicate in a way that is designed to prevent eavesdropping, 42 tampering, or message forgery. 44 Table of Contents 46 1. Introduction 3 47 1.1 Requirements Terminology 5 48 1.2 Major Differences from TLS 1.1 5 49 2. Goals 5 50 3. Goals of This Document 6 51 4. Presentation Language 6 52 4.1. Basic Block Size 7 53 4.2. Miscellaneous 7 54 4.3. Vectors 7 55 4.4. Numbers 8 56 4.5. Enumerateds 9 57 4.6. Constructed Types 9 58 4.6.1. Variants 10 59 4.7. Cryptographic Attributes 11 60 4.8. Constants 12 61 5. HMAC and the Pseudorandom fFunction 13 62 6. The TLS Record Protocol 14 63 6.1. Connection States 14 64 6.2. Record layer 17 65 6.2.1. Fragmentation 17 66 6.2.2. Record Compression and Decompression 18 67 6.2.3. Record Payload Protection 19 68 6.2.3.1. Null or Standard Stream Cipher 20 69 6.2.3.2. CBC Block Cipher 20 70 6.2.3.3. AEAD ciphers 22 71 6.3. Key Calculation 23 72 7. The TLS Handshaking Protocols 24 73 7.1. Change Cipher Spec Protocol 25 74 7.2. Alert Protocol 26 75 7.2.1. Closure Alerts 27 76 7.2.2. Error Alerts 27 77 7.3. Handshake Protocol Overview 31 78 7.4. Handshake Protocol 35 79 7.4.1. Hello Messages 36 80 7.4.1.1. Hello Request 36 81 7.4.1.2. Client Hello 37 82 7.4.1.3. Server Hello 40 83 7.4.1.4 Hello Extensions 41 84 7.4.1.4.1 Cert Hash Types 43 85 7.4.2. Server Certificate 43 86 7.4.3. Server Key Exchange Message 45 87 7.4.4. Certificate Request 47 88 7.4.5 Server hello done 49 89 7.4.6. Client Certificate 49 90 7.4.7. Client Key Exchange Message 49 91 7.4.7.1. RSA Encrypted Premaster Secret Message 50 92 7.4.7.1. Client Diffie-Hellman Public Value 53 93 7.4.8. Certificate verify 53 94 7.4.9. Finished 54 95 8. Cryptographic Computations 55 96 8.1. Computing the Master Secret 55 97 8.1.1. RSA 56 98 8.1.2. Diffie-Hellman 56 99 9. Mandatory Cipher Suites 56 100 10. Application Data Protocol 56 101 11. Security Considerations 56 102 12. IANA Considerations 57 103 A. Protocol Constant Values 59 104 A.1. Record Layer 59 105 A.2. Change Cipher Specs Message 60 106 A.3. Alert Messages 60 107 A.4. Handshake Protocol 62 108 A.4.1. Hello Messages 62 109 A.4.2. Server Authentication and Key Exchange Messages 63 110 A.4.3. Client Authentication and Key Exchange Messages 65 111 A.4.4. Handshake Finalization Message 65 112 A.5. The CipherSuite 65 113 A.6. The Security Parameters 68 114 B. Glossary 70 115 C. CipherSuite Definitions 74 116 D. Implementation Notes 76 117 D.1 Random Number Generation and Seeding 76 118 D.2 Certificates and Authentication 76 119 D.3 CipherSuites 76 120 E. Backward Compatibility 77 121 E.1 Compatibility with TLS 1.0/1.1 and SSL 3.0 77 122 E.2 Compatibility with SSL 2.0 78 123 E.2. Avoiding Man-in-the-Middle Version Rollback 80 124 F. Security Analysis 81 125 F.1. Handshake Protocol 81 126 F.1.1. Authentication and Key Exchange 81 127 F.1.1.1. Anonymous Key Exchange 81 128 F.1.1.2. RSA Key Exchange and Authentication 82 129 F.1.1.3. Diffie-Hellman Key Exchange with Authentication 82 130 F.1.2. Version Rollback Attacks 83 131 F.1.3. Detecting Attacks Against the Handshake Protocol 84 132 F.1.4. Resuming Sessions 84 133 F.1.5 Extensions 85 134 F.2. Protecting Application Data 85 135 F.3. Explicit IVs 85 136 F.4. Security of Composite Cipher Modes 86 137 F.5 Denial of Service 87 138 F.6. Final Notes 87 140 1. Introduction 142 The primary goal of the TLS Protocol is to provide privacy and data 143 integrity between two communicating applications. The protocol is 144 composed of two layers: the TLS Record Protocol and the TLS Handshake 145 Protocol. At the lowest level, layered on top of some reliable 146 transport protocol (e.g., TCP[TCP]), is the TLS Record Protocol. The 147 TLS Record Protocol provides connection security that has two basic 148 properties: 150 - The connection is private. Symmetric cryptography is used for 151 data encryption (e.g., DES [DES], RC4 [SCH] etc.). The keys for 152 this symmetric encryption are generated uniquely for each 153 connection and are based on a secret negotiated by another 154 protocol (such as the TLS Handshake Protocol). The Record 155 Protocol can also be used without encryption. 157 - The connection is reliable. Message transport includes a message 158 integrity check using a keyed MAC. Secure hash functions (e.g., 159 SHA, MD5, etc.) are used for MAC computations. The Record 160 Protocol can operate without a MAC, but is generally only used in 161 this mode while another protocol is using the Record Protocol as 162 a transport for negotiating security parameters. 164 The TLS Record Protocol is used for encapsulation of various higher- 165 level protocols. One such encapsulated protocol, the TLS Handshake 166 Protocol, allows the server and client to authenticate each other and 167 to negotiate an encryption algorithm and cryptographic keys before 168 the application protocol transmits or receives its first byte of 169 data. The TLS Handshake Protocol provides connection security that 170 has three basic properties: 172 - The peer's identity can be authenticated using asymmetric, or 173 public key, cryptography (e.g., RSA [RSA], DSS [DSS], etc.). This 174 authentication can be made optional, but is generally required 175 for at least one of the peers. 177 - The negotiation of a shared secret is secure: the negotiated 178 secret is unavailable to eavesdroppers, and for any authenticated 179 connection the secret cannot be obtained, even by an attacker who 180 can place himself in the middle of the connection. 182 - The negotiation is reliable: no attacker can modify the 183 negotiation communication without being detected by the parties 184 to the communication. 186 One advantage of TLS is that it is application protocol independent. 187 Higher-level protocols can layer on top of the TLS Protocol 188 transparently. The TLS standard, however, does not specify how 189 protocols add security with TLS; the decisions on how to initiate TLS 190 handshaking and how to interpret the authentication certificates 191 exchanged are left to the judgment of the designers and implementors 192 of protocols that run on top of TLS. 194 1.1 Requirements Terminology 196 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 197 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 198 document are to be interpreted as described in RFC 2119 [RFC2119]. 200 1.2 Major Differences from TLS 1.1 201 This document is a revision of the TLS 1.1 [TLS1.1] protocol which 202 contains improved flexibility, particularly for negotiation of 203 cryptographic algorithms. The major changes are: 205 - Merged in TLS Extensions definition and AES Cipher Suites from 206 external documents. 208 - Replacement of MD5/SHA-1 combination in the PRF. Addition 209 of cipher-suite specified PRFs. 211 - Replacement of MD5/SHA-1 combination in the digitally-signed 212 element. 214 - Allow the client to indicate which hash functions it supports 215 for digital signature. 217 - Allow the server to indicate which hash functions it supports 218 for digital signature. 220 - Addition of support for authenticated encryption with additional 221 data modes. 223 - Tightened up a number of requirements. 225 - The usual clarifications and editorial work. 227 - Added some guidance that DH groups should be checked. 229 - Cleaned up description of Bleichenbacher/Klima attack defenses. 231 - Tighter checking of EncryptedPreMasterSecret version numbers. 233 - Stronger language about when alerts MUST be sent. 235 2. Goals 237 The goals of TLS Protocol, in order of their priority, are as 238 follows: 240 1. Cryptographic security: TLS should be used to establish a secure 241 connection between two parties. 243 2. Interoperability: Independent programmers should be able to 244 develop applications utilizing TLS that can successfully exchange 245 cryptographic parameters without knowledge of one another's code. 247 3. Extensibility: TLS seeks to provide a framework into which new 248 public key and bulk encryption methods can be incorporated as 249 necessary. This will also accomplish two sub-goals: preventing 250 the need to create a new protocol (and risking the introduction 251 of possible new weaknesses) and avoiding the need to implement an 252 entire new security library. 254 4. Relative efficiency: Cryptographic operations tend to be highly 255 CPU intensive, particularly public key operations. For this 256 reason, the TLS protocol has incorporated an optional session 257 caching scheme to reduce the number of connections that need to 258 be established from scratch. Additionally, care has been taken to 259 reduce network activity. 261 3. Goals of This Document 263 This document and the TLS protocol itself are based on the SSL 3.0 264 Protocol Specification as published by Netscape. The differences 265 between this protocol and SSL 3.0 are not dramatic, but they are 266 significant enough that the various versions of TLS and SSL 3.0 do 267 not interoperate (although each protocol incorporates a mechanism by 268 which an implementation can back down to prior versions). This 269 document is intended primarily for readers who will be implementing 270 the protocol and for those doing cryptographic analysis of it. The 271 specification has been written with this in mind, and it is intended 272 to reflect the needs of those two groups. For that reason, many of 273 the algorithm-dependent data structures and rules are included in the 274 body of the text (as opposed to in an appendix), providing easier 275 access to them. 277 This document is not intended to supply any details of service 278 definition or of interface definition, although it does cover select 279 areas of policy as they are required for the maintenance of solid 280 security. 282 4. Presentation Language 284 This document deals with the formatting of data in an external 285 representation. The following very basic and somewhat casually 286 defined presentation syntax will be used. The syntax draws from 287 several sources in its structure. Although it resembles the 288 programming language "C" in its syntax and XDR [XDR] in both its 289 syntax and intent, it would be risky to draw too many parallels. The 290 purpose of this presentation language is to document TLS only; it has 291 no general application beyond that particular goal. 293 4.1. Basic Block Size 295 The representation of all data items is explicitly specified. The 296 basic data block size is one byte (i.e., 8 bits). Multiple byte data 297 items are concatenations of bytes, from left to right, from top to 298 bottom. From the bytestream, a multi-byte item (a numeric in the 299 example) is formed (using C notation) by: 301 value = (byte[0] << 8*(n-1)) | (byte[1] << 8*(n-2)) | 302 ... | byte[n-1]; 304 This byte ordering for multi-byte values is the commonplace network 305 byte order or big endian format. 307 4.2. Miscellaneous 309 Comments begin with "/*" and end with "*/". 311 Optional components are denoted by enclosing them in "[[ ]]" double 312 brackets. 314 Single-byte entities containing uninterpreted data are of type 315 opaque. 317 4.3. Vectors 319 A vector (single dimensioned array) is a stream of homogeneous data 320 elements. The size of the vector may be specified at documentation 321 time or left unspecified until runtime. In either case, the length 322 declares the number of bytes, not the number of elements, in the 323 vector. The syntax for specifying a new type, T', that is a fixed- 324 length vector of type T is 326 T T'[n]; 328 Here, T' occupies n bytes in the data stream, where n is a multiple 329 of the size of T. The length of the vector is not included in the 330 encoded stream. 332 In the following example, Datum is defined to be three consecutive 333 bytes that the protocol does not interpret, while Data is three 334 consecutive Datum, consuming a total of nine bytes. 336 opaque Datum[3]; /* three uninterpreted bytes */ 337 Datum Data[9]; /* 3 consecutive 3 byte vectors */ 339 Variable-length vectors are defined by specifying a subrange of legal 340 lengths, inclusively, using the notation . When 341 these are encoded, the actual length precedes the vector's contents 342 in the byte stream. The length will be in the form of a number 343 consuming as many bytes as required to hold the vector's specified 344 maximum (ceiling) length. A variable-length vector with an actual 345 length field of zero is referred to as an empty vector. 347 T T'; 349 In the following example, mandatory is a vector that must contain 350 between 300 and 400 bytes of type opaque. It can never be empty. The 351 actual length field consumes two bytes, a uint16, sufficient to 352 represent the value 400 (see Section 4.4). On the other hand, longer 353 can represent up to 800 bytes of data, or 400 uint16 elements, and it 354 may be empty. Its encoding will include a two-byte actual length 355 field prepended to the vector. The length of an encoded vector must 356 be an even multiple of the length of a single element (for example, a 357 17-byte vector of uint16 would be illegal). 359 opaque mandatory<300..400>; 360 /* length field is 2 bytes, cannot be empty */ 361 uint16 longer<0..800>; 362 /* zero to 400 16-bit unsigned integers */ 364 4.4. Numbers 366 The basic numeric data type is an unsigned byte (uint8). All larger 367 numeric data types are formed from fixed-length series of bytes 368 concatenated as described in Section 4.1 and are also unsigned. The 369 following numeric types are predefined. 371 uint8 uint16[2]; 372 uint8 uint24[3]; 373 uint8 uint32[4]; 374 uint8 uint64[8]; 376 All values, here and elsewhere in the specification, are stored in 377 "network" or "big-endian" order; the uint32 represented by the hex 378 bytes 01 02 03 04 is equivalent to the decimal value 16909060. 380 Note that in some cases (e.g., DH parameters) it is necessary to 381 represent integers as opaque vectors. In such cases, they are 382 represented as unsigned integers (i.e., leading zero octets are not 383 required even if the most significant bit is set). 385 4.5. Enumerateds 387 An additional sparse data type is available called enum. A field of 388 type enum can only assume the values declared in the definition. 389 Each definition is a different type. Only enumerateds of the same 390 type may be assigned or compared. Every element of an enumerated must 391 be assigned a value, as demonstrated in the following example. Since 392 the elements of the enumerated are not ordered, they can be assigned 393 any unique value, in any order. 395 enum { e1(v1), e2(v2), ... , en(vn) [[, (n)]] } Te; 397 Enumerateds occupy as much space in the byte stream as would its 398 maximal defined ordinal value. The following definition would cause 399 one byte to be used to carry fields of type Color. 401 enum { red(3), blue(5), white(7) } Color; 403 One may optionally specify a value without its associated tag to 404 force the width definition without defining a superfluous element. 405 In the following example, Taste will consume two bytes in the data 406 stream but can only assume the values 1, 2, or 4. 408 enum { sweet(1), sour(2), bitter(4), (32000) } Taste; 410 The names of the elements of an enumeration are scoped within the 411 defined type. In the first example, a fully qualified reference to 412 the second element of the enumeration would be Color.blue. Such 413 qualification is not required if the target of the assignment is well 414 specified. 416 Color color = Color.blue; /* overspecified, legal */ 417 Color color = blue; /* correct, type implicit */ 419 For enumerateds that are never converted to external representation, 420 the numerical information may be omitted. 422 enum { low, medium, high } Amount; 424 4.6. Constructed Types 426 Structure types may be constructed from primitive types for 427 convenience. Each specification declares a new, unique type. The 428 syntax for definition is much like that of C. 430 struct { 431 T1 f1; 432 T2 f2; 433 ... 434 Tn fn; 435 } [[T]]; 437 The fields within a structure may be qualified using the type's name, 438 with a syntax much like that available for enumerateds. For example, 439 T.f2 refers to the second field of the previous declaration. 440 Structure definitions may be embedded. 442 4.6.1. Variants 444 Defined structures may have variants based on some knowledge that is 445 available within the environment. The selector must be an enumerated 446 type that defines the possible variants the structure defines. There 447 must be a case arm for every element of the enumeration declared in 448 the select. The body of the variant structure may be given a label 449 for reference. The mechanism by which the variant is selected at 450 runtime is not prescribed by the presentation language. 452 struct { 453 T1 f1; 454 T2 f2; 455 .... 456 Tn fn; 457 select (E) { 458 case e1: Te1; 459 case e2: Te2; 460 .... 461 case en: Ten; 462 } [[fv]]; 463 } [[Tv]]; 465 For example: 467 enum { apple, orange } VariantTag; 468 struct { 469 uint16 number; 470 opaque string<0..10>; /* variable length */ 471 } V1; 472 struct { 473 uint32 number; 474 opaque string[10]; /* fixed length */ 475 } V2; 476 struct { 477 select (VariantTag) { /* value of selector is implicit */ 478 case apple: V1; /* VariantBody, tag = apple */ 479 case orange: V2; /* VariantBody, tag = orange */ 480 } variant_body; /* optional label on variant */ 481 } VariantRecord; 483 Variant structures may be qualified (narrowed) by specifying a value 484 for the selector prior to the type. For example, an 486 orange VariantRecord 488 is a narrowed type of a VariantRecord containing a variant_body of 489 type V2. 491 4.7. Cryptographic Attributes 493 The five cryptographic operations digital signing, stream cipher 494 encryption, block cipher encryption, authenticated encryption with 495 additional data (AEAD) encryption and public key encryption are 496 designated digitally-signed, stream-ciphered, block-ciphered, aead- 497 ciphered, and public-key-encrypted, respectively. A field's 498 cryptographic processing is specified by prepending an appropriate 499 key word designation before the field's type specification. 500 Cryptographic keys are implied by the current session state (see 501 Section 6.1). 503 In digital signing, one-way hash functions are used as input for a 504 signing algorithm. A digitally-signed element is encoded as an opaque 505 vector <0..2^16-1>, where the length is specified by the signing 506 algorithm and key. 508 In RSA signing, the opaque vector contains the signature generated 509 using the RSASSA-PKCS1-v1_5 signature scheme defined in [PKCS1]. As 510 discussed in [PKCS1], the DigestInfo MUST be DER encoded and for 511 digest algorithms without parameters (which include SHA-1) the 512 DigestInfo.AlgorithmIdentifier.parameters field MUST be NULL but 513 implementations MUST accept both without parameters and with NULL 514 parameters. Note that earlier versions of TLS used a different RSA 515 signature scheme which did not include a DigestInfo encoding. 517 In DSS, the 20 bytes of the SHA-1 hash are run directly through the 518 Digital Signing Algorithm with no additional hashing. This produces 519 two values, r and s. The DSS signature is an opaque vector, as above, 520 the contents of which are the DER encoding of: 522 Dss-Sig-Value ::= SEQUENCE { 523 r INTEGER, 524 s INTEGER 525 } 527 In stream cipher encryption, the plaintext is exclusive-ORed with an 528 identical amount of output generated from a cryptographically secure 529 keyed pseudorandom number generator. 531 In block cipher encryption, every block of plaintext encrypts to a 532 block of ciphertext. All block cipher encryption is done in CBC 533 (Cipher Block Chaining) mode, and all items that are block-ciphered 534 will be an exact multiple of the cipher block length. 536 In AEAD encryption, the plaintext is simultaneously encrypted and 537 integrity protected. The input may be of any length and the output is 538 generally larger than the input in order to accomodate the integrity 539 check value. 541 In public key encryption, a public key algorithm is used to encrypt 542 data in such a way that it can be decrypted only with the matching 543 private key. A public-key-encrypted element is encoded as an opaque 544 vector <0..2^16-1>, where the length is specified by the signing 545 algorithm and key. 547 RSA encryption is done using the RSAES-PKCS1-v1_5 encryption scheme 548 defined in [PKCS1]. 550 In the following example 552 stream-ciphered struct { 553 uint8 field1; 554 uint8 field2; 555 digitally-signed opaque hash[20]; 556 } UserType; 558 the contents of hash are used as input for the signing algorithm, and 559 then the entire structure is encrypted with a stream cipher. The 560 length of this structure, in bytes, would be equal to two bytes for 561 field1 and field2, plus two bytes for the length of the signature, 562 plus the length of the output of the signing algorithm. This is known 563 because the algorithm and key used for the signing are known prior to 564 encoding or decoding this structure. 566 4.8. Constants 568 Typed constants can be defined for purposes of specification by 569 declaring a symbol of the desired type and assigning values to it. 570 Under-specified types (opaque, variable length vectors, and 571 structures that contain opaque) cannot be assigned values. No fields 572 of a multi-element structure or vector may be elided. 574 For example: 576 struct { 577 uint8 f1; 578 uint8 f2; 579 } Example1; 581 Example1 ex1 = {1, 4}; /* assigns f1 = 1, f2 = 4 */ 583 5. HMAC and the Pseudorandom fFunction 585 A number of operations in the TLS record and handshake layer requires 586 a keyed MAC; this is a secure digest of some data protected by a 587 secret. Forging the MAC is infeasible without knowledge of the MAC 588 secret. The construction TLS provides for this operation is known as 589 HMAC and is described in [HMAC]. Cipher suites MAY define their own 590 MACs. 592 In addition, a construction is required to do expansion of secrets 593 into blocks of data for the purposes of key generation or validation. 594 This pseudo-random function (PRF) takes as input a secret, a seed, 595 and an identifying label and produces an output of arbitrary length. 596 We define one PRF, based on HMAC, which is used for all cipher suites 597 in this document. Cipher suites MAY define their own PRFs. 599 First, we define a data expansion function, P_hash(secret, data) that 600 uses a single hash function to expand a secret and seed into an 601 arbitrary quantity of output: 603 P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + 604 HMAC_hash(secret, A(2) + seed) + 605 HMAC_hash(secret, A(3) + seed) + ... 607 Where + indicates concatenation. 609 A() is defined as: 610 A(0) = seed 611 A(i) = HMAC_hash(secret, A(i-1)) 613 P_hash can be iterated as many times as is necessary to produce the 614 required quantity of data. For example, if P_SHA-1 is being used to 615 create 64 bytes of data, it will have to be iterated 4 times (through 616 A(4)), creating 80 bytes of output data; the last 16 bytes of the 617 final iteration will then be discarded, leaving 64 bytes of output 618 data. 620 TLS's PRF is created by applying P_hash to the secret S as: 622 PRF(secret, label, seed) = P_(secret, label + seed) 624 All the cipher suites defined in this document and in TLS documents 625 prior to this document MUST use SHA-256 as the basis for their PRF. 626 New cipher suites MUST specify a PRF and in general SHOULD use the 627 TLS PRF with SHA-256 or a stronger standard hash function. 629 The label is an ASCII string. It should be included in the exact form 630 it is given without a length byte or trailing null character. For 631 example, the label "slithy toves" would be processed by hashing the 632 following bytes: 634 73 6C 69 74 68 79 20 74 6F 76 65 73 636 6. The TLS Record Protocol 638 The TLS Record Protocol is a layered protocol. At each layer, 639 messages may include fields for length, description, and content. 640 The Record Protocol takes messages to be transmitted, fragments the 641 data into manageable blocks, optionally compresses the data, applies 642 a MAC, encrypts, and transmits the result. Received data is 643 decrypted, verified, decompressed, reassembled, and then delivered to 644 higher-level clients. 646 Four record protocol clients are described in this document: the 647 handshake protocol, the alert protocol, the change cipher spec 648 protocol, and the application data protocol. In order to allow 649 extension of the TLS protocol, additional record types can be 650 supported by the record protocol. New record type values are assigned 651 by IANA as described in Section 11. 653 If a TLS implementation receives a record type it does not 654 understand, it SHOULD just ignore it. Any protocol designed for use 655 over TLS MUST be carefully designed to deal with all possible attacks 656 against it. Note that because the type and length of a record are 657 not protected by encryption, care SHOULD be taken to minimize the 658 value of traffic analysis of these values. Implementations MUST not 659 send record types not defined in this document unless negotiated by 660 some extension. 662 6.1. Connection States 664 A TLS connection state is the operating environment of the TLS Record 665 Protocol. It specifies a compression algorithm, an encryption 666 algorithm, and MAC algorithm. In addition, the parameters for these 667 algorithms are known: the MAC secret and the bulk encryption keys for 668 the connection in both the read and the write directions. Logically, 669 there are always four connection states outstanding: the current read 670 and write states, and the pending read and write states. All records 671 are processed under the current read and write states. The security 672 parameters for the pending states can be set by the TLS Handshake 673 Protocol, and the Change Cipher Spec can selectively make either of 674 the pending states current, in which case the appropriate current 675 state is disposed of and replaced with the pending state; the pending 676 state is then reinitialized to an empty state. It is illegal to make 677 a state that has not been initialized with security parameters a 678 current state. The initial current state always specifies that no 679 encryption, compression, or MAC will be used. 681 The security parameters for a TLS Connection read and write state are 682 set by providing the following values: 684 connection end 685 Whether this entity is considered the "client" or the "server" in 686 this connection. 688 bulk encryption algorithm 689 An algorithm to be used for bulk encryption. This specification 690 includes the key size of this algorithm, how much of that key is 691 secret, whether it is a block, stream, or AEAD cipher, and the 692 block size of the cipher (if appropriate). 694 MAC algorithm 695 An algorithm to be used for message authentication. This 696 specification includes the size of the value returned by the MAC 697 algorithm. 699 compression algorithm 700 An algorithm to be used for data compression. This specification 701 must include all information the algorithm requires to do 702 compression. 704 master secret 705 A 48-byte secret shared between the two peers in the connection. 707 client random 708 A 32-byte value provided by the client. 710 server random 711 A 32-byte value provided by the server. 713 These parameters are defined in the presentation language as: 715 enum { server, client } ConnectionEnd; 717 enum { null, rc4, rc2, des, 3des, des40, idea, aes } BulkCipherAlgorithm; 718 enum { stream, block, aead } CipherType; 720 enum { null, md5, sha, sha256, sha384, sha512} MACAlgorithm; 722 /* The use of "sha" above is historical and denotes SHA-1 */ 724 enum { null(0), (255) } CompressionMethod; 726 /* The algorithms specified in CompressionMethod, 727 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 729 struct { 730 ConnectionEnd entity; 731 BulkCipherAlgorithm bulk_cipher_algorithm; 732 CipherType cipher_type; 733 uint8 enc_key_length; 734 uint8 block_length; 735 uint8 iv_length; 736 MACAlgorithm mac_algorithm; 737 uint8 mac_length; 738 uint8 mac_key_length; 739 CompressionMethod compression_algorithm; 740 opaque master_secret[48]; 741 opaque client_random[32]; 742 opaque server_random[32]; 743 } SecurityParameters; 745 The record layer will use the security parameters to generate the 746 following four items: 748 client write MAC secret 749 server write MAC secret 750 client write key 751 server write key 753 The client write parameters are used by the server when receiving and 754 processing records and vice-versa. The algorithm used for generating 755 these items from the security parameters is described in Section 6.3. 757 Once the security parameters have been set and the keys have been 758 generated, the connection states can be instantiated by making them 759 the current states. These current states MUST be updated for each 760 record processed. Each connection state includes the following 761 elements: 763 compression state 764 The current state of the compression algorithm. 766 cipher state 767 The current state of the encryption algorithm. This will consist 768 of the scheduled key for that connection. For stream ciphers, 769 this will also contain whatever state information is necessary to 770 allow the stream to continue to encrypt or decrypt data. 772 MAC secret 773 The MAC secret for this connection, as generated above. 775 sequence number 776 Each connection state contains a sequence number, which is 777 maintained separately for read and write states. The sequence 778 number MUST be set to zero whenever a connection state is made 779 the active state. Sequence numbers are of type uint64 and may not 780 exceed 2^64-1. Sequence numbers do not wrap. If a TLS 781 implementation would need to wrap a sequence number, it must 782 renegotiate instead. A sequence number is incremented after each 783 record: specifically, the first record transmitted under a 784 particular connection state MUST use sequence number 0. 786 6.2. Record layer 788 The TLS Record Layer receives uninterpreted data from higher layers 789 in non-empty blocks of arbitrary size. 791 6.2.1. Fragmentation 793 The record layer fragments information blocks into TLSPlaintext 794 records carrying data in chunks of 2^14 bytes or less. Client message 795 boundaries are not preserved in the record layer (i.e., multiple 796 client messages of the same ContentType MAY be coalesced into a 797 single TLSPlaintext record, or a single message MAY be fragmented 798 across several records). 800 struct { 801 uint8 major, minor; 802 } ProtocolVersion; 804 enum { 805 change_cipher_spec(20), alert(21), handshake(22), 806 application_data(23), (255) 807 } ContentType; 809 struct { 810 ContentType type; 811 ProtocolVersion version; 812 uint16 length; 813 opaque fragment[TLSPlaintext.length]; 814 } TLSPlaintext; 816 type 817 The higher-level protocol used to process the enclosed fragment. 819 version 820 The version of the protocol being employed. This document 821 describes TLS Version 1.2, which uses the version { 3, 3 }. The 822 version value 3.3 is historical, deriving from the use of 3.1 for 823 TLS 1.0. (See Appendix A.1). Note that a client that supports 824 multiple versions of TLS may not know what version will be 825 employed before it receives ServerHello. See Appendix E for 826 discussion about what record layer version number should be 827 employed for ClientHello. 829 length 830 The length (in bytes) of the following TLSPlaintext.fragment. 831 The length MUST not exceed 2^14. 833 fragment 834 The application data. This data is transparent and treated as an 835 independent block to be dealt with by the higher-level protocol 836 specified by the type field. 838 Implementations MUST not send zero-length fragments of Handshake, 839 Alert, or Change Cipher Spec content types. Zero-length fragments 840 of Application data MAY be sent as they are potentially useful as 841 a traffic analysis countermeasure. 843 Note: Data of different TLS Record layer content types MAY be 844 interleaved. Application data is generally of lower precedence 845 for transmission than other content types. However, records MUST 846 be delivered to the network in the same order as they are 847 protected by the record layer. Recipients MUST receive and 848 process interleaved application layer traffic during handshakes 849 subsequent to the first one on a connection. 851 6.2.2. Record Compression and Decompression 853 All records are compressed using the compression algorithm defined in 854 the current session state. There is always an active compression 855 algorithm; however, initially it is defined as 856 CompressionMethod.null. The compression algorithm translates a 857 TLSPlaintext structure into a TLSCompressed structure. Compression 858 functions are initialized with default state information whenever a 859 connection state is made active. 861 Compression must be lossless and may not increase the content length 862 by more than 1024 bytes. If the decompression function encounters a 863 TLSCompressed.fragment that would decompress to a length in excess of 864 2^14 bytes, it MUST report a fatal decompression failure error. 866 struct { 867 ContentType type; /* same as TLSPlaintext.type */ 868 ProtocolVersion version;/* same as TLSPlaintext.version */ 869 uint16 length; 870 opaque fragment[TLSCompressed.length]; 871 } TLSCompressed; 873 length 874 The length (in bytes) of the following TLSCompressed.fragment. 875 The length should not exceed 2^14 + 1024. 877 fragment 878 The compressed form of TLSPlaintext.fragment. 880 Note: A CompressionMethod.null operation is an identity operation; no 881 fields are altered. 883 Implementation note: 884 Decompression functions are responsible for ensuring that 885 messages cannot cause internal buffer overflows. 887 6.2.3. Record Payload Protection 889 The encryption and MAC functions translate a TLSCompressed structure 890 into a TLSCiphertext. The decryption functions reverse the process. 891 The MAC of the record also includes a sequence number so that 892 missing, extra, or repeated messages are detectable. 894 struct { 895 ContentType type; 896 ProtocolVersion version; 897 uint16 length; 898 select (SecurityParameters.cipher_type) { 899 case stream: GenericStreamCipher; 900 case block: GenericBlockCipher; 901 case aead: GenericAEADCipher; 902 } fragment; 903 } TLSCiphertext; 905 type 906 The type field is identical to TLSCompressed.type. 908 version 909 The version field is identical to TLSCompressed.version. 911 length 912 The length (in bytes) of the following TLSCiphertext.fragment. 913 The length may not exceed 2^14 + 2048. 915 fragment 916 The encrypted form of TLSCompressed.fragment, with the MAC. 918 6.2.3.1. Null or Standard Stream Cipher 920 Stream ciphers (including BulkCipherAlgorithm.null, see Appendix A.6) 921 convert TLSCompressed.fragment structures to and from stream 922 TLSCiphertext.fragment structures. 924 stream-ciphered struct { 925 opaque content[TLSCompressed.length]; 926 opaque MAC[SecurityParameters.mac_length]; 927 } GenericStreamCipher; 929 The MAC is generated as: 931 HMAC_hash(MAC_write_secret, seq_num + TLSCompressed.type + 932 TLSCompressed.version + TLSCompressed.length + 933 TLSCompressed.fragment)); 935 where "+" denotes concatenation. 937 seq_num 938 The sequence number for this record. 940 hash 941 The hashing algorithm specified by 942 SecurityParameters.mac_algorithm. 944 Note that the MAC is computed before encryption. The stream cipher 945 encrypts the entire block, including the MAC. For stream ciphers that 946 do not use a synchronization vector (such as RC4), the stream cipher 947 state from the end of one record is simply used on the subsequent 948 packet. If the CipherSuite is TLS_NULL_WITH_NULL_NULL, encryption 949 consists of the identity operation (i.e., the data is not encrypted, 950 and the MAC size is zero, implying that no MAC is used). 951 TLSCiphertext.length is TLSCompressed.length plus 952 SecurityParameters.mac_length. 954 6.2.3.2. CBC Block Cipher 955 For block ciphers (such as RC2, DES, or AES), the encryption and MAC 956 functions convert TLSCompressed.fragment structures to and from block 957 TLSCiphertext.fragment structures. 959 block-ciphered struct { 960 opaque IV[SecurityParameters.block_length]; 961 opaque content[TLSCompressed.length]; 962 opaque MAC[SecurityParameters.mac_length]; 963 uint8 padding[GenericBlockCipher.padding_length]; 964 uint8 padding_length; 965 } GenericBlockCipher; 967 The MAC is generated as described in Section 6.2.3.1. 969 IV 970 TLS 1.2 uses an explicit IV in order to prevent the attacks 971 described by [CBCATT]. The IV SHOULD be chosen at random and MUST 972 be unpredictable. In order to decrypt, thereceiver decrypts the 973 entire GenericBlockCipher structure and then discards the first 974 cipher block, corresponding to the IV component. 976 padding 977 Padding that is added to force the length of the plaintext to be 978 an integral multiple of the block cipher's block length. The 979 padding MAY be any length up to 255 bytes, as long as it results 980 in the TLSCiphertext.length being an integral multiple of the 981 block length. Lengths longer than necessary might be desirable to 982 frustrate attacks on a protocol that are based on analysis of the 983 lengths of exchanged messages. Each uint8 in the padding data 984 vector MUST be filled with the padding length value. The receiver 985 MUST check this padding and SHOULD use the bad_record_mac alert 986 to indicate padding errors. 988 padding_length 989 The padding length MUST be such that the total size of the 990 GenericBlockCipher structure is a multiple of the cipher's block 991 length. Legal values range from zero to 255, inclusive. This 992 length specifies the length of the padding field exclusive of the 993 padding_length field itself. 995 The encrypted data length (TLSCiphertext.length) is one more than the 996 sum of TLSCompressed.length, SecurityParameters.mac_length, and 997 padding_length. 999 Example: If the block length is 8 bytes, the content length 1000 (TLSCompressed.length) is 61 bytes, and the MAC length is 20 1001 bytes, then the length before padding is 82 bytes (this does 1002 not include the IV, which may or may not be encrypted, as 1003 discussed above). Thus, the padding length modulo 8 must be 1004 equal to 6 in order to make the total length an even multiple 1005 of 8 bytes (the block length). The padding length can be 6, 1006 14, 22, and so on, through 254. If the padding length were the 1007 minimum necessary, 6, the padding would be 6 bytes, each 1008 containing the value 6. Thus, the last 8 octets of the 1009 GenericBlockCipher before block encryption would be xx 06 06 1010 06 06 06 06 06, where xx is the last octet of the MAC. 1012 Note: With block ciphers in CBC mode (Cipher Block Chaining), 1013 it is critical that the entire plaintext of the record be known 1014 before any ciphertext is transmitted. Otherwise, it is possible 1015 for the attacker to mount the attack described in [CBCATT]. 1017 Implementation Note: Canvel et al. [CBCTIME] have demonstrated a timing 1018 attack on CBC padding based on the time required to compute the 1019 MAC. In order to defend against this attack, implementations MUST 1020 ensure that record processing time is essentially the same 1021 whether or not the padding is correct. In general, the best way 1022 to do this is to compute the MAC even if the padding is 1023 incorrect, and only then reject the packet. For instance, if the 1024 pad appears to be incorrect, the implementation might assume a 1025 zero-length pad and then compute the MAC. This leaves a small 1026 timing channel, since MAC performance depends to some extent on 1027 the size of the data fragment, but it is not believed to be large 1028 enough to be exploitable, due to the large block size of existing 1029 MACs and the small size of the timing signal. 1031 6.2.3.3. AEAD ciphers 1033 For AEAD [AEAD] ciphers (such as [CCM] or [GCM]) the AEAD function 1034 converts TLSCompressed.fragment structures to and from AEAD 1035 TLSCiphertext.fragment structures. 1037 aead-ciphered struct { 1038 opaque IV[SecurityParameters.iv_length]; 1039 opaque aead_output[AEADEncrypted.length]; 1040 } GenericAEADCipher; 1042 AEAD ciphers take as input a single key, a nonce, a plaintext, and 1043 "additional data" to be included in the authentication check, as 1044 described in Section 2.1 of [AEAD]. These inputs are as follows. 1046 The key is either the client_write_key or the server_write_key. The 1047 MAC key will be of length zero. 1049 The nonce supplied to the AEAD operations is determined by the IV in 1050 aead-ciphered struct. Each IV used in distinct invocations of the 1051 AEAD encryption operation MUST be distinct, for any fixed value of 1052 the key. Implementations SHOULD use the recommended nonce formation 1053 method of [AEAD] to generate IVs, and MAY use any other method that 1054 meets this requirement. The length of the IV depends on the AEAD 1055 cipher; that length MAY be zero. Note that in many cases it is 1056 appropriate to use the partially implicit nonce technique of S 3.2.1 1057 of AEAD, in which case the client_write_iv and server_write_iv should 1058 be used as the "fixed-common". 1060 The plaintext is the TLSCompressed.fragment. 1062 The additional authenticated data, which we denote as 1063 additional_data, is defined as follows: 1065 additional_data = seq_num + TLSCompressed.type + 1066 TLSCompressed.version + TLSCompressed.length; 1068 The aead_output consists of the ciphertext output by the AEAD 1069 encryption operation. AEADEncrypted.length will generally be larger 1070 than TLSCompressed.length, but by an amount that varies with the AEAD 1071 cipher. Since the ciphers might incorporate padding, the amount of 1072 overhead could vary with different TLSCompressed.length values. Each 1073 AEAD cipher MUST NOT produce an expansion of greater than 1024 bytes. 1074 Symbolically, 1076 AEADEncrypted = AEAD-Encrypt(key, IV, plaintext, 1077 additional_data) 1079 Where "+" denotes concatenation. 1081 In order to decrypt and verify, the cipher takes as input the key, 1082 IV, the "additional_data", and the AEADEncrypted value. The output is 1083 either the plaintext or an error indicating that the decryption 1084 failed. There is no separate integrity check. I.e., 1086 TLSCompressed.fragment = AEAD-Decrypt(write_key, IV, AEADEncrypted, 1087 TLSCiphertext.type + TLSCiphertext.version + 1088 TLSCiphertext.length); 1090 If the decryption fails, a fatal bad_record_mac alert MUST be 1091 generated. 1093 6.3. Key Calculation 1095 The Record Protocol requires an algorithm to generate keys, and MAC 1096 secrets from the security parameters provided by the handshake 1097 protocol. 1099 The master secret is hashed into a sequence of secure bytes, which 1100 are assigned to the MAC secrets and keys required by the current 1101 connection state (see Appendix A.6). CipherSpecs require a client 1102 write MAC secret, a server write MAC secret, a client write key, and 1103 a server write key, each of which is generated from the master secret 1104 in that order. Unused values are empty. 1106 When keys and MAC secrets are generated, the master secret is used as 1107 an entropy source. 1109 To generate the key material, compute 1111 key_block = PRF(SecurityParameters.master_secret, 1112 "key expansion", 1113 SecurityParameters.server_random + 1114 SecurityParameters.client_random); 1116 until enough output has been generated. Then the key_block is 1117 partitioned as follows: 1119 client_write_MAC_secret[SecurityParameters.mac_key_length] 1120 server_write_MAC_secret[SecurityParameters.mac_key_length] 1121 client_write_key[SecurityParameters.enc_key_length] 1122 server_write_key[SecurityParameters.enc_key_length] 1124 Implementation note: 1125 The currently defined cipher suite which requires the most 1126 material is AES_256_CBC_SHA, defined in [TLSAES]. It requires 2 x 1127 32 byte keys and 2 x 20 byte MAC secrets, for a total 104 bytes 1128 of key material. 1130 7. The TLS Handshaking Protocols 1132 TLS has three subprotocols that are used to allow peers to agree 1133 upon security parameters for the record layer, to authenticate 1134 themselves, to instantiate negotiated security parameters, and to 1135 report error conditions to each other. 1137 The Handshake Protocol is responsible for negotiating a session, 1138 which consists of the following items: 1140 session identifier 1141 An arbitrary byte sequence chosen by the server to identify an 1142 active or resumable session state. 1144 peer certificate 1145 X509v3 [X509] certificate of the peer. This element of the 1146 state may be null. 1148 compression method 1149 The algorithm used to compress data prior to encryption. 1151 cipher spec 1152 Specifies the bulk data encryption algorithm (such as null, 1153 DES, etc.) and a MAC algorithm (such as MD5 or SHA). It also 1154 defines cryptographic attributes such as the mac_length. (See 1155 Appendix A.6 for formal definition.) 1157 master secret 1158 48-byte secret shared between the client and server. 1160 is resumable 1161 A flag indicating whether the session can be used to initiate 1162 new connections. 1164 These items are then used to create security parameters for use by 1165 the Record Layer when protecting application data. Many connections 1166 can be instantiated using the same session through the resumption 1167 feature of the TLS Handshake Protocol. 1169 7.1. Change Cipher Spec Protocol 1171 The change cipher spec protocol exists to signal transitions in 1172 ciphering strategies. The protocol consists of a single message, 1173 which is encrypted and compressed under the current (not the pending) 1174 connection state. The message consists of a single byte of value 1. 1176 struct { 1177 enum { change_cipher_spec(1), (255) } type; 1178 } ChangeCipherSpec; 1180 The change cipher spec message is sent by both the client and the 1181 server to notify the receiving party that subsequent records will be 1182 protected under the newly negotiated CipherSpec and keys. Reception 1183 of this message causes the receiver to instruct the Record Layer to 1184 immediately copy the read pending state into the read current state. 1185 Immediately after sending this message, the sender MUST instruct the 1186 record layer to make the write pending state the write active state. 1187 (See Section 6.1.) The change cipher spec message is sent during the 1188 handshake after the security parameters have been agreed upon, but 1189 before the verifying finished message is sent (see Section 7.4.11 1191 Note: If a rehandshake occurs while data is flowing on a connection, 1192 the communicating parties may continue to send data using the old 1193 CipherSpec. However, once the ChangeCipherSpec has been sent, the new 1194 CipherSpec MUST be used. The first side to send the ChangeCipherSpec 1195 does not know that the other side has finished computing the new 1196 keying material (e.g., if it has to perform a time consuming public 1197 key operation). Thus, a small window of time, during which the 1198 recipient must buffer the data, MAY exist. In practice, with modern 1199 machines this interval is likely to be fairly short. 1201 7.2. Alert Protocol 1203 One of the content types supported by the TLS Record layer is the 1204 alert type. Alert messages convey the severity of the message and a 1205 description of the alert. Alert messages with a level of fatal result 1206 in the immediate termination of the connection. In this case, other 1207 connections corresponding to the session may continue, but the 1208 session identifier MUST be invalidated, preventing the failed session 1209 from being used to establish new connections. Like other messages, 1210 alert messages are encrypted and compressed, as specified by the 1211 current connection state. 1213 enum { warning(1), fatal(2), (255) } AlertLevel; 1215 enum { 1216 close_notify(0), 1217 unexpected_message(10), 1218 bad_record_mac(20), 1219 decryption_failed_RESERVED(21), 1220 record_overflow(22), 1221 decompression_failure(30), 1222 handshake_failure(40), 1223 no_certificate_RESERVED(41), 1224 bad_certificate(42), 1225 unsupported_certificate(43), 1226 certificate_revoked(44), 1227 certificate_expired(45), 1228 certificate_unknown(46), 1229 illegal_parameter(47), 1230 unknown_ca(48), 1231 access_denied(49), 1232 decode_error(50), 1233 decrypt_error(51), 1234 export_restriction_RESERVED(60), 1235 protocol_version(70), 1236 insufficient_security(71), 1237 internal_error(80), 1238 user_canceled(90), 1239 no_renegotiation(100), 1240 unsupported_extension(110), /* new */ 1241 (255) 1242 } AlertDescription; 1244 struct { 1245 AlertLevel level; 1246 AlertDescription description; 1247 } Alert; 1249 7.2.1. Closure Alerts 1251 The client and the server must share knowledge that the connection is 1252 ending in order to avoid a truncation attack. Either party may 1253 initiate the exchange of closing messages. 1255 close_notify 1256 This message notifies the recipient that the sender will not send 1257 any more messages on this connection. Note that as of TLS 1.1, 1258 failure to properly close a connection no longer requires that a 1259 session not be resumed. This is a change from TLS 1.0 to conform 1260 with widespread implementation practice. 1262 Either party may initiate a close by sending a close_notify alert. 1263 Any data received after a closure alert is ignored. 1265 Unless some other fatal alert has been transmitted, each party is 1266 required to send a close_notify alert before closing the write side 1267 of the connection. The other party MUST respond with a close_notify 1268 alert of its own and close down the connection immediately, 1269 discarding any pending writes. It is not required for the initiator 1270 of the close to wait for the responding close_notify alert before 1271 closing the read side of the connection. 1273 If the application protocol using TLS provides that any data may be 1274 carried over the underlying transport after the TLS connection is 1275 closed, the TLS implementation must receive the responding 1276 close_notify alert before indicating to the application layer that 1277 the TLS connection has ended. If the application protocol will not 1278 transfer any additional data, but will only close the underlying 1279 transport connection, then the implementation MAY choose to close the 1280 transport without waiting for the responding close_notify. No part of 1281 this standard should be taken to dictate the manner in which a usage 1282 profile for TLS manages its data transport, including when 1283 connections are opened or closed. 1285 Note: It is assumed that closing a connection reliably delivers 1286 pending data before destroying the transport. 1288 7.2.2. Error Alerts 1289 Error handling in the TLS Handshake protocol is very simple. When an 1290 error is detected, the detecting party sends a message to the other 1291 party. Upon transmission or receipt of a fatal alert message, both 1292 parties immediately close the connection. Servers and clients MUST 1293 forget any session-identifiers, keys, and secrets associated with a 1294 failed connection. Thus, any connection terminated with a fatal alert 1295 MUST NOT be resumed. 1297 Whenever an implementation encounters a condition which is defined as 1298 a fatal alert, it MUST send the appropriate alert prior to closing 1299 the connection. In cases where an implementation chooses to send an 1300 alert which MAY be a warning alert but intends to close the 1301 connection immediately afterwards, it MUST send that alert at the 1302 fatal alert level. 1304 If an alert with a level of warning is sent and received, generally 1305 the connection can continue normally. If the receiving party decides 1306 not to proceed with the connection (e.g., after having received a 1307 no_renegotiation alert that it is not willing to accept), it SHOULD 1308 send a fatal alert to terminate the connection. 1310 The following error alerts are defined: 1312 unexpected_message 1313 An inappropriate message was received. This alert is always fatal 1314 and should never be observed in communication between proper 1315 implementations. 1317 bad_record_mac 1318 This alert is returned if a record is received with an incorrect 1319 MAC. This alert also MUST be returned if an alert is sent because 1320 a TLSCiphertext decrypted in an invalid way: either it wasn't an 1321 even multiple of the block length, or its padding values, when 1322 checked, weren't correct. This message is always fatal. 1324 decryption_failed_RESERVED 1325 This alert was used in some earlier versions of TLS, and may have 1326 permitted certain attacks against the CBC mode [CBCATT]. It MUST 1327 NOT be sent by compliant implementations. 1329 record_overflow 1330 A TLSCiphertext record was received that had a length more than 1331 2^14+2048 bytes, or a record decrypted to a TLSCompressed record 1332 with more than 2^14+1024 bytes. This message is always fatal. 1334 decompression_failure 1335 The decompression function received improper input (e.g., data 1336 that would expand to excessive length). This message is always 1337 fatal. 1339 handshake_failure 1340 Reception of a handshake_failure alert message indicates that the 1341 sender was unable to negotiate an acceptable set of security 1342 parameters given the options available. This is a fatal error. 1344 no_certificate_RESERVED 1345 This alert was used in SSLv3 but not any version of TLS. It MUST 1346 NOT be sent by compliant implementations. 1348 bad_certificate 1349 A certificate was corrupt, contained signatures that did not 1350 verify correctly, etc. 1352 unsupported_certificate 1353 A certificate was of an unsupported type. 1355 certificate_revoked 1356 A certificate was revoked by its signer. 1358 certificate_expired 1359 A certificate has expired or is not currently valid. 1361 certificate_unknown 1362 Some other (unspecified) issue arose in processing the 1363 certificate, rendering it unacceptable. 1365 illegal_parameter 1366 A field in the handshake was out of range or inconsistent with 1367 other fields. This is always fatal. 1369 unknown_ca 1370 A valid certificate chain or partial chain was received, but the 1371 certificate was not accepted because the CA certificate could not 1372 be located or couldn't be matched with a known, trusted CA. This 1373 message is always fatal. 1375 access_denied 1376 A valid certificate was received, but when access control was 1377 applied, the sender decided not to proceed with negotiation. 1378 This message is always fatal. 1380 decode_error 1381 A message could not be decoded because some field was out of the 1382 specified range or the length of the message was incorrect. This 1383 message is always fatal. 1385 decrypt_error 1386 A handshake cryptographic operation failed, including being 1387 unable to correctly verify a signature, decrypt a key exchange, 1388 or validate a finished message. 1390 export_restriction_RESERVED 1391 This alert was used in some earlier versions of TLS. It MUST NOT 1392 be sent by compliant implementations. 1394 protocol_version 1395 The protocol version the client has attempted to negotiate is 1396 recognized but not supported. (For example, old protocol versions 1397 might be avoided for security reasons). This message is always 1398 fatal. 1400 insufficient_security 1401 Returned instead of handshake_failure when a negotiation has 1402 failed specifically because the server requires ciphers more 1403 secure than those supported by the client. This message is always 1404 fatal. 1406 internal_error 1407 An internal error unrelated to the peer or the correctness of the 1408 protocol (such as a memory allocation failure) makes it 1409 impossible to continue. This message is always fatal. 1411 user_canceled 1412 This handshake is being canceled for some reason unrelated to a 1413 protocol failure. If the user cancels an operation after the 1414 handshake is complete, just closing the connection by sending a 1415 close_notify is more appropriate. This alert should be followed 1416 by a close_notify. This message is generally a warning. 1418 no_renegotiation 1419 Sent by the client in response to a hello request or by the 1420 server in response to a client hello after initial handshaking. 1421 Either of these would normally lead to renegotiation; when that 1422 is not appropriate, the recipient should respond with this alert. 1423 At that point, the original requester can decide whether to 1424 proceed with the connection. One case where this would be 1425 appropriate is where a server has spawned a process to satisfy a 1426 request; the process might receive security parameters (key 1427 length, authentication, etc.) at startup and it might be 1428 difficult to communicate changes to these parameters after that 1429 point. This message is always a warning. 1431 unsupported_extension 1432 sent by clients that receive an extended server hello containing 1433 an extension that they did not put in the corresponding client 1434 hello (see Section 2.3). This message is always fatal. 1436 For all errors where an alert level is not explicitly specified, the 1437 sending party MAY determine at its discretion whether this is a fatal 1438 error or not; if an alert with a level of warning is received, the 1439 receiving party MAY decide at its discretion whether to treat this as 1440 a fatal error or not. However, all messages that are transmitted 1441 with a level of fatal MUST be treated as fatal messages. 1443 New Alert values are assigned by IANA as described in Section 11. 1445 7.3. Handshake Protocol Overview 1447 The cryptographic parameters of the session state are produced by the 1448 TLS Handshake Protocol, which operates on top of the TLS Record 1449 Layer. When a TLS client and server first start communicating, they 1450 agree on a protocol version, select cryptographic algorithms, 1451 optionally authenticate each other, and use public-key encryption 1452 techniques to generate shared secrets. 1454 The TLS Handshake Protocol involves the following steps: 1456 - Exchange hello messages to agree on algorithms, exchange random 1457 values, and check for session resumption. 1459 - Exchange the necessary cryptographic parameters to allow the 1460 client and server to agree on a premaster secret. 1462 - Exchange certificates and cryptographic information to allow the 1463 client and server to authenticate themselves. 1465 - Generate a master secret from the premaster secret and exchanged 1466 random values. 1468 - Provide security parameters to the record layer. 1470 - Allow the client and server to verify that their peer has 1471 calculated the same security parameters and that the handshake 1472 occurred without tampering by an attacker. 1474 Note that higher layers should not be overly reliant on whether TLS 1475 always negotiates the strongest possible connection between two 1476 peers. There are a number of ways in which a man in the middle 1477 attacker can attempt to make two entities drop down to the least 1478 secure method they support. The protocol has been designed to 1479 minimize this risk, but there are still attacks available: for 1480 example, an attacker could block access to the port a secure service 1481 runs on, or attempt to get the peers to negotiate an unauthenticated 1482 connection. The fundamental rule is that higher levels must be 1483 cognizant of what their security requirements are and never transmit 1484 information over a channel less secure than what they require. The 1485 TLS protocol is secure in that any cipher suite offers its promised 1486 level of security: if you negotiate 3DES with a 1024 bit RSA key 1487 exchange with a host whose certificate you have verified, you can 1488 expect to be that secure. 1490 These goals are achieved by the handshake protocol, which can be 1491 summarized as follows: The client sends a client hello message to 1492 which the server must respond with a server hello message, or else a 1493 fatal error will occur and the connection will fail. The client hello 1494 and server hello are used to establish security enhancement 1495 capabilities between client and server. The client hello and server 1496 hello establish the following attributes: Protocol Version, Session 1497 ID, Cipher Suite, and Compression Method. Additionally, two random 1498 values are generated and exchanged: ClientHello.random and 1499 ServerHello.random. 1501 The actual key exchange uses up to four messages: the server 1502 certificate, the server key exchange, the client certificate, and the 1503 client key exchange. New key exchange methods can be created by 1504 specifying a format for these messages and by defining the use of the 1505 messages to allow the client and server to agree upon a shared 1506 secret. This secret MUST be quite long; currently defined key 1507 exchange methods exchange secrets that range from 48 to 128 bytes in 1508 length. 1510 Following the hello messages, the server will send its certificate, 1511 if it is to be authenticated. Additionally, a server key exchange 1512 message may be sent, if it is required (e.g., if their server has no 1513 certificate, or if its certificate is for signing only). If the 1514 server is authenticated, it may request a certificate from the 1515 client, if that is appropriate to the cipher suite selected. Next, 1516 the server will send the server hello done message, indicating that 1517 the hello-message phase of the handshake is complete. The server will 1518 then wait for a client response. If the server has sent a certificate 1519 request message, the client must send the certificate message. The 1520 client key exchange message is now sent, and the content of that 1521 message will depend on the public key algorithm selected between the 1522 client hello and the server hello. If the client has sent a 1523 certificate with signing ability, a digitally-signed certificate 1524 verify message is sent to explicitly verify possession of the private 1525 key in the certificate. 1527 At this point, a change cipher spec message is sent by the client, 1528 and the client copies the pending Cipher Spec into the current Cipher 1529 Spec. The client then immediately sends the finished message under 1530 the new algorithms, keys, and secrets. In response, the server will 1531 send its own change cipher spec message, transfer the pending to the 1532 current Cipher Spec, and send its finished message under the new 1533 Cipher Spec. At this point, the handshake is complete, and the client 1534 and server may begin to exchange application layer data. (See flow 1535 chart below.) Application data MUST NOT be sent prior to the 1536 completion of the first handshake (before a cipher suite other 1537 TLS_NULL_WITH_NULL_NULL is established). 1539 Client Server 1541 ClientHello --------> 1542 ServerHello 1543 Certificate* 1544 CertificateStatus* 1545 ServerKeyExchange* 1546 CertificateRequest* 1547 <-------- ServerHelloDone 1548 Certificate* 1549 ClientKeyExchange 1550 CertificateVerify* 1551 [ChangeCipherSpec] 1552 Finished --------> 1553 [ChangeCipherSpec] 1554 <-------- Finished 1555 Application Data <-------> Application Data 1557 Fig. 1. Message flow for a full handshake 1559 * Indicates optional or situation-dependent messages that are not 1560 always sent. 1562 Note: To help avoid pipeline stalls, ChangeCipherSpec is an 1563 independent TLS Protocol content type, and is not actually a TLS 1564 handshake message. 1566 When the client and server decide to resume a previous session or 1567 duplicate an existing session (instead of negotiating new security 1568 parameters), the message flow is as follows: 1570 The client sends a ClientHello using the Session ID of the session to 1571 be resumed. The server then checks its session cache for a match. If 1572 a match is found, and the server is willing to re-establish the 1573 connection under the specified session state, it will send a 1574 ServerHello with the same Session ID value. At this point, both 1575 client and server MUST send change cipher spec messages and proceed 1576 directly to finished messages. Once the re-establishment is complete, 1577 the client and server MAY begin to exchange application layer data. 1578 (See flow chart below.) If a Session ID match is not found, the 1579 server generates a new session ID and the TLS client and server 1580 perform a full handshake. 1582 Client Server 1584 ClientHello --------> 1585 ServerHello 1586 [ChangeCipherSpec] 1587 <-------- Finished 1588 [ChangeCipherSpec] 1589 Finished --------> 1590 Application Data <-------> Application Data 1592 Fig. 2. Message flow for an abbreviated handshake 1594 The contents and significance of each message will be presented in 1595 detail in the following sections. 1597 7.4. Handshake Protocol 1599 The TLS Handshake Protocol is one of the defined higher-level clients 1600 of the TLS Record Protocol. This protocol is used to negotiate the 1601 secure attributes of a session. Handshake messages are supplied to 1602 the TLS Record Layer, where they are encapsulated within one or more 1603 TLSPlaintext structures, which are processed and transmitted as 1604 specified by the current active session state. 1606 enum { 1607 hello_request(0), client_hello(1), server_hello(2), 1608 certificate(11), server_key_exchange (12), 1609 certificate_request(13), server_hello_done(14), 1610 certificate_verify(15), client_key_exchange(16), 1611 finished(20) 1612 (255) 1613 } HandshakeType; 1615 struct { 1616 HandshakeType msg_type; /* handshake type */ 1617 uint24 length; /* bytes in message */ 1618 select (HandshakeType) { 1619 case hello_request: HelloRequest; 1620 case client_hello: ClientHello; 1621 case server_hello: ServerHello; 1622 case certificate: Certificate; 1623 case server_key_exchange: ServerKeyExchange; 1624 case certificate_request: CertificateRequest; 1625 case server_hello_done: ServerHelloDone; 1626 case certificate_verify: CertificateVerify; 1627 case client_key_exchange: ClientKeyExchange; 1628 case finished: Finished; 1629 } body; 1630 } Handshake; 1632 The handshake protocol messages are presented below in the order they 1633 MUST be sent; sending handshake messages in an unexpected order 1634 results in a fatal error. Unneeded handshake messages can be omitted, 1635 however. Note one exception to the ordering: the Certificate message 1636 is used twice in the handshake (from server to client, then from 1637 client to server), but described only in its first position. The one 1638 message that is not bound by these ordering rules is the Hello 1639 Request message, which can be sent at any time, but which should be 1640 ignored by the client if it arrives in the middle of a handshake. 1642 New Handshake message types are assigned by IANA as described in 1643 Section 11. 1645 7.4.1. Hello Messages 1647 The hello phase messages are used to exchange security enhancement 1648 capabilities between the client and server. When a new session 1649 begins, the Record Layer's connection state encryption, hash, and 1650 compression algorithms are initialized to null. The current 1651 connection state is used for renegotiation messages. 1653 7.4.1.1. Hello Request 1655 When this message will be sent: 1656 The hello request message MAY be sent by the server at any time. 1658 Meaning of this message: 1659 Hello request is a simple notification that the client should 1660 begin the negotiation process anew by sending a client hello 1661 message when convenient. This message is not intended to 1662 establish which side is the client or server but merely to 1663 initiate a new negotiation. Servers SHOULD not send a 1664 HelloRequest immediately upon the client's initial connection. 1665 It is the client's job to send a ClientHello at that time. 1667 This message will be ignored by the client if the client is 1668 currently negotiating a session. This message may be ignored by 1669 the client if it does not wish to renegotiate a session, or the 1670 client may, if it wishes, respond with a no_renegotiation alert. 1671 Since handshake messages are intended to have transmission 1672 precedence over application data, it is expected that the 1673 negotiation will begin before no more than a few records are 1674 received from the client. If the server sends a hello request but 1675 does not receive a client hello in response, it may close the 1676 connection with a fatal alert. 1678 After sending a hello request, servers SHOULD not repeat the request 1679 until the subsequent handshake negotiation is complete. 1681 Structure of this message: 1682 struct { } HelloRequest; 1684 Note: This message MUST NOT be included in the message hashes that are 1685 maintained throughout the handshake and used in the finished 1686 messages and the certificate verify message. 1688 7.4.1.2. Client Hello 1690 When this message will be sent: 1691 When a client first connects to a server it is required to send 1692 the client hello as its first message. The client can also send a 1693 client hello in response to a hello request or on its own 1694 initiative in order to renegotiate the security parameters in an 1695 existing connection. 1697 Structure of this message: 1698 The client hello message includes a random structure, which is 1699 used later in the protocol. 1701 struct { 1702 uint32 gmt_unix_time; 1703 opaque random_bytes[28]; 1704 } Random; 1706 gmt_unix_time 1707 The current time and date in standard UNIX 32-bit format (seconds 1708 since the midnight starting Jan 1, 1970, GMT, ignoring leap 1709 seconds) according to the sender's internal clock. Clocks are not 1710 required to be set correctly by the basic TLS Protocol; higher- 1711 level or application protocols may define additional 1712 requirements. 1714 random_bytes 1715 28 bytes generated by a secure random number generator. 1717 The client hello message includes a variable-length session 1718 identifier. If not empty, the value identifies a session between the 1719 same client and server whose security parameters the client wishes to 1720 reuse. The session identifier MAY be from an earlier connection, this 1721 connection, or from another currently active connection. The second 1722 option is useful if the client only wishes to update the random 1723 structures and derived values of a connection, and the third option 1724 makes it possible to establish several independent secure connections 1725 without repeating the full handshake protocol. These independent 1726 connections may occur sequentially or simultaneously; a SessionID 1727 becomes valid when the handshake negotiating it completes with the 1728 exchange of Finished messages and persists until it is removed due to 1729 aging or because a fatal error was encountered on a connection 1730 associated with the session. The actual contents of the SessionID are 1731 defined by the server. 1733 opaque SessionID<0..32>; 1735 Warning: 1736 Because the SessionID is transmitted without encryption or 1737 immediate MAC protection, servers MUST not place confidential 1738 information in session identifiers or let the contents of fake 1739 session identifiers cause any breach of security. (Note that the 1740 content of the handshake as a whole, including the SessionID, is 1741 protected by the Finished messages exchanged at the end of the 1742 handshake.) 1744 The CipherSuite list, passed from the client to the server in the 1745 client hello message, contains the combinations of cryptographic 1746 algorithms supported by the client in order of the client's 1747 preference (favorite choice first). Each CipherSuite defines a key 1748 exchange algorithm, a bulk encryption algorithm (including secret key 1749 length), a MAC algorithm, and a PRF. The server will select a cipher 1750 suite or, if no acceptable choices are presented, return a handshake 1751 failure alert and close the connection. 1753 uint8 CipherSuite[2]; /* Cryptographic suite selector */ 1755 The client hello includes a list of compression algorithms supported 1756 by the client, ordered according to the client's preference. 1758 enum { null(0), (255) } CompressionMethod; 1760 struct { 1761 ProtocolVersion client_version; 1762 Random random; 1763 SessionID session_id; 1764 CipherSuite cipher_suites<2..2^16-1>; 1765 CompressionMethod compression_methods<1..2^8-1>; 1766 select (extensions_present) { 1767 case false: 1768 struct {}; 1769 case true: 1770 Extension extensions<0..2^16-1>; 1771 } 1772 } ClientHello; 1773 TLS allows extensions to follow the compression_methods field in an 1774 extensions block. The presence of extensions can be detected by 1775 determining whether there are bytes following the compression_methods 1776 at the end of the ClientHello. Note that this method of detecting 1777 optional data differs from the normal TLS method of having a 1778 variable-length field but is used for compatibility with TLS before 1779 extensions were defined. 1781 client_version 1782 The version of the TLS protocol by which the client wishes to 1783 communicate during this session. This SHOULD be the latest 1784 (highest valued) version supported by the client. For this 1785 version of the specification, the version will be 3.3 (See 1786 Appendix E for details about backward compatibility). 1788 random 1789 A client-generated random structure. 1791 session_id 1792 The ID of a session the client wishes to use for this connection. 1793 This field should be empty if no session_id is available, or it 1794 the client wishes to generate new security parameters. 1796 cipher_suites 1797 This is a list of the cryptographic options supported by the 1798 client, with the client's first preference first. If the 1799 session_id field is not empty (implying a session resumption 1800 request) this vector MUST include at least the cipher_suite from 1801 that session. Values are defined in Appendix A.5. 1803 compression_methods 1804 This is a list of the compression methods supported by the 1805 client, sorted by client preference. If the session_id field is 1806 not empty (implying a session resumption request) it MUST include 1807 the compression_method from that session. This vector MUST 1808 contain, and all implementations MUST support, 1809 CompressionMethod.null. Thus, a client and server will always be 1810 able to agree on a compression method. 1812 client_hello_extension_list 1813 Clients MAY request extended functionality from servers by 1814 sending data in the client_hello_extension_list. Here the new 1815 "client_hello_extension_list" field contains a list of 1816 extensions. The actual "Extension" format is defined in Section 1817 7.4.1.4. 1819 In the event that a client requests additional functionality using 1820 extensions, and this functionality is not supplied by the server, the 1821 client MAY abort the handshake. A server that supports the 1822 extensions mechanism MUST accept only client hello messages in either 1823 the original (TLS 1.0/TLS 1.1) ClientHello or the extended 1824 ClientHello format defined in this document, and (as for all other 1825 messages) MUST check that the amount of data in the message precisely 1826 matches one of these formats; if not then it MUST send a fatal 1827 "decode_error" alert. 1829 After sending the client hello message, the client waits for a server 1830 hello message. Any other handshake message returned by the server 1831 except for a hello request is treated as a fatal error. 1833 7.4.1.3. Server Hello 1835 When this message will be sent: 1836 The server will send this message in response to a client hello 1837 message when it was able to find an acceptable set of algorithms. 1838 If it cannot find such a match, it will respond with a handshake 1839 failure alert. 1841 Structure of this message: 1842 struct { 1843 ProtocolVersion server_version; 1844 Random random; 1845 SessionID session_id; 1846 CipherSuite cipher_suite; 1847 CompressionMethod compression_method; 1848 select (extensions_present) { 1849 case false: 1850 struct {}; 1851 case true: 1852 Extension extensions<0..2^16-1>; 1853 } 1854 } ServerHello; 1856 The presence of extensions can be detected by determining whether 1857 there are bytes following the compression_method field at the end of 1858 the ServerHello. 1860 server_version 1861 This field will contain the lower of that suggested by the client 1862 in the client hello and the highest supported by the server. For 1863 this version of the specification, the version is 3.3. (See 1864 Appendix E for details about backward compatibility.) 1866 random 1867 This structure is generated by the server and MUST be 1868 independently generated from the ClientHello.random. 1870 session_id 1871 This is the identity of the session corresponding to this 1872 connection. If the ClientHello.session_id was non-empty, the 1873 server will look in its session cache for a match. If a match is 1874 found and the server is willing to establish the new connection 1875 using the specified session state, the server will respond with 1876 the same value as was supplied by the client. This indicates a 1877 resumed session and dictates that the parties must proceed 1878 directly to the finished messages. Otherwise this field will 1879 contain a different value identifying the new session. The server 1880 may return an empty session_id to indicate that the session will 1881 not be cached and therefore cannot be resumed. If a session is 1882 resumed, it must be resumed using the same cipher suite it was 1883 originally negotiated with. Note that there is no requirement 1884 that the server resume any session even if it had formerly 1885 provided a session_id. Client MUST be prepared to do a full 1886 negotiation -- including negotiating new cipher suites -- during 1887 any handshake. 1889 cipher_suite 1890 The single cipher suite selected by the server from the list in 1891 ClientHello.cipher_suites. For resumed sessions, this field is 1892 the value from the state of the session being resumed. 1894 compression_method 1895 The single compression algorithm selected by the server from the 1896 list in ClientHello.compression_methods. For resumed sessions 1897 this field is the value from the resumed session state. 1899 server_hello_extension_list 1900 A list of extensions. Note that only extensions offered by the 1901 client can appear in the server's list. 1903 7.4.1.4 Hello Extensions 1905 The extension format is: 1907 struct { 1908 ExtensionType extension_type; 1909 opaque extension_data<0..2^16-1>; 1910 } Extension; 1912 enum { 1913 signature_hash_types(TBD-BY-IANA), (65535) 1914 } ExtensionType; 1915 Here: 1917 - "extension_type" identifies the particular extension type. 1919 - "extension_data" contains information specific to the particular 1920 extension type. 1922 The list of extension types, as defined in Section 2.3, is maintained 1923 by the Internet Assigned Numbers Authority (IANA). Thus an 1924 application needs to be made to the IANA in order to obtain a new 1925 extension type value. Since there are subtle (and not so subtle) 1926 interactions that may occur in this protocol between new features and 1927 existing features which may result in a significant reduction in 1928 overall security, new values SHALL be defined only through the IETF 1929 Consensus process specified in [IANA]. (This means that new 1930 assignments can be made only via RFCs approved by the IESG.) The 1931 initial set of extensions is defined in a companion document [TBD]. 1933 The following considerations should be taken into account when 1934 designing new extensions: 1936 - Some cases where a server does not agree to an extension are 1937 error 1938 conditions, and some simply a refusal to support a particular 1939 feature. In general error alerts should be used for the former, 1940 and a field in the server extension response for the latter. 1942 - Extensions should as far as possible be designed to prevent any 1943 attack that forces use (or non-use) of a particular feature by 1944 manipulation of handshake messages. This principle should be 1945 followed regardless of whether the feature is believed to cause a 1946 security problem. 1948 Often the fact that the extension fields are included in the 1949 inputs to the Finished message hashes will be sufficient, but 1950 extreme care is needed when the extension changes the meaning of 1951 messages sent in the handshake phase. Designers and implementors 1952 should be aware of the fact that until the handshake has been 1953 authenticated, active attackers can modify messages and insert, 1954 remove, or replace extensions. 1956 - It would be technically possible to use extensions to change 1957 major aspects of the design of TLS; for example the design of 1958 cipher suite negotiation. This is not recommended; it would be 1959 more appropriate to define a new version of TLS - particularly 1960 since the TLS handshake algorithms have specific protection 1961 against version rollback attacks based on the version number, and 1962 the possibility of version rollback should be a significant 1963 consideration in any major design change. 1965 7.4.1.4.1 Cert Hash Types 1967 The client MAY use the "signature_hash_types" to indicate to the 1968 server which hash functions may be used in digital signatures. 1969 The "extension_data" field of this extension contains: 1971 enum{ 1972 md5(0), sha1(1), sha256(2), sha384(3), sha512(4), (255) 1973 } HashType; 1975 struct { 1976 HashType types<1..255>; 1977 } SignatureHashTypes; 1979 These values indicate support for MD5 [MD5], SHA-1, SHA-256, SHA-384, 1980 and SHA-512 [SHA] respectively. The server MUST NOT send this 1981 extension. The values are indicated in descending order of 1982 preference. 1984 Clients SHOULD send this extension if they support any algorithm 1985 other than SHA-1. If this extension is not used, servers SHOULD 1986 assume that the client supports only SHA-1. Note: this is a change 1987 from TLS 1.1 where there are no explicit rules but as a practical 1988 matter one can assume that the peer supports MD5 and SHA-1. 1990 7.4.2. Server Certificate 1992 When this message will be sent: 1993 The server MUST send a certificate whenever the agreed-upon key 1994 exchange method uses certificates for authentication (this 1995 includes all key exchange methods defined in this document except 1996 DH_anon). This message will always immediately follow the server 1997 hello message. 1999 Meaning of this message: 2000 The certificate type MUST be appropriate for the selected cipher 2001 suite's key exchange algorithm, and is generally an X.509v3 2002 certificate. It MUST contain a key that matches the key exchange 2003 method, as follows. Unless otherwise specified, the signing 2004 algorithm for the certificate MUST be the same as the algorithm 2005 for the certificate key. Unless otherwise specified, the public 2006 key MAY be of any length. 2008 Key Exchange Algorithm Certificate Key Type 2010 RSA RSA public key; the certificate MUST 2011 allow the key to be used for encryption. 2013 DHE_DSS DSS public key. 2015 DHE_RSA RSA public key that can be used for 2016 signing. 2018 DH_DSS Diffie-Hellman key. The algorithm used 2019 to sign the certificate MUST be DSS. 2021 DH_RSA Diffie-Hellman key. The algorithm used 2022 to sign the certificate MUST be RSA. 2024 All certificate profiles and key and cryptographic formats are 2025 defined by the IETF PKIX working group [PKIX]. When a key usage 2026 extension is present, the digitalSignature bit MUST be set for the 2027 key to be eligible for signing, as described above, and the 2028 keyEncipherment bit MUST be present to allow encryption, as described 2029 above. The keyAgreement bit must be set on Diffie-Hellman 2030 certificates. 2032 As CipherSuites that specify new key exchange methods are specified 2033 for the TLS Protocol, they will imply certificate format and the 2034 required encoded keying information. 2036 Structure of this message: 2037 opaque ASN.1Cert<1..2^24-1>; 2039 struct { 2040 ASN.1Cert certificate_list<0..2^24-1>; 2041 } Certificate; 2043 certificate_list 2044 This is a sequence (chain) of X.509v3 certificates. The sender's 2045 certificate must come first in the list. Each following 2046 certificate must directly certify the one preceding it. Because 2047 certificate validation requires that root keys be distributed 2048 independently, the self-signed certificate that specifies the 2049 root certificate authority may optionally be omitted from the 2050 chain, under the assumption that the remote end must already 2051 possess it in order to validate it in any case. 2053 The same message type and structure will be used for the client's 2054 response to a certificate request message. Note that a client MAY 2055 send no certificates if it does not have an appropriate certificate 2056 to send in response to the server's authentication request. 2058 Note: PKCS #7 [PKCS7] is not used as the format for the certificate 2059 vector because PKCS #6 [PKCS6] extended certificates are not 2060 used. Also, PKCS #7 defines a SET rather than a SEQUENCE, making 2061 the task of parsing the list more difficult. 2063 7.4.3. Server Key Exchange Message 2065 When this message will be sent: 2066 This message will be sent immediately after the server 2067 certificate message (or the server hello message, if this is an 2068 anonymous negotiation). 2070 The server key exchange message is sent by the server only when 2071 the server certificate message (if sent) does not contain enough 2072 data to allow the client to exchange a premaster secret. This is 2073 true for the following key exchange methods: 2075 DHE_DSS 2076 DHE_RSA 2077 DH_anon 2079 It is not legal to send the server key exchange message for the 2080 following key exchange methods: 2082 RSA 2083 DH_DSS 2084 DH_RSA 2086 Meaning of this message: 2087 This message conveys cryptographic information to allow the 2088 client to communicate the premaster secret: a Diffie-Hellman 2089 public key with which the client can complete a key exchange 2090 (with the result being the premaster secret) or a public key for 2091 some other algorithm. 2093 As additional CipherSuites are defined for TLS that include new key 2094 exchange algorithms, the server key exchange message will be sent if 2095 and only if the certificate type associated with the key exchange 2096 algorithm does not provide enough information for the client to 2097 exchange a premaster secret. 2099 If the client has offered the SignatureHashTypes extension, the hash 2100 function MUST be one of those listed in that extension. Otherwise it 2101 MUST be assumed that only SHA-1 is supported. 2103 If the SignatureAlgorithm being used to sign the ServerKeyExchange 2104 message is DSA, the hash algorithm MUST be SHA-1. [TODO: This is 2105 incorrect. What it should say is that it must be specified in the 2106 SPKI of the cert. However, I don't believe this is actually defined. 2108 Rather, the DSA certs just say dsa. We need new certs to say 2109 dsaWithSHAXXX.] 2111 If the SignatureAlgorithm is RSA, then any hash function accepted by 2112 the client MAY be used. The selected hash function MUST be indicated 2113 in the digest_algorithm field of the signature structure. 2115 The hash algorithm is denoted Hash below. Hash.length is the length 2116 of the output of that algorithm. 2118 Structure of this message: 2119 enum { diffie_hellman } KeyExchangeAlgorithm; 2121 struct { 2122 opaque dh_p<1..2^16-1>; 2123 opaque dh_g<1..2^16-1>; 2124 opaque dh_Ys<1..2^16-1>; 2125 } ServerDHParams; /* Ephemeral DH parameters */ 2127 dh_p 2128 The prime modulus used for the Diffie-Hellman operation. 2130 dh_g 2131 The generator used for the Diffie-Hellman operation. 2133 dh_Ys 2134 The server's Diffie-Hellman public value (g^X mod p). 2136 struct { 2137 select (KeyExchangeAlgorithm) { 2138 case diffie_hellman: 2139 ServerDHParams params; 2140 Signature signed_params; 2141 }; 2142 } ServerKeyExchange; 2144 struct { 2145 select (KeyExchangeAlgorithm) { 2146 case diffie_hellman: 2147 ServerDHParams params; 2148 }; 2149 } ServerParams; 2151 params 2152 The server's key exchange parameters. 2154 signed_params 2155 For non-anonymous key exchanges, a hash of the corresponding 2156 params value, with the signature appropriate to that hash 2157 applied. 2159 hash 2160 Hash(ClientHello.random + ServerHello.random + ServerParams) 2162 sha_hash 2163 SHA1(ClientHello.random + ServerHello.random + ServerParams) 2165 enum { anonymous, rsa, dsa } SignatureAlgorithm; 2167 struct { 2168 select (SignatureAlgorithm) { 2169 case anonymous: struct { }; 2170 case rsa: 2171 HashType digest_algorithm; // NEW 2172 digitally-signed struct { 2173 opaque hash[Hash.length]; 2174 }; 2175 case dsa: 2176 digitally-signed struct { 2177 opaque sha_hash[20]; 2178 }; 2179 }; 2180 }; 2181 } Signature; 2183 7.4.4. Certificate Request 2185 When this message will be sent: 2186 A non-anonymous server can optionally request a certificate from 2187 the client, if appropriate for the selected cipher suite. This 2188 message, if sent, will immediately follow the Server Key Exchange 2189 message (if it is sent; otherwise, the Server Certificate 2190 message). 2192 Structure of this message: 2193 enum { 2194 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 2195 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 2196 fortezza_dms_RESERVED(20), 2197 (255) 2198 } ClientCertificateType; 2200 opaque DistinguishedName<1..2^16-1>; 2201 struct { 2202 ClientCertificateType certificate_types<1..2^8-1>; 2203 HashType certificate_hash<1..2^8-1>; 2204 DistinguishedName certificate_authorities<0..2^16-1>; 2205 } CertificateRequest; 2207 certificate_types 2208 This field is a list of the types of certificates requested, 2209 sorted in order of the server's preference. 2211 certificate_types 2212 A list of the types of certificate types which the client may 2213 offer. 2214 rsa_sign a certificate containing an RSA key 2215 dss_sign a certificate containing a DSS key 2216 rsa_fixed_dh a certificate signed with RSA and containing 2217 a static DH key. 2218 dss_fixed_dh a certificate signed with DSS and containing 2219 a static DH key 2221 Certificate types rsa_sign and dss_sign SHOULD contain 2222 certificates signed with the same algorithm. However, this is 2223 not required. This is a holdover from TLS 1.0 and 1.1. 2225 certificate_hash 2226 A list of acceptable hash algorithms to be used in signatures 2227 in both the client certificate and the CertificateVerify. 2228 These algorithms are listed in descending order of 2229 preference. 2231 certificate_authorities 2232 A list of the distinguished names of acceptable certificate 2233 authorities. These distinguished names may specify a desired 2234 distinguished name for a root CA or for a subordinate CA; 2235 thus, this message can be used both to describe known roots 2236 and a desired authorization space. If the 2237 certificate_authorities list is empty then the client MAY 2238 send any certificate of the appropriate 2239 ClientCertificateType, unless there is some external 2240 arrangement to the contrary. 2242 New ClientCertificateType values are assigned by IANA as described in 2243 Section 11. 2245 Note: Values listed as RESERVED may not be used. They were 2246 used in SSLv3. 2248 Note: DistinguishedName is derived from [X501]. DistinguishedNames are 2249 represented in DER-encoded format. 2251 Note: It is a fatal handshake_failure alert for an anonymous server to 2252 request client authentication. 2254 7.4.5 Server hello done 2256 When this message will be sent: 2257 The server hello done message is sent by the server to indicate 2258 the end of the server hello and associated messages. After 2259 sending this message, the server will wait for a client response. 2261 Meaning of this message: 2262 This message means that the server is done sending messages to 2263 support the key exchange, and the client can proceed with its 2264 phase of the key exchange. 2266 Upon receipt of the server hello done message, the client SHOULD 2267 verify that the server provided a valid certificate, if required 2268 and check that the server hello parameters are acceptable. 2270 Structure of this message: 2271 struct { } ServerHelloDone; 2273 7.4.6. Client Certificate 2275 When this message will be sent: 2276 This is the first message the client can send after receiving a 2277 server hello done message. This message is only sent if the 2278 server requests a certificate. If no suitable certificate is 2279 available, the client SHOULD send a certificate message 2280 containing no certificates. That is, the certificate_list 2281 structure has a length of zero. If client authentication is 2282 required by the server for the handshake to continue, it may 2283 respond with a fatal handshake failure alert. Client certificates 2284 are sent using the Certificate structure defined in Section 2285 7.4.2. 2287 Note: When using a static Diffie-Hellman based key exchange method 2288 (DH_DSS or DH_RSA), if client authentication is requested, the 2289 Diffie-Hellman group and generator encoded in the client's 2290 certificate MUST match the server specified Diffie-Hellman 2291 parameters if the client's parameters are to be used for the key 2292 exchange. 2294 7.4.7. Client Key Exchange Message 2295 When this message will be sent: 2296 This message is always sent by the client. It MUST immediately 2297 follow the client certificate message, if it is sent. Otherwise 2298 it MUST be the first message sent by the client after it receives 2299 the server hello done message. 2301 Meaning of this message: 2302 With this message, the premaster secret is set, either though 2303 direct transmission of the RSA-encrypted secret, or by the 2304 transmission of Diffie-Hellman parameters that will allow each 2305 side to agree upon the same premaster secret. When the key 2306 exchange method is DH_RSA or DH_DSS, client certification has 2307 been requested, and the client was able to respond with a 2308 certificate that contained a Diffie-Hellman public key whose 2309 parameters (group and generator) matched those specified by the 2310 server in its certificate, this message MUST not contain any 2311 data. 2313 Structure of this message: 2314 The choice of messages depends on which key exchange method has 2315 been selected. See Section 7.4.3 for the KeyExchangeAlgorithm 2316 definition. 2318 struct { 2319 select (KeyExchangeAlgorithm) { 2320 case rsa: EncryptedPreMasterSecret; 2321 case diffie_hellman: ClientDiffieHellmanPublic; 2322 } exchange_keys; 2323 } ClientKeyExchange; 2325 7.4.7.1. RSA Encrypted Premaster Secret Message 2327 Meaning of this message: 2328 If RSA is being used for key agreement and authentication, the 2329 client generates a 48-byte premaster secret, encrypts it using 2330 the public key from the server's certificate and sends the result 2331 in an encrypted premaster secret message. This structure is a 2332 variant of the client key exchange message and is not a message 2333 in itself. 2335 Structure of this message: 2336 struct { 2337 ProtocolVersion client_version; 2338 opaque random[46]; 2339 } PreMasterSecret; 2341 client_version 2342 The latest (newest) version supported by the client. This is 2343 used to detect version roll-back attacks. Upon receiving the 2344 premaster secret, the server SHOULD check that this value 2345 matches the value transmitted by the client in the client 2346 hello message. 2348 random 2349 46 securely-generated random bytes. 2351 struct { 2352 public-key-encrypted PreMasterSecret pre_master_secret; 2353 } EncryptedPreMasterSecret; 2355 pre_master_secret 2356 This random value is generated by the client and is used to 2357 generate the master secret, as specified in Section 8.1. 2359 Note: The version number in the PreMasterSecret is the version offered 2360 by the client in the ClientHello.client_version, not the 2361 version negotiated for the connection. This feature is 2362 designed to prevent rollback attacks. Unfortunately, some 2363 old implementations use the negotiated version instead and 2364 therefore checking the version number may lead to failure to 2365 interoperate with such incorrect client implementations. 2367 Client implementations MUST always send the correct version 2368 number in PreMasterSecret. If ClientHello.client_version is 2369 TLS 1.1 or higher, server implementations MUST check the 2370 version number as described in the note below. If the version 2371 number is earlier than 1.0, server implementations SHOULD 2372 check the version number, but MAY have a configuration option 2373 to disable the check. Note that if the check fails, the 2374 PreMasterSecret SHOULD be randomized as described below. 2376 Note: Attacks discovered by Bleichenbacher [BLEI] and Klima et al. 2377 [KPR03] can be used to attack a TLS server that reveals whether a 2378 particular message, when decrypted, is properly PKCS#1 formatted, 2379 contains a valid PreMasterSecret structure, or has the correct 2380 version number. 2382 The best way to avoid these vulnerabilities is to treat incorrectly 2383 formatted messages in a manner indistinguishable from correctly 2384 formatted RSA blocks. In other words: 2386 1. Generate a string R of 46 random bytes 2388 2. Decrypt the message M 2390 3. If the PKCS#1 padding is not correct, or the length of 2391 message M is not exactly 48 bytes: 2392 premaster secret = ClientHello.client_version || R 2393 else If ClientHello.client_version <= TLS 1.0, and 2394 version number check is explicitly disabled: 2395 premaster secret = M 2396 else: 2397 premaster secret = ClientHello.client_version || M[2..47] 2399 In any case, a TLS server MUST NOT generate an alert if processing an 2400 RSA-encrypted premaster secret message fails, or the version number 2401 is not as expected. Instead, it MUST continue the handshake with a 2402 randomly generated premaster secret. It may be useful to log the 2403 real cause of failure for troubleshooting purposes; however, care 2404 must be taken to avoid leaking the information to an attacker 2405 (though, e.g., timing, log files, or other channels. 2407 The RSAES-OAEP encryption scheme defined in [PKCS1] is more secure 2408 against the Bleichenbacher attack. However, for maximal compatibility 2409 with earlier versions of TLS, this specification uses the RSAES- 2410 PKCS1-v1_5 scheme. No variants of the Bleichenbacher attack are known 2411 to exist provided that the above recommendations are followed. 2413 Implementation Note: Public-key-encrypted data is represented as an 2414 opaque vector <0..2^16-1> (see Section 4.7). Thus, the RSA-encrypted 2415 PreMasterSecret in a ClientKeyExchange is preceded by two length 2416 bytes. These bytes are redundant in the case of RSA because the 2417 EncryptedPreMasterSecret is the only data in the ClientKeyExchange 2418 and its length can therefore be unambiguously determined. The SSLv3 2419 specification was not clear about the encoding of public-key- 2420 encrypted data, and therefore many SSLv3 implementations do not 2421 include the the length bytes, encoding the RSA encrypted data 2422 directly in the ClientKeyExchange message. 2424 This specification requires correct encoding of the 2425 EncryptedPreMasterSecret complete with length bytes. The resulting 2426 PDU is incompatible with many SSLv3 implementations. Implementors 2427 upgrading from SSLv3 MUST modify their implementations to generate 2428 and accept the correct encoding. Implementors who wish to be 2429 compatible with both SSLv3 and TLS should make their implementation's 2430 behavior dependent on the protocol version. 2432 Implementation Note: It is now known that remote timing-based attacks 2433 on SSL are possible, at least when the client and server are on the 2434 same LAN. Accordingly, implementations that use static RSA keys MUST 2435 use RSA blinding or some other anti-timing technique, as described in 2436 [TIMING]. 2438 7.4.7.1. Client Diffie-Hellman Public Value 2440 Meaning of this message: 2441 This structure conveys the client's Diffie-Hellman public value 2442 (Yc) if it was not already included in the client's certificate. 2443 The encoding used for Yc is determined by the enumerated 2444 PublicValueEncoding. This structure is a variant of the client 2445 key exchange message, and not a message in itself. 2447 Structure of this message: 2448 enum { implicit, explicit } PublicValueEncoding; 2450 implicit 2451 If the client certificate already contains a suitable Diffie- 2452 Hellman key, then Yc is implicit and does not need to be sent 2453 again. In this case, the client key exchange message will be 2454 sent, but it MUST be empty. 2456 explicit 2457 Yc needs to be sent. 2459 struct { 2460 select (PublicValueEncoding) { 2461 case implicit: struct { }; 2462 case explicit: opaque dh_Yc<1..2^16-1>; 2463 } dh_public; 2464 } ClientDiffieHellmanPublic; 2466 dh_Yc 2467 The client's Diffie-Hellman public value (Yc). 2469 7.4.8. Certificate verify 2471 When this message will be sent: 2472 This message is used to provide explicit verification of a client 2473 certificate. This message is only sent following a client 2474 certificate that has signing capability (i.e. all certificates 2475 except those containing fixed Diffie-Hellman parameters). When 2476 sent, it MUST immediately follow the client key exchange message. 2478 Structure of this message: 2479 struct { 2480 Signature signature; 2481 } CertificateVerify; 2483 The Signature type is defined in 7.4.3. 2485 The hash function MUST be one of the algorithms offered in the 2486 CertificateRequest message. 2488 If the SignatureAlgorithm being used to sign the ServerKeyExchange 2489 message is DSA, the hash function used MUST be SHA-1. 2490 [TODO: This is incorrect. What it should say is that it must 2491 be specified in the SPKI of the cert. However, I don't believe 2492 this is actually defined. Rather, the DSA certs just say 2493 dsa. We need new certs to say dsaWithSHAXXX] 2495 If the SignatureAlgorithm is RSA, then any of the functions offered 2496 by the server may be used. The selected hash function MUST be 2497 indicated in the digest_algorithm field of the signature structure. 2499 The hash algorithm is denoted Hash below. 2501 CertificateVerify.signature.hash 2502 Hash(handshake_messages); 2504 CertificateVerify.signature.sha_hash 2505 SHA(handshake_messages); 2507 Here handshake_messages refers to all handshake messages sent or 2508 received starting at client hello up to but not including this 2509 message, including the type and length fields of the handshake 2510 messages. This is the concatenation of all the Handshake structures 2511 as defined in 7.4 exchanged thus far. 2513 7.4.9. Finished 2515 When this message will be sent: 2516 A finished message is always sent immediately after a change 2517 cipher spec message to verify that the key exchange and 2518 authentication processes were successful. It is essential that a 2519 change cipher spec message be received between the other 2520 handshake messages and the Finished message. 2522 Meaning of this message: 2523 The finished message is the first protected with the just- 2524 negotiated algorithms, keys, and secrets. Recipients of finished 2525 messages MUST verify that the contents are correct. Once a side 2526 has sent its Finished message and received and validated the 2527 Finished message from its peer, it may begin to send and receive 2528 application data over the connection. 2530 struct { 2531 opaque verify_data[12]; 2532 } Finished; 2533 verify_data 2534 PRF(master_secret, finished_label, Hash(handshake_messages))[0..11]; 2536 finished_label 2537 For Finished messages sent by the client, the string "client 2538 finished". For Finished messages sent by the server, the 2539 string "server finished". 2541 Hash denotes the negotiated hash used for the PRF. If a new 2542 PRF is defined, then this hash MUST be specified. 2544 handshake_messages 2545 All of the data from all messages in this handshake (not 2546 including any HelloRequest messages) up to but not including 2547 this message. This is only data visible at the handshake 2548 layer and does not include record layer headers. This is the 2549 concatenation of all the Handshake structures as defined in 2550 7.4, exchanged thus far. 2552 It is a fatal error if a finished message is not preceded by a change 2553 cipher spec message at the appropriate point in the handshake. 2555 The value handshake_messages includes all handshake messages starting 2556 at client hello up to, but not including, this finished message. This 2557 may be different from handshake_messages in Section 7.4.9 because it 2558 would include the certificate verify message (if sent). Also, the 2559 handshake_messages for the finished message sent by the client will 2560 be different from that for the finished message sent by the server, 2561 because the one that is sent second will include the prior one. 2563 Note: Change cipher spec messages, alerts and, any other record types 2564 are not handshake messages and are not included in the hash 2565 computations. Also, Hello Request messages are omitted from 2566 handshake hashes. 2568 8. Cryptographic Computations 2570 In order to begin connection protection, the TLS Record Protocol 2571 requires specification of a suite of algorithms, a master secret, and 2572 the client and server random values. The authentication, encryption, 2573 and MAC algorithms are determined by the cipher_suite selected by the 2574 server and revealed in the server hello message. The compression 2575 algorithm is negotiated in the hello messages, and the random values 2576 are exchanged in the hello messages. All that remains is to calculate 2577 the master secret. 2579 8.1. Computing the Master Secret 2580 For all key exchange methods, the same algorithm is used to convert 2581 the pre_master_secret into the master_secret. The pre_master_secret 2582 should be deleted from memory once the master_secret has been 2583 computed. 2585 master_secret = PRF(pre_master_secret, "master secret", 2586 ClientHello.random + ServerHello.random) 2587 [0..47]; 2589 The master secret is always exactly 48 bytes in length. The length of 2590 the premaster secret will vary depending on key exchange method. 2592 8.1.1. RSA 2594 When RSA is used for server authentication and key exchange, a 2595 48-byte pre_master_secret is generated by the client, encrypted under 2596 the server's public key, and sent to the server. The server uses its 2597 private key to decrypt the pre_master_secret. Both parties then 2598 convert the pre_master_secret into the master_secret, as specified 2599 above. 2601 8.1.2. Diffie-Hellman 2603 A conventional Diffie-Hellman computation is performed. The 2604 negotiated key (Z) is used as the pre_master_secret, and is converted 2605 into the master_secret, as specified above. Leading bytes of Z that 2606 contain all zero bits are stripped before it is used as the 2607 pre_master_secret. 2609 Note: Diffie-Hellman parameters are specified by the server and may 2610 be either ephemeral or contained within the server's certificate. 2612 9. Mandatory Cipher Suites 2614 In the absence of an application profile standard specifying 2615 otherwise, a TLS compliant application MUST implement the cipher 2616 suite TLS_RSA_WITH_3DES_EDE_CBC_SHA. 2618 10. Application Data Protocol 2620 Application data messages are carried by the Record Layer and are 2621 fragmented, compressed, and encrypted based on the current connection 2622 state. The messages are treated as transparent data to the record 2623 layer. 2625 11. Security Considerations 2627 Security issues are discussed throughoutthis memo, especially in 2628 Appendices D, E, and F. 2630 12. IANA Considerations 2632 This document uses several registries that were originally created in 2633 [RFC4346]. IANA is requested to update (has updated) these to 2634 reference this document. The registries and their allocation policies 2635 (unchanged from [RFC4346]) are listed below. 2637 o TLS ClientCertificateType Identifiers Registry: Future 2638 values in the range 0-63 (decimal) inclusive are assigned via 2639 Standards Action [RFC2434]. Values in the range 64-223 2640 (decimal) inclusive are assigned Specification Required 2641 [RFC2434]. Values from 224-255 (decimal) inclusive are 2642 reserved for Private Use [RFC2434]. 2644 o TLS Cipher Suite Registry: Future values with the first byte 2645 in the range 0-191 (decimal) inclusive are assigned via 2646 Standards Action [RFC2434]. Values with the first byte in 2647 the range 192-254 (decimal) are assigned via Specification 2648 Required [RFC2434]. Values with the first byte 255 (decimal) 2649 are reserved for Private Use [RFC2434]. 2651 o TLS ContentType Registry: Future values are allocated via 2652 Standards Action [RFC2434]. 2654 o TLS Alert Registry: Future values are allocated via 2655 Standards Action [RFC2434]. 2657 o TLS HandshakeType Registry: Future values are allocated via 2658 Standards Action [RFC2434]. 2660 This document also uses a registry originally created in [RFC4366]. 2661 IANA is requested to update (has updated) it to reference this 2662 document. The registry and its allocation policy (unchanged from 2663 [RFC4366]) is listed below:. 2665 o TLS ExtensionType Registry: Future values are allocated 2666 via IETF Consensus [RFC2434] 2668 In addition, this document defines one new registry to be maintained 2669 by IANA: 2671 o TLS HashType Registry: The registry will be initially 2672 populated with the values described in Section 7.4.1.4.7. 2673 Future values in the range 0-63 (decimal) inclusive are 2674 assigned via Standards Action [RFC2434]. Values in the 2675 range 64-223 (decimal) inclusive are assigned via 2676 Specification Required [RFC2434]. Values from 224-255 2677 (decimal) inclusive are reserved for Private Use [RFC2434]. 2679 This document defines one new TLS extension, cert_hash_type, which is 2680 to be (has been) allocated value TBD-BY-IANA in the TLS ExtensionType 2681 registry. 2683 Appendix A. Protocol Constant Values 2685 This section describes protocol types and constants. 2687 A.1. Record Layer 2689 struct { 2690 uint8 major, minor; 2691 } ProtocolVersion; 2693 ProtocolVersion version = { 3, 3 }; /* TLS v1.2*/ 2695 enum { 2696 change_cipher_spec(20), alert(21), handshake(22), 2697 application_data(23), (255) 2698 } ContentType; 2700 struct { 2701 ContentType type; 2702 ProtocolVersion version; 2703 uint16 length; 2704 opaque fragment[TLSPlaintext.length]; 2705 } TLSPlaintext; 2707 struct { 2708 ContentType type; 2709 ProtocolVersion version; 2710 uint16 length; 2711 opaque fragment[TLSCompressed.length]; 2712 } TLSCompressed; 2714 struct { 2715 ContentType type; 2716 ProtocolVersion version; 2717 uint16 length; 2718 select (SecurityParameters.cipher_type) { 2719 case stream: GenericStreamCipher; 2720 case block: GenericBlockCipher; 2721 case aead: GenericAEADCipher; 2722 } fragment; 2723 } TLSCiphertext; 2725 stream-ciphered struct { 2726 opaque content[TLSCompressed.length]; 2727 opaque MAC[SecurityParameters.mac_length]; 2728 } GenericStreamCipher; 2730 block-ciphered struct { 2731 opaque IV[SecurityParameters.block_length]; 2732 opaque content[TLSCompressed.length]; 2733 opaque MAC[SecurityParameters.mac_length]; 2734 uint8 padding[GenericBlockCipher.padding_length]; 2735 uint8 padding_length; 2736 } GenericBlockCipher; 2738 aead-ciphered struct { 2739 opaque IV[SecurityParameters.iv_length]; 2740 opaque aead_output[AEADEncrypted.length]; 2741 } GenericAEADCipher; 2743 A.2. Change Cipher Specs Message 2745 struct { 2746 enum { change_cipher_spec(1), (255) } type; 2747 } ChangeCipherSpec; 2749 A.3. Alert Messages 2751 enum { warning(1), fatal(2), (255) } AlertLevel; 2753 enum { 2754 close_notify(0), 2755 unexpected_message(10), 2756 bad_record_mac(20), 2757 decryption_failed_RESERVED(21), 2758 record_overflow(22), 2759 decompression_failure(30), 2760 handshake_failure(40), 2761 no_certificate_RESERVED(41), 2762 bad_certificate(42), 2763 unsupported_certificate(43), 2764 certificate_revoked(44), 2765 certificate_expired(45), 2766 certificate_unknown(46), 2767 illegal_parameter(47), 2768 unknown_ca(48), 2769 access_denied(49), 2770 decode_error(50), 2771 decrypt_error(51), 2772 export_restriction_RESERVED(60), 2773 protocol_version(70), 2774 insufficient_security(71), 2775 internal_error(80), 2776 user_canceled(90), 2777 no_renegotiation(100), 2778 unsupported_extension(110), /* new */ 2779 (255) 2780 } AlertDescription; 2782 struct { 2783 AlertLevel level; 2784 AlertDescription description; 2785 } Alert; 2786 A.4. Handshake Protocol 2788 enum { 2789 hello_request(0), client_hello(1), server_hello(2), 2790 certificate(11), server_key_exchange (12), 2791 certificate_request(13), server_hello_done(14), 2792 certificate_verify(15), client_key_exchange(16), 2793 finished(20) 2794 (255) 2795 } HandshakeType; 2797 struct { 2798 HandshakeType msg_type; 2799 uint24 length; 2800 select (HandshakeType) { 2801 case hello_request: HelloRequest; 2802 case client_hello: ClientHello; 2803 case server_hello: ServerHello; 2804 case certificate: Certificate; 2805 case server_key_exchange: ServerKeyExchange; 2806 case certificate_request: CertificateRequest; 2807 case server_hello_done: ServerHelloDone; 2808 case certificate_verify: CertificateVerify; 2809 case client_key_exchange: ClientKeyExchange; 2810 case finished: Finished; 2811 } body; 2812 } Handshake; 2814 A.4.1. Hello Messages 2816 struct { } HelloRequest; 2818 struct { 2819 uint32 gmt_unix_time; 2820 opaque random_bytes[28]; 2821 } Random; 2823 opaque SessionID<0..32>; 2825 uint8 CipherSuite[2]; 2827 enum { null(0), (255) } CompressionMethod; 2829 struct { 2830 ProtocolVersion client_version; 2831 Random random; 2832 SessionID session_id; 2833 CipherSuite cipher_suites<2..2^16-1>; 2834 CompressionMethod compression_methods<1..2^8-1>; 2835 select (extensions_present) { 2836 case false: 2837 struct {}; 2838 case true: 2839 Extension extensions<0..2^16-1>; 2840 } 2841 } ClientHello; 2843 struct { 2844 ProtocolVersion server_version; 2845 Random random; 2846 SessionID session_id; 2847 CipherSuite cipher_suite; 2848 CompressionMethod compression_method; 2849 select (extensions_present) { 2850 case false: 2851 struct {}; 2852 case true: 2853 Extension extensions<0..2^16-1>; 2854 } 2855 } ServerHello; 2857 struct { 2858 ExtensionType extension_type; 2859 opaque extension_data<0..2^16-1>; 2860 } Extension; 2862 enum { 2863 signature_hash_types(TBD-BY-IANA), (65535) 2864 } ExtensionType; 2866 A.4.2. Server Authentication and Key Exchange Messages 2868 opaque ASN.1Cert<2^24-1>; 2870 struct { 2871 ASN.1Cert certificate_list<0..2^24-1>; 2872 } Certificate; 2874 enum { diffie_hellman } KeyExchangeAlgorithm; 2876 struct { 2877 opaque dh_p<1..2^16-1>; 2878 opaque dh_g<1..2^16-1>; 2879 opaque dh_Ys<1..2^16-1>; 2880 } ServerDHParams; 2881 struct { 2882 select (KeyExchangeAlgorithm) { 2883 case diffie_hellman: 2884 ServerDHParams params; 2885 Signature signed_params; 2886 } ServerKeyExchange; 2888 enum { anonymous, rsa, dsa } SignatureAlgorithm; 2890 struct { 2891 select (KeyExchangeAlgorithm) { 2892 case diffie_hellman: 2893 ServerDHParams params; 2894 }; 2895 } ServerParams; 2897 struct { 2898 select (SignatureAlgorithm) { 2899 case anonymous: struct { }; 2900 case rsa: 2901 HashType digest_algorithm; // NEW 2902 digitally-signed struct { 2903 opaque hash[Hash.length]; 2904 }; 2905 case dsa: 2906 digitally-signed struct { 2907 opaque sha_hash[20]; 2908 }; 2909 }; 2910 }; 2911 } Signature; 2913 enum { 2914 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 2915 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 2916 fortezza_dms_RESERVED(20), 2917 (255) 2918 } ClientCertificateType; 2920 opaque DistinguishedName<1..2^16-1>; 2922 struct { 2923 ClientCertificateType certificate_types<1..2^8-1>; 2924 DistinguishedName certificate_authorities<0..2^16-1>; 2925 } CertificateRequest; 2927 struct { } ServerHelloDone; 2928 A.4.3. Client Authentication and Key Exchange Messages 2930 struct { 2931 select (KeyExchangeAlgorithm) { 2932 case rsa: EncryptedPreMasterSecret; 2933 case diffie_hellman: ClientDiffieHellmanPublic; 2934 } exchange_keys; 2935 } ClientKeyExchange; 2937 struct { 2938 ProtocolVersion client_version; 2939 opaque random[46]; 2940 } PreMasterSecret; 2942 struct { 2943 public-key-encrypted PreMasterSecret pre_master_secret; 2944 } EncryptedPreMasterSecret; 2946 enum { implicit, explicit } PublicValueEncoding; 2948 struct { 2949 select (PublicValueEncoding) { 2950 case implicit: struct {}; 2951 case explicit: opaque DH_Yc<1..2^16-1>; 2952 } dh_public; 2953 } ClientDiffieHellmanPublic; 2955 struct { 2956 Signature signature; 2957 } CertificateVerify; 2959 A.4.4. Handshake Finalization Message 2961 struct { 2962 opaque verify_data[12]; 2963 } Finished; 2965 A.5. The CipherSuite 2967 The following values define the CipherSuite codes used in the client 2968 hello and server hello messages. 2970 A CipherSuite defines a cipher specification supported in TLS Version 2971 1.1. 2973 TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a 2974 TLS connection during the first handshake on that channel, but MUST 2975 not be negotiated, as it provides no more protection than an 2976 unsecured connection. 2978 CipherSuite TLS_NULL_WITH_NULL_NULL = { 0x00,0x00 }; 2980 The following CipherSuite definitions require that the server provide 2981 an RSA certificate that can be used for key exchange. The server may 2982 request either an RSA or a DSS signature-capable certificate in the 2983 certificate request message. 2985 CipherSuite TLS_RSA_WITH_NULL_MD5 = { 0x00,0x01 }; 2986 CipherSuite TLS_RSA_WITH_NULL_SHA = { 0x00,0x02 }; 2987 CipherSuite TLS_RSA_WITH_RC4_128_MD5 = { 0x00,0x04 }; 2988 CipherSuite TLS_RSA_WITH_RC4_128_SHA = { 0x00,0x05 }; 2989 CipherSuite TLS_RSA_WITH_IDEA_CBC_SHA = { 0x00,0x07 }; 2990 CipherSuite TLS_RSA_WITH_DES_CBC_SHA = { 0x00,0x09 }; 2991 CipherSuite TLS_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0A }; 2992 CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x2F }; 2993 CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x35 }; 2995 The following CipherSuite definitions are used for server- 2996 authenticated (and optionally client-authenticated) Diffie-Hellman. 2997 DH denotes cipher suites in which the server's certificate contains 2998 the Diffie-Hellman parameters signed by the certificate authority 2999 (CA). DHE denotes ephemeral Diffie-Hellman, where the Diffie-Hellman 3000 parameters are signed by a DSS or RSA certificate, which has been 3001 signed by the CA. The signing algorithm used is specified after the 3002 DH or DHE parameter. The server can request an RSA or DSS signature- 3003 capable certificate from the client for client authentication or it 3004 may request a Diffie-Hellman certificate. Any Diffie-Hellman 3005 certificate provided by the client must use the parameters (group and 3006 generator) described by the server. 3008 CipherSuite TLS_DH_DSS_WITH_DES_CBC_SHA = { 0x00,0x0C }; 3009 CipherSuite TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0D }; 3010 CipherSuite TLS_DH_RSA_WITH_DES_CBC_SHA = { 0x00,0x0F }; 3011 CipherSuite TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x10 }; 3012 CipherSuite TLS_DHE_DSS_WITH_DES_CBC_SHA = { 0x00,0x12 }; 3013 CipherSuite TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x13 }; 3014 CipherSuite TLS_DHE_RSA_WITH_DES_CBC_SHA = { 0x00,0x15 }; 3015 CipherSuite TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x16 }; 3016 CipherSuite TLS_DH_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x30 }; 3017 CipherSuite TLS_DH_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x31 }; 3018 CipherSuite TLS_DHE_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x32 }; 3019 CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x33 }; 3020 CipherSuite TLS_DH_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x36 }; 3021 CipherSuite TLS_DH_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x37 }; 3022 CipherSuite TLS_DHE_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x38 }; 3023 CipherSuite TLS_DHE_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x39 }; 3024 The following cipher suites are used for completely anonymous Diffie- 3025 Hellman communications in which neither party is authenticated. Note 3026 that this mode is vulnerable to man-in-the-middle attacks. Using 3027 this mode therefore is of limited use: These ciphersuites MUST NOT be 3028 used by TLS 1.2 implementations unless the application layer has 3029 specifically requested to allow anonymous key exchange. (Anonymous 3030 key exchange may sometimes be acceptable, for example, to support 3031 opportunistic encryption when no set-up for authentication is in 3032 place, or when TLS is used as part of more complex security protocols 3033 that have other means to ensure authentication.) 3035 CipherSuite TLS_DH_anon_WITH_RC4_128_MD5 = { 0x00, 0x18 }; 3036 CipherSuite TLS_DH_anon_WITH_DES_CBC_SHA = { 0x00, 0x1A }; 3037 CipherSuite TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = { 0x00, 0x1B }; 3038 CipherSuite TLS_DH_anon_WITH_AES_128_CBC_SHA = { 0x00, 0x34 }; 3039 CipherSuite TLS_DH_anon_WITH_AES_256_CBC_SHA = { 0x00, 0x3A }; 3041 Note that using non-anonymous key exchange without actually verifying 3042 the key exchange is essentially equivalent to anonymous key exchange, 3043 and the same precautions apply. While non-anonymous key exchange 3044 will generally involve a higher computational and communicational 3045 cost than anonymous key exchange, it may be in the interest of 3046 interoperability not to disable non-anonymous key exchange when the 3047 application layer is allowing anonymous key exchange. 3049 When SSLv3 and TLS 1.0 were designed, the United States restricted 3050 the export of cryptographic software containing certain strong 3051 encryption algorithms. A series of cipher suites were designed to 3052 operate at reduced key lengths in order to comply with those 3053 regulations. Due to advances in computer performance, these 3054 algorithms are now unacceptably weak and export restrictions have 3055 since been loosened. TLS 1.2 implementations MUST NOT negotiate these 3056 cipher suites in TLS 1.2 mode. However, for backward compatibility 3057 they may be offered in the ClientHello for use with TLS 1.0 or SSLv3 3058 only servers. TLS 1.2 clients MUST check that the server did not 3059 choose one of these cipher suites during the handshake. These 3060 ciphersuites are listed below for informational purposes and to 3061 reserve the numbers. 3063 CipherSuite TLS_RSA_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x03 }; 3064 CipherSuite TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = { 0x00,0x06 }; 3065 CipherSuite TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x08 }; 3066 CipherSuite TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0B }; 3067 CipherSuite TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0E }; 3068 CipherSuite TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x11 }; 3069 CipherSuite TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x14 }; 3070 CipherSuite TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x17 }; 3071 CipherSuite TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x19 }; 3072 The following cipher suites were defined in [TLSKRB] and are included 3073 here for completeness. See [TLSKRB] for details: 3075 CipherSuite TLS_KRB5_WITH_DES_CBC_SHA = { 0x00,0x1E }; 3076 CipherSuite TLS_KRB5_WITH_3DES_EDE_CBC_SHA = { 0x00,0x1F }; 3077 CipherSuite TLS_KRB5_WITH_RC4_128_SHA = { 0x00,0x20 }; 3078 CipherSuite TLS_KRB5_WITH_IDEA_CBC_SHA = { 0x00,0x21 }; 3079 CipherSuite TLS_KRB5_WITH_DES_CBC_MD5 = { 0x00,0x22 }; 3080 CipherSuite TLS_KRB5_WITH_3DES_EDE_CBC_MD5 = { 0x00,0x23 }; 3081 CipherSuite TLS_KRB5_WITH_RC4_128_MD5 = { 0x00,0x24 }; 3082 CipherSuite TLS_KRB5_WITH_IDEA_CBC_MD5 = { 0x00,0x25 }; 3084 The following exportable cipher suites were defined in [TLSKRB] and 3085 are included here for completeness. TLS 1.2 implementations MUST NOT 3086 negotiate these cipher suites. 3088 CipherSuite TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA = { 0x00,0x26 3089 }; 3090 CipherSuite TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA = { 0x00,0x27 3091 }; 3092 CipherSuite TLS_KRB5_EXPORT_WITH_RC4_40_SHA = { 0x00,0x28 3093 }; 3094 CipherSuite TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 = { 0x00,0x29 3095 }; 3096 CipherSuite TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 = { 0x00,0x2A 3097 }; 3098 CipherSuite TLS_KRB5_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x2B 3099 }; 3101 New cipher suite values are assigned by IANA as described in Section 3102 11. 3104 Note: The cipher suite values { 0x00, 0x1C } and { 0x00, 0x1D } are 3105 reserved to avoid collision with Fortezza-based cipher suites in SSL 3106 3. 3108 A.6. The Security Parameters 3110 These security parameters are determined by the TLS Handshake 3111 Protocol and provided as parameters to the TLS Record Layer in order 3112 to initialize a connection state. SecurityParameters includes: 3114 enum { null(0), (255) } CompressionMethod; 3116 enum { server, client } ConnectionEnd; 3118 enum { null, rc4, rc2, des, 3des, des40, aes, idea } 3119 BulkCipherAlgorithm; 3121 enum { stream, block, aead } CipherType; 3123 enum { null, md5, sha } MACAlgorithm; 3125 /* The algorithms specified in CompressionMethod, 3126 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 3128 struct { 3129 ConnectionEnd entity; 3130 BulkCipherAlgorithm bulk_cipher_algorithm; 3131 CipherType cipher_type; 3132 uint8 enc_key_length; 3133 uint8 block_length; 3134 uint8 iv_length; 3135 MACAlgorithm mac_algorithm; 3136 uint8 mac_length; 3137 uint8 mac_key_length; 3138 CompressionMethod compression_algorithm; 3139 opaque master_secret[48]; 3140 opaque client_random[32]; 3141 opaque server_random[32]; 3142 } SecurityParameters; 3143 Appendix B. Glossary 3145 Advanced Encryption Standard (AES) 3146 AES is a widely used symmetric encryption algorithm. AES is a 3147 block cipher with a 128, 192, or 256 bit keys and a 16 byte block 3148 size. [AES] TLS currently only supports the 128 and 256 bit key 3149 sizes. 3151 application protocol 3152 An application protocol is a protocol that normally layers 3153 directly on top of the transport layer (e.g., TCP/IP). Examples 3154 include HTTP, TELNET, FTP, and SMTP. 3156 asymmetric cipher 3157 See public key cryptography. 3159 authenticated encryption with additional data (AEAD) 3160 A symmetric encryption algorithm that simultaneously provides 3161 confidentiality and message integrity. 3163 authentication 3164 Authentication is the ability of one entity to determine the 3165 identity of another entity. 3167 block cipher 3168 A block cipher is an algorithm that operates on plaintext in 3169 groups of bits, called blocks. 64 bits is a common block size. 3171 bulk cipher 3172 A symmetric encryption algorithm used to encrypt large quantities 3173 of data. 3175 cipher block chaining (CBC) 3176 CBC is a mode in which every plaintext block encrypted with a 3177 block cipher is first exclusive-ORed with the previous ciphertext 3178 block (or, in the case of the first block, with the 3179 initialization vector). For decryption, every block is first 3180 decrypted, then exclusive-ORed with the previous ciphertext block 3181 (or IV). 3183 certificate 3184 As part of the X.509 protocol (a.k.a. ISO Authentication 3185 framework), certificates are assigned by a trusted Certificate 3186 Authority and provide a strong binding between a party's identity 3187 or some other attributes and its public key. 3189 client 3190 The application entity that initiates a TLS connection to a 3191 server. This may or may not imply that the client initiated the 3192 underlying transport connection. The primary operational 3193 difference between the server and client is that the server is 3194 generally authenticated, while the client is only optionally 3195 authenticated. 3197 client write key 3198 The key used to encrypt data written by the client. 3200 client write MAC secret 3201 The secret data used to authenticate data written by the client. 3203 connection 3204 A connection is a transport (in the OSI layering model 3205 definition) that provides a suitable type of service. For TLS, 3206 such connections are peer-to-peer relationships. The connections 3207 are transient. Every connection is associated with one session. 3209 Data Encryption Standard 3210 DES is a very widely used symmetric encryption algorithm. DES is 3211 a block cipher with a 56 bit key and an 8 byte block size. Note 3212 that in TLS, for key generation purposes, DES is treated as 3213 having an 8 byte key length (64 bits), but it still only provides 3214 56 bits of protection. (The low bit of each key byte is presumed 3215 to be set to produce odd parity in that key byte.) DES can also 3216 be operated in a mode where three independent keys and three 3217 encryptions are used for each block of data; this uses 168 bits 3218 of key (24 bytes in the TLS key generation method) and provides 3219 the equivalent of 112 bits of security. [DES], [3DES] 3221 Digital Signature Standard (DSS) 3222 A standard for digital signing, including the Digital Signing 3223 Algorithm, approved by the National Institute of Standards and 3224 Technology, defined in NIST FIPS PUB 186, "Digital Signature 3225 Standard", published May, 1994 by the U.S. Dept. of Commerce. 3226 [DSS] 3228 digital signatures 3229 Digital signatures utilize public key cryptography and one-way 3230 hash functions to produce a signature of the data that can be 3231 authenticated, and is difficult to forge or repudiate. 3233 handshake 3234 An initial negotiation between client and server that establishes 3235 the parameters of their transactions. 3237 Initialization Vector (IV) 3238 When a block cipher is used in CBC mode, the initialization 3239 vector is exclusive-ORed with the first plaintext block prior to 3240 encryption. 3242 IDEA 3243 A 64-bit block cipher designed by Xuejia Lai and James Massey. 3244 [IDEA] 3246 Message Authentication Code (MAC) 3247 A Message Authentication Code is a one-way hash computed from a 3248 message and some secret data. It is difficult to forge without 3249 knowing the secret data. Its purpose is to detect if the message 3250 has been altered. 3252 master secret 3253 Secure secret data used for generating encryption keys, MAC 3254 secrets, and IVs. 3256 MD5 3257 MD5 is a secure hashing function that converts an arbitrarily 3258 long data stream into a digest of fixed size (16 bytes). [MD5] 3260 public key cryptography 3261 A class of cryptographic techniques employing two-key ciphers. 3262 Messages encrypted with the public key can only be decrypted with 3263 the associated private key. Conversely, messages signed with the 3264 private key can be verified with the public key. 3266 one-way hash function 3267 A one-way transformation that converts an arbitrary amount of 3268 data into a fixed-length hash. It is computationally hard to 3269 reverse the transformation or to find collisions. MD5 and SHA are 3270 examples of one-way hash functions. 3272 RC2 3273 A block cipher developed by Ron Rivest at RSA Data Security, Inc. 3274 [RSADSI] described in [RC2]. 3276 RC4 3277 A stream cipher invented by Ron Rivest. A compatible cipher is 3278 described in [SCH]. 3280 RSA 3281 A very widely used public-key algorithm that can be used for 3282 either encryption or digital signing. [RSA] 3284 server 3285 The server is the application entity that responds to requests 3286 for connections from clients. See also under client. 3288 session 3289 A TLS session is an association between a client and a server. 3290 Sessions are created by the handshake protocol. Sessions define a 3291 set of cryptographic security parameters that can be shared among 3292 multiple connections. Sessions are used to avoid the expensive 3293 negotiation of new security parameters for each connection. 3295 session identifier 3296 A session identifier is a value generated by a server that 3297 identifies a particular session. 3299 server write key 3300 The key used to encrypt data written by the server. 3302 server write MAC secret 3303 The secret data used to authenticate data written by the server. 3305 SHA 3306 The Secure Hash Algorithm is defined in FIPS PUB 180-2. It 3307 produces a 20-byte output. Note that all references to SHA 3308 actually use the modified SHA-1 algorithm. [SHA] 3310 SSL 3311 Netscape's Secure Socket Layer protocol [SSL3]. TLS is based on 3312 SSL Version 3.0 3314 stream cipher 3315 An encryption algorithm that converts a key into a 3316 cryptographically strong keystream, which is then exclusive-ORed 3317 with the plaintext. 3319 symmetric cipher 3320 See bulk cipher. 3322 Transport Layer Security (TLS) 3323 This protocol; also, the Transport Layer Security working group 3324 of the Internet Engineering Task Force (IETF). See "Comments" at 3325 the end of this document. 3327 Appendix C. CipherSuite Definitions 3329 CipherSuite Key Cipher Hash 3330 Exchange 3332 TLS_NULL_WITH_NULL_NULL NULL NULL NULL 3333 TLS_RSA_WITH_NULL_MD5 RSA NULL MD5 3334 TLS_RSA_WITH_NULL_SHA RSA NULL SHA 3335 TLS_RSA_WITH_RC4_128_MD5 RSA RC4_128 MD5 3336 TLS_RSA_WITH_RC4_128_SHA RSA RC4_128 SHA 3337 TLS_RSA_WITH_IDEA_CBC_SHA RSA IDEA_CBC SHA 3338 TLS_RSA_WITH_DES_CBC_SHA RSA DES_CBC SHA 3339 TLS_RSA_WITH_3DES_EDE_CBC_SHA RSA 3DES_EDE_CBC SHA 3340 TLS_RSA_WITH_AES_128_CBC_SHA RSA AES_128_CBC SHA 3341 TLS_RSA_WITH_AES_256_SHA RSA AES_256_CBC SHA 3342 TLS_DH_DSS_WITH_DES_CBC_SHA DH_DSS DES_CBC SHA 3343 TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA DH_DSS 3DES_EDE_CBC SHA 3344 TLS_DH_RSA_WITH_DES_CBC_SHA DH_RSA DES_CBC SHA 3345 TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA DH_RSA 3DES_EDE_CBC SHA 3346 TLS_DHE_DSS_WITH_DES_CBC_SHA DHE_DSS DES_CBC SHA 3347 TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA DHE_DSS 3DES_EDE_CBC SHA 3348 TLS_DHE_RSA_WITH_DES_CBC_SHA DHE_RSA DES_CBC SHA 3349 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA DHE_RSA 3DES_EDE_CBC SHA 3350 TLS_DH_anon_WITH_RC4_128_MD5 DH_anon RC4_128 MD5 3351 TLS_DH_anon_WITH_DES_CBC_SHA DH_anon DES_CBC SHA 3352 TLS_DH_anon_WITH_3DES_EDE_CBC_SHA DH_anon 3DES_EDE_CBC SHA 3353 TLS_DH_DSS_WITH_AES_128_CBC_SHA DH_DSS AES_128_CBC SHA 3354 TLS_DH_RSA_WITH_AES_128_CBC_SHA DH_RSA AES_128_CBC SHA 3355 TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE_DSS AES_128_CBC SHA 3356 TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE_RSA AES_128_CBC SHA 3357 TLS_DH_anon_WITH_AES_128_CBC_SHA DH_anon AES_128_CBC SHA 3358 TLS_DH_DSS_WITH_AES_256_CBC_SHA DH_DSS AES_256_CBC SHA 3359 TLS_DH_RSA_WITH_AES_256_CBC_SHA DH_RSA AES_256_CBC SHA 3360 TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE_DSS AES_256_CBC SHA 3361 TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE_RSA AES_256_CBC SHA 3362 TLS_DH_anon_WITH_AES_256_CBC_SHA DH_anon AES_256_CBC SHA 3364 Key 3365 Exchange 3366 Algorithm Description Key size limit 3368 DHE_DSS Ephemeral DH with DSS signatures None 3369 DHE_RSA Ephemeral DH with RSA signatures None 3370 DH_anon Anonymous DH, no signatures None 3371 DH_DSS DH with DSS-based certificates None 3372 DH_RSA DH with RSA-based certificates None 3373 RSA = none 3374 NULL No key exchange N/A 3375 RSA RSA key exchange None 3377 Key Expanded IV Block 3378 Cipher Type Material Key Material Size Size 3380 NULL Stream 0 0 0 N/A 3381 IDEA_CBC Block 16 16 8 8 3382 RC2_CBC_40 Block 5 16 8 8 3383 RC4_40 Stream 5 16 0 N/A 3384 RC4_128 Stream 16 16 0 N/A 3385 DES40_CBC Block 5 8 8 8 3386 DES_CBC Block 8 8 8 8 3387 3DES_EDE_CBC Block 24 24 8 8 3389 Type 3390 Indicates whether this is a stream cipher or a block cipher 3391 running in CBC mode. 3393 Key Material 3394 The number of bytes from the key_block that are used for 3395 generating the write keys. 3397 Expanded Key Material 3398 The number of bytes actually fed into the encryption algorithm. 3400 IV Size 3401 The amount of data needed to be generated for the initialization 3402 vector. Zero for stream ciphers; equal to the block size for 3403 block ciphers. 3405 Block Size 3406 The amount of data a block cipher enciphers in one chunk; a 3407 block cipher running in CBC mode can only encrypt an even 3408 multiple of its block size. 3410 Hash Hash Padding 3411 function Size Size 3412 NULL 0 0 3413 MD5 16 48 3414 SHA 20 40 3415 Appendix D. Implementation Notes 3417 The TLS protocol cannot prevent many common security mistakes. This 3418 section provides several recommendations to assist implementors. 3420 D.1 Random Number Generation and Seeding 3422 TLS requires a cryptographically secure pseudorandom number generator 3423 (PRNG). Care must be taken in designing and seeding PRNGs. PRNGs 3424 based on secure hash operations, most notably MD5 and/or SHA, are 3425 acceptable, but cannot provide more security than the size of the 3426 random number generator state. (For example, MD5-based PRNGs usually 3427 provide 128 bits of state.) 3429 To estimate the amount of seed material being produced, add the 3430 number of bits of unpredictable information in each seed byte. For 3431 example, keystroke timing values taken from a PC compatible's 18.2 Hz 3432 timer provide 1 or 2 secure bits each, even though the total size of 3433 the counter value is 16 bits or more. Seeding a 128-bit PRNG would 3434 thus require approximately 100 such timer values. 3436 [RANDOM] provides guidance on the generation of random values. 3438 D.2 Certificates and Authentication 3440 Implementations are responsible for verifying the integrity of 3441 certificates and should generally support certificate revocation 3442 messages. Certificates should always be verified to ensure proper 3443 signing by a trusted Certificate Authority (CA). The selection and 3444 addition of trusted CAs should be done very carefully. Users should 3445 be able to view information about the certificate and root CA. 3447 D.3 CipherSuites 3449 TLS supports a range of key sizes and security levels, including some 3450 that provide no or minimal security. A proper implementation will 3451 probably not support many cipher suites. For instance, anonymous 3452 Diffie-Hellman is strongly discouraged because it cannot prevent man- 3453 in-the-middle attacks. Applications should also enforce minimum and 3454 maximum key sizes. For example, certificate chains containing 512-bit 3455 RSA keys or signatures are not appropriate for high-security 3456 applications. 3458 Appendix E. Backward Compatibility 3460 E.1 Compatibility with TLS 1.0/1.1 and SSL 3.0 3462 Since there are various versions of TLS (1.0, 1.1, 1.2, and any 3463 future versions) and SSL (2.0 and 3.0), means are needed to negotiate 3464 the specific protocol version to use. The TLS protocol provides a 3465 built-in mechanism for version negotiation so as not to bother other 3466 protocol components with the complexities of version selection. 3468 TLS versions 1.0, 1.1, and 1.2, and SSL 3.0 are very similar, and use 3469 compatible ClientHello messages; thus, supporting all of them is 3470 relatively easy. Similarly, servers can easily handle clients trying 3471 to use future versions of TLS as long as the ClientHello format 3472 remains compatible, and the client support the highest protocol 3473 version available in the server. 3475 A TLS 1.2 client who wishes to negotiate with such older servers will 3476 send a normal TLS 1.2 ClientHello, containing { 3, 3 } (TLS 1.2) in 3477 ClientHello.client_version. If the server does not support this 3478 version, it will respond with ServerHello containing an older version 3479 number. If the client agrees to use this version, the negotiation 3480 will proceed as appropriate for the negotiated protocol. 3482 If the version chosen by the server is not supported by the client 3483 (or not acceptable), the client MUST send a "protocol_version" alert 3484 message and close the connection. 3486 If a TLS server receives a ClientHello containing a version number 3487 greater than the highest version supported by the server, it MUST 3488 reply according to the highest version supported by the server. 3490 A TLS server can also receive a ClientHello containing version number 3491 smaller than the highest supported version. If the server wishes to 3492 negotiate with old clients, it will proceed as appropriate for the 3493 highest version supported by the server that is not greater than 3494 ClientHello.client_version. For example, if the server supports TLS 3495 1.0, 1.1, and 1.2, and client_version is TLS 1.0, the server will 3496 proceed with a TLS 1.0 ServerHello. If server supports (or is willing 3497 to use) only versions greater than client_version, it MUST send a 3498 "protocol_version" alert message and close the connection. 3500 Whenever a client already knows the highest protocol known to a 3501 server (for example, when resuming a session), it SHOULD initiate the 3502 connection in that native protocol. 3504 Note: some server implementations are known to implement version 3505 negotiation incorrectly. For example, there are buggy TLS 1.0 servers 3506 that simply close the connection when the client offers a version 3507 newer than TLS 1.0. Also, it is known that some servers will refuse 3508 connection if any TLS extensions are included in ClientHello. 3509 Interoperability with such buggy servers is a complex topic beyond 3510 the scope of this document, and may require multiple connection 3511 attempts by the client. 3513 Earlier versions of the TLS specification were not fully clear on 3514 what the record layer version number (TLSPlaintext.version) should 3515 contain when sending ClientHello (i.e., before it is known which 3516 version of the protocol will be employed). Thus, TLS servers 3517 compliant with this specification MUST accept any value {03,XX} as 3518 the record layer version number for ClientHello. 3520 TLS clients that wish to negotiate with older servers MAY send any 3521 value {03,XX} as the record layer version number. Typical values 3522 would be {03,00}, the lowest version number supported by the client, 3523 and the value of ClientHello.client_version. No single value will 3524 guarantee interoperability with all old servers, but this is a 3525 complex topic beyond the scope of this document. 3527 E.2 Compatibility with SSL 2.0 3529 TLS 1.2 clients that wish to support SSL 2.0 servers MUST send 3530 version 2.0 CLIENT-HELLO messages defined in [SSL2]. The message MUST 3531 contain the same version number as would be used for ordinary 3532 ClientHello, and MUST encode the supported TLS ciphersuites in the 3533 CIPHER-SPECS-DATA field as described below. 3535 Warning: The ability to send version 2.0 CLIENT-HELLO messages will be 3536 phased out with all due haste, since the newer ClientHello format 3537 provides better mechanisms for moving to newer versions and 3538 negotiating extensions. TLS 1.2 clients SHOULD NOT support SSL 2.0. 3540 However, even TLS servers that do not support SSL 2.0 SHOULD accept 3541 version 2.0 CLIENT-HELLO messages. The message is presented below in 3542 sufficient detail for TLS server implementors; the true definition is 3543 still assumed to be [SSL2]. 3545 For negotiation purposes, 2.0 CLIENT-HELLO is interpreted the same 3546 way as a ClientHello with a "null" compression method and no 3547 extensions. Note that this message MUST be sent directly on the wire, 3548 not wrapped as a TLS record. For the purposes of calculating Finished 3549 and CertificateVerify, the msg_length field is not considered to be a 3550 part of the handshake message. 3552 uint8 V2CipherSpec[3]; 3553 struct { 3554 uint16 msg_length; 3555 uint8 msg_type; 3556 Version version; 3557 uint16 cipher_spec_length; 3558 uint16 session_id_length; 3559 uint16 challenge_length; 3560 V2CipherSpec cipher_specs[V2ClientHello.cipher_spec_length]; 3561 opaque session_id[V2ClientHello.session_id_length]; 3562 opaque challenge[V2ClientHello.challenge_length; 3563 } V2ClientHello; 3565 msg_length 3566 The highest bit MUST be 1; the remaining bits contain the 3567 length of the following data in bytes. 3569 msg_type 3570 This field, in conjunction with the version field, identifies a 3571 version 2 client hello message. The value MUST be one (1). 3573 version 3574 Equal to ClientHello.client_version. 3576 cipher_spec_length 3577 This field is the total length of the field cipher_specs. It 3578 cannot be zero and MUST be a multiple of the V2CipherSpec length 3579 (3). 3581 session_id_length 3582 This field MUST have a value of zero for a client that claims to 3583 support TLS 1.2. 3585 challenge_length 3586 The length in bytes of the client's challenge to the server to 3587 authenticate itself. Historically, permissible values are between 3588 16 and 32 bytes inclusive. When using the SSLv2 backward 3589 compatible handshake the client SHOULD use a 32 byte challenge. 3591 cipher_specs 3592 This is a list of all CipherSpecs the client is willing and able 3593 to use. In addition to the 2.0 cipher specs defined in [SSL2], 3594 this includes the TLS cipher suites normally sent in 3595 ClientHello.cipher_suites, each cipher suite prefixed by a zero 3596 byte. For example, TLS ciphersuite {0x00,0x0A} would be sent as 3597 {0x00,0x00,0x0A}. 3599 session_id 3600 This field MUST be empty. 3602 challenge 3603 Corresponds to ClientHello.random. If the challenge length is 3604 less than 32, the TLS server will pad the data with leading 3605 (note: not trailing) zero bytes to make it 32 bytes long. 3607 Note: Requests to resume a TLS session MUST use a TLS client hello. 3609 E.2. Avoiding Man-in-the-Middle Version Rollback 3611 When TLS clients fall back to Version 2.0 compatibility mode, they 3612 MUST use special PKCS#1 block formatting. This is done so that TLS 3613 servers will reject Version 2.0 sessions with TLS-capable clients. 3615 When a client negotiates SSL 2.0 but also supports TLS, it MUST set 3616 the right-hand (least-significant) 8 random bytes of the PKCS padding 3617 (not including the terminal null of the padding) for the RSA 3618 encryption of the ENCRYPTED-KEY-DATA field of the CLIENT-MASTER-KEY 3619 to 0x03 (the other padding bytes are random). 3621 When a TLS-capable server negotiates SSL 2.0 it SHOULD, after 3622 decrypting the ENCRYPTED-KEY-DATA field, check that these eight 3623 padding bytes are 0x03. If they are not, the server SHOULD generate a 3624 random value for SECRET-KEY-DATA, and continue the handshake (which 3625 will eventually fail since the keys will not match). Note that 3626 reporting the error situation to the client could make the server 3627 vulnerable to attacks described in [BLEI]. 3629 Appendix F. Security Analysis 3631 The TLS protocol is designed to establish a secure connection between 3632 a client and a server communicating over an insecure channel. This 3633 document makes several traditional assumptions, including that 3634 attackers have substantial computational resources and cannot obtain 3635 secret information from sources outside the protocol. Attackers are 3636 assumed to have the ability to capture, modify, delete, replay, and 3637 otherwise tamper with messages sent over the communication channel. 3638 This appendix outlines how TLS has been designed to resist a variety 3639 of attacks. 3641 F.1. Handshake Protocol 3643 The handshake protocol is responsible for selecting a CipherSpec and 3644 generating a Master Secret, which together comprise the primary 3645 cryptographic parameters associated with a secure session. The 3646 handshake protocol can also optionally authenticate parties who have 3647 certificates signed by a trusted certificate authority. 3649 F.1.1. Authentication and Key Exchange 3651 TLS supports three authentication modes: authentication of both 3652 parties, server authentication with an unauthenticated client, and 3653 total anonymity. Whenever the server is authenticated, the channel is 3654 secure against man-in-the-middle attacks, but completely anonymous 3655 sessions are inherently vulnerable to such attacks. Anonymous 3656 servers cannot authenticate clients. If the server is authenticated, 3657 its certificate message must provide a valid certificate chain 3658 leading to an acceptable certificate authority. Similarly, 3659 authenticated clients must supply an acceptable certificate to the 3660 server. Each party is responsible for verifying that the other's 3661 certificate is valid and has not expired or been revoked. 3663 The general goal of the key exchange process is to create a 3664 pre_master_secret known to the communicating parties and not to 3665 attackers. The pre_master_secret will be used to generate the 3666 master_secret (see Section 8.1). The master_secret is required to 3667 generate the finished messages, encryption keys, and MAC secrets (see 3668 Sections 7.4.9 and 6.3). By sending a correct finished message, 3669 parties thus prove that they know the correct pre_master_secret. 3671 F.1.1.1. Anonymous Key Exchange 3673 Completely anonymous sessions can be established using RSA or Diffie- 3674 Hellman for key exchange. With anonymous RSA, the client encrypts a 3675 pre_master_secret with the server's uncertified public key extracted 3676 from the server key exchange message. The result is sent in a client 3677 key exchange message. Since eavesdroppers do not know the server's 3678 private key, it will be infeasible for them to decode the 3679 pre_master_secret. 3681 Note: No anonymous RSA Cipher Suites are defined in this document. 3683 With Diffie-Hellman, the server's public parameters are contained in 3684 the server key exchange message and the client's are sent in the 3685 client key exchange message. Eavesdroppers who do not know the 3686 private values should not be able to find the Diffie-Hellman result 3687 (i.e. the pre_master_secret). 3689 Warning: Completely anonymous connections only provide protection 3690 against passive eavesdropping. Unless an independent tamper- 3691 proof channel is used to verify that the finished messages 3692 were not replaced by an attacker, server authentication is 3693 required in environments where active man-in-the-middle 3694 attacks are a concern. 3696 F.1.1.2. RSA Key Exchange and Authentication 3698 With RSA, key exchange and server authentication are combined. The 3699 public key is contained in the server's certificate. Note that 3700 compromise of the server's static RSA key results in a loss of 3701 confidentiality for all sessions protected under that static key. TLS 3702 users desiring Perfect Forward Secrecy should use DHE cipher suites. 3703 The damage done by exposure of a private key can be limited by 3704 changing one's private key (and certificate) frequently. 3706 After verifying the server's certificate, the client encrypts a 3707 pre_master_secret with the server's public key. By successfully 3708 decoding the pre_master_secret and producing a correct finished 3709 message, the server demonstrates that it knows the private key 3710 corresponding to the server certificate. 3712 When RSA is used for key exchange, clients are authenticated using 3713 the certificate verify message (see Section 7.4.9). The client signs 3714 a value derived from the master_secret and all preceding handshake 3715 messages. These handshake messages include the server certificate, 3716 which binds the signature to the server, and ServerHello.random, 3717 which binds the signature to the current handshake process. 3719 F.1.1.3. Diffie-Hellman Key Exchange with Authentication 3721 When Diffie-Hellman key exchange is used, the server can either 3722 supply a certificate containing fixed Diffie-Hellman parameters or 3723 use the server key exchange message to send a set of temporary 3724 Diffie-Hellman parameters signed with a DSS or RSA certificate. 3726 Temporary parameters are hashed with the hello.random values before 3727 signing to ensure that attackers do not replay old parameters. In 3728 either case, the client can verify the certificate or signature to 3729 ensure that the parameters belong to the server. 3731 If the client has a certificate containing fixed Diffie-Hellman 3732 parameters, its certificate contains the information required to 3733 complete the key exchange. Note that in this case the client and 3734 server will generate the same Diffie-Hellman result (i.e., 3735 pre_master_secret) every time they communicate. To prevent the 3736 pre_master_secret from staying in memory any longer than necessary, 3737 it should be converted into the master_secret as soon as possible. 3738 Client Diffie-Hellman parameters must be compatible with those 3739 supplied by the server for the key exchange to work. 3741 If the client has a standard DSS or RSA certificate or is 3742 unauthenticated, it sends a set of temporary parameters to the server 3743 in the client key exchange message, then optionally uses a 3744 certificate verify message to authenticate itself. 3746 If the same DH keypair is to be used for multiple handshakes, either 3747 because the client or server has a certificate containing a fixed DH 3748 keypair or because the server is reusing DH keys, care must be taken 3749 to prevent small subgroup attacks. Implementations SHOULD follow the 3750 guidelines found in [SUBGROUP]. 3752 Small subgroup attacks are most easily avoided by using one of the 3753 DHE ciphersuites and generating a fresh DH private key (X) for each 3754 handshake. If a suitable base (such as 2) is chosen, g^X mod p can be 3755 computed very quickly, therefore the performance cost is minimized. 3756 Additionally, using a fresh key for each handshake provides Perfect 3757 Forward Secrecy. Implementations SHOULD generate a new X for each 3758 handshake when using DHE ciphersuites. 3760 Because TLS allows the server to provide arbitrary DH groups, the 3761 client SHOULD verify the correctness of the DH group. [TODO: provide 3762 a reference to some document describing how] and that it is of 3763 suitable size as defined by local policy. The client SHOULD also 3764 verify that the DH public exponent appears to be of adequate size. 3765 The server MAY choose to assist the client by providing a known 3766 group, such as those defined in [IKEALG] or [MODP]. These can be 3767 verified by simple comparison. 3769 F.1.2. Version Rollback Attacks 3771 Because TLS includes substantial improvements over SSL Version 2.0, 3772 attackers may try to make TLS-capable clients and servers fall back 3773 to Version 2.0. This attack can occur if (and only if) two TLS- 3774 capable parties use an SSL 2.0 handshake. 3776 Although the solution using non-random PKCS #1 block type 2 message 3777 padding is inelegant, it provides a reasonably secure way for Version 3778 3.0 servers to detect the attack. This solution is not secure against 3779 attackers who can brute force the key and substitute a new ENCRYPTED- 3780 KEY-DATA message containing the same key (but with normal padding) 3781 before the application specified wait threshold has expired. Altering 3782 the padding of the least significant 8 bytes of the PKCS padding does 3783 not impact security for the size of the signed hashes and RSA key 3784 lengths used in the protocol, since this is essentially equivalent to 3785 increasing the input block size by 8 bytes. 3787 F.1.3. Detecting Attacks Against the Handshake Protocol 3789 An attacker might try to influence the handshake exchange to make the 3790 parties select different encryption algorithms than they would 3791 normally chooses. 3793 For this attack, an attacker must actively change one or more 3794 handshake messages. If this occurs, the client and server will 3795 compute different values for the handshake message hashes. As a 3796 result, the parties will not accept each others' finished messages. 3797 Without the master_secret, the attacker cannot repair the finished 3798 messages, so the attack will be discovered. 3800 F.1.4. Resuming Sessions 3802 When a connection is established by resuming a session, new 3803 ClientHello.random and ServerHello.random values are hashed with the 3804 session's master_secret. Provided that the master_secret has not been 3805 compromised and that the secure hash operations used to produce the 3806 encryption keys and MAC secrets are secure, the connection should be 3807 secure and effectively independent from previous connections. 3808 Attackers cannot use known encryption keys or MAC secrets to 3809 compromise the master_secret without breaking the secure hash 3810 operations (which use both SHA and MD5). 3812 Sessions cannot be resumed unless both the client and server agree. 3813 If either party suspects that the session may have been compromised, 3814 or that certificates may have expired or been revoked, it should 3815 force a full handshake. An upper limit of 24 hours is suggested for 3816 session ID lifetimes, since an attacker who obtains a master_secret 3817 may be able to impersonate the compromised party until the 3818 corresponding session ID is retired. Applications that may be run in 3819 relatively insecure environments should not write session IDs to 3820 stable storage. 3822 F.1.5 Extensions 3824 Security considerations for the extension mechanism in general, and 3825 the design of new extensions, are described in the previous section. 3826 A security analysis of each of the extensions defined in this 3827 document is given below. 3829 In general, implementers should continue to monitor the state of the 3830 art, and address any weaknesses identified. 3832 F.2. Protecting Application Data 3834 The master_secret is hashed with the ClientHello.random and 3835 ServerHello.random to produce unique data encryption keys and MAC 3836 secrets for each connection. 3838 Outgoing data is protected with a MAC before transmission. To prevent 3839 message replay or modification attacks, the MAC is computed from the 3840 MAC secret, the sequence number, the message length, the message 3841 contents, and two fixed character strings. The message type field is 3842 necessary to ensure that messages intended for one TLS Record Layer 3843 client are not redirected to another. The sequence number ensures 3844 that attempts to delete or reorder messages will be detected. Since 3845 sequence numbers are 64 bits long, they should never overflow. 3846 Messages from one party cannot be inserted into the other's output, 3847 since they use independent MAC secrets. Similarly, the server-write 3848 and client-write keys are independent, so stream cipher keys are used 3849 only once. 3851 If an attacker does break an encryption key, all messages encrypted 3852 with it can be read. Similarly, compromise of a MAC key can make 3853 message modification attacks possible. Because MACs are also 3854 encrypted, message-alteration attacks generally require breaking the 3855 encryption algorithm as well as the MAC. 3857 Note: MAC secrets may be larger than encryption keys, so messages can 3858 remain tamper resistant even if encryption keys are broken. 3860 F.3. Explicit IVs 3862 [CBCATT] describes a chosen plaintext attack on TLS that depends 3863 on knowing the IV for a record. Previous versions of TLS [TLS1.0] 3864 used the CBC residue of the previous record as the IV and 3865 therefore enabled this attack. This version uses an explicit IV 3866 in order to protect against this attack. 3868 F.4. Security of Composite Cipher Modes 3870 TLS secures transmitted application data via the use of symmetric 3871 encryption and authentication functions defined in the negotiated 3872 ciphersuite. The objective is to protect both the integrity and 3873 confidentiality of the transmitted data from malicious actions by 3874 active attackers in the network. It turns out that the order in 3875 which encryption and authentication functions are applied to the 3876 data plays an important role for achieving this goal [ENCAUTH]. 3878 The most robust method, called encrypt-then-authenticate, first 3879 applies encryption to the data and then applies a MAC to the 3880 ciphertext. This method ensures that the integrity and 3881 confidentiality goals are obtained with ANY pair of encryption 3882 and MAC functions, provided that the former is secure against 3883 chosen plaintext attacks and that the MAC is secure against 3884 chosen-message attacks. TLS uses another method, called 3885 authenticate-then-encrypt, in which first a MAC is computed on 3886 the plaintext and then the concatenation of plaintext and MAC is 3887 encrypted. This method has been proven secure for CERTAIN 3888 combinations of encryption functions and MAC functions, but it is 3889 not guaranteed to be secure in general. In particular, it has 3890 been shown that there exist perfectly secure encryption functions 3891 (secure even in the information-theoretic sense) that combined 3892 with any secure MAC function, fail to provide the confidentiality 3893 goal against an active attack. Therefore, new ciphersuites and 3894 operation modes adopted into TLS need to be analyzed under the 3895 authenticate-then-encrypt method to verify that they achieve the 3896 stated integrity and confidentiality goals. 3898 Currently, the security of the authenticate-then-encrypt method 3899 has been proven for some important cases. One is the case of 3900 stream ciphers in which a computationally unpredictable pad of 3901 the length of the message, plus the length of the MAC tag, is 3902 produced using a pseudo-random generator and this pad is xor-ed 3903 with the concatenation of plaintext and MAC tag. The other is 3904 the case of CBC mode using a secure block cipher. In this case, 3905 security can be shown if one applies one CBC encryption pass to 3906 the concatenation of plaintext and MAC and uses a new, 3907 independent, and unpredictable IV for each new pair of plaintext 3908 and MAC. In previous versions of SSL, CBC mode was used properly 3909 EXCEPT that it used a predictable IV in the form of the last 3910 block of the previous ciphertext. This made TLS open to chosen 3911 plaintext attacks. This version of the protocol is immune to 3912 those attacks. For exact details in the encryption modes proven 3913 secure, see [ENCAUTH]. 3915 F.5 Denial of Service 3917 TLS is susceptible to a number of denial of service (DoS) attacks. 3918 In particular, an attacker who initiates a large number of TCP 3919 connections can cause a server to consume large amounts of CPU doing 3920 RSA decryption. However, because TLS is generally used over TCP, it 3921 is difficult for the attacker to hide his point of origin if proper 3922 TCP SYN randomization is used [SEQNUM] by the TCP stack. 3924 Because TLS runs over TCP, it is also susceptible to a number of 3925 denial of service attacks on individual connections. In particular, 3926 attackers can forge RSTs, thereby terminating connections, or forge 3927 partial TLS records, thereby causing the connection to stall. These 3928 attacks cannot in general be defended against by a TCP-using 3929 protocol. Implementors or users who are concerned with this class of 3930 attack should use IPsec AH [AH] or ESP [ESP]. 3932 F.6. Final Notes 3934 For TLS to be able to provide a secure connection, both the client 3935 and server systems, keys, and applications must be secure. In 3936 addition, the implementation must be free of security errors. 3938 The system is only as strong as the weakest key exchange and 3939 authentication algorithm supported, and only trustworthy 3940 cryptographic functions should be used. Short public keys and 3941 anonymous servers should be used with great caution. Implementations 3942 and users must be careful when deciding which certificates and 3943 certificate authorities are acceptable; a dishonest certificate 3944 authority can do tremendous damage. 3946 Security Considerations 3948 Security issues are discussed throughout this memo, especially in 3949 Appendices D, E, and F. 3951 Changes in This Version 3953 [RFC Editor: Please delete this] 3955 - Added some guidance about checking DH groups and exponents. 3956 [Issues 15 and 43] 3958 - DigestInfo now MUST be NULL but must be accepted either way 3959 per discussion in Prague [Issue 22] 3961 - Improved versions of Bleichenbacher/Klima/Version number 3962 text for the EPMS (due to Eronen) [Issue 17] 3964 - Cleaned up SSLv2 backward compatibility text [Issue 25] 3966 - Improvements to signature hash agility text [Issue 41]. 3967 Still not completely fixed. 3969 - Changed cert_hash_types to signature hash types and indicated a 3970 preference order. 3972 - Strengthened language about when alerts are required. Note 3973 that it is still legal under some circumstances to close 3974 a connection with no alert. 3976 Normative References 3977 [AES] National Institute of Standards and Technology, 3978 "Specification for the Advanced Encryption Standard (AES)" 3979 FIPS 197. November 26, 2001. 3981 [3DES] National Institute of Standards and Tecnology, 3982 "Recommendation for the Triple Data Encryption Algorithm 3983 (TDEA) Block Cipher", NIST Special Publication 800-67, May 3984 2004. 3986 [DES] National Institute of Standards and Technology, "Data 3987 Encryption Standard (DES)", FIPS PUB 46-3, October 1999. 3989 [DSS] NIST FIPS PUB 186-2, "Digital Signature Standard," National 3990 Institute of Standards and Technology, U.S. Department of 3991 Commerce, 2000. 3993 [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 3994 Hashing for Message Authentication", RFC 2104, February 3995 1997. 3997 [IDEA] X. Lai, "On the Design and Security of Block Ciphers," ETH 3998 Series in Information Processing, v. 1, Konstanz: Hartung- 3999 Gorre Verlag, 1992. 4001 [MD5] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321, 4002 April 1992. 4004 [PKCS1] J. Jonsson, B. Kaliski, "Public-Key Cryptography Standards 4005 (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 4006 3447, February 2003. 4008 [PKIX] Housley, R., Ford, W., Polk, W. and D. Solo, "Internet 4009 Public Key Infrastructure: Part I: X.509 Certificate and CRL 4010 Profile", RFC 3280, April 2002. 4012 [RC2] Rivest, R., "A Description of the RC2(r) Encryption 4013 Algorithm", RFC 2268, March 1998. 4015 [SCH] B. Schneier. "Applied Cryptography: Protocols, Algorithms, 4016 and Source Code in C, 2ed", Published by John Wiley & Sons, 4017 Inc. 1996. 4019 [SHA] NIST FIPS PUB 180-2, "Secure Hash Standard," National 4020 Institute of Standards and Technology, U.S. Department of 4021 Commerce., August 2001. 4023 [REQ] Bradner, S., "Key words for use in RFCs to Indicate 4024 Requirement Levels", BCP 14, RFC 2119, March 1997. 4026 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4027 IANA Considerations Section in RFCs", BCP 25, RFC 2434, 4028 October 1998. 4030 [URI] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform 4031 Resource Identifiers (URI): Generic Syntax", RFC 2396, 4032 August 1998. 4034 [X509-4th] ITU-T Recommendation X.509 (2000) | ISO/IEC 9594- 8:2001, 4035 "Information Systems - Open Systems Interconnection - The 4036 Directory: Public key and Attribute certificate 4037 frameworks." 4039 [X509-4th-TC1] ITU-T Recommendation X.509(2000) Corrigendum 1(2001) | 4040 ISO/IEC 9594-8:2001/Cor.1:2002, Technical Corrigendum 1 to 4041 ISO/IEC 9594:8:2001. 4043 Informative References 4045 [AEAD] Mcgrew, D., "Authenticated Encryption", February 2007, 4046 draft-mcgrew-auth-enc-02.txt. 4048 [AH] Kent, S., and Atkinson, R., "IP Authentication Header", RFC 4049 4302, December 2005. 4051 [BLEI] Bleichenbacher D., "Chosen Ciphertext Attacks against 4052 Protocols Based on RSA Encryption Standard PKCS #1" in 4053 Advances in Cryptology -- CRYPTO'98, LNCS vol. 1462, pages: 4054 1-12, 1998. 4056 [CBCATT] Moeller, B., "Security of CBC Ciphersuites in SSL/TLS: 4057 Problems and Countermeasures", 4058 http://www.openssl.org/~bodo/tls-cbc.txt. 4060 [CBCTIME] Canvel, B., "Password Interception in a SSL/TLS Channel", 4061 http://lasecwww.epfl.ch/memo_ssl.shtml, 2003. 4063 [CCM] "NIST Special Publication 800-38C: The CCM Mode for 4064 Authentication and Confidentiality", 4065 http://csrc.nist.gov/publications/nistpubs/SP800-38C.pdf. 4067 [ENCAUTH] Krawczyk, H., "The Order of Encryption and Authentication 4068 for Protecting Communications (Or: How Secure is SSL?)", 4069 Crypto 2001. 4071 [ESP] Kent, S., and Atkinson, R., "IP Encapsulating Security 4072 Payload (ESP)", RFC 4303, December 2005. 4074 [GCM] "NIST Special Publication 800-38C: The CCM Mode for 4075 Authentication and Confidentiality", 4076 http://csrc.nist.gov/publications/nistpubs/SP800-38C.pdf. 4078 [IKEALG] Schiller, J., "Cryptographic Algorithms for Use in the 4079 Internet Key Exchange Version 2 (IKEv2)", RFC 4307, December 4080 2005. 4082 [KPR03] Klima, V., Pokorny, O., Rosa, T., "Attacking RSA-based 4083 Sessions in SSL/TLS", http://eprint.iacr.org/2003/052/, 4084 March 2003. 4086 [MODP] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 4087 Diffie-Hellman groups for Internet Key Exchange (IKE)", RFC 4088 3526, May 2003. 4090 [PKCS6] RSA Laboratories, "PKCS #6: RSA Extended Certificate Syntax 4091 Standard," version 1.5, November 1993. 4093 [PKCS7] RSA Laboratories, "PKCS #7: RSA Cryptographic Message Syntax 4094 Standard," version 1.5, November 1993. 4096 [RANDOM] Eastlake, D., 3rd, Schiller, J., and S. Crocker, "Randomness 4097 Requirements for Security", BCP 106, RFC 4086, June 2005. 4099 [RSA] R. Rivest, A. Shamir, and L. M. Adleman, "A Method for 4100 Obtaining Digital Signatures and Public-Key Cryptosystems," 4101 Communications of the ACM, v. 21, n. 2, Feb 1978, pp. 4102 120-126. 4104 [SEQNUM] Bellovin. S., "Defending Against Sequence Number Attacks", 4105 RFC 1948, May 1996. 4107 [SSL2] Hickman, Kipp, "The SSL Protocol", Netscape Communications 4108 Corp., Feb 9, 1995. 4110 [SSL3] A. Frier, P. Karlton, and P. Kocher, "The SSL 3.0 Protocol", 4111 Netscape Communications Corp., Nov 18, 1996. 4113 [SUBGROUP] Zuccherato, R., "Methods for Avoiding the "Small-Subgroup" 4114 Attacks on the Diffie-Hellman Key Agreement Method for 4115 S/MIME", RFC 2785, March 2000. 4117 [TCP] Postel, J., "Transmission Control Protocol," STD 7, RFC 793, 4118 September 1981. 4120 [TIMING] Boneh, D., Brumley, D., "Remote timing attacks are 4121 practical", USENIX Security Symposium 2003. 4123 [TLSAES] Chown, P., "Advanced Encryption Standard (AES) Ciphersuites 4124 for Transport Layer Security (TLS)", RFC 3268, June 2002. 4126 [TLSEXT] Blake-Wilson, S., Nystrom, M., Hopwood, D., Mikkelsen, J., 4127 Wright, T., "Transport Layer Security (TLS) Extensions", RFC 4128 3546, June 2003. 4130 [TLSKRB] Medvinsky, A. and M. Hur, "Addition of Kerberos Cipher 4131 Suites to Transport Layer Security (TLS)", RFC 2712, October 4132 1999. 4134 [TLS1.0] Dierks, T., and C. Allen, "The TLS Protocol, Version 1.0", 4135 RFC 2246, January 1999. 4137 [TLS1.1] Dierks, T., and E. Rescorla, "The TLS Protocol, Version 4138 1.1", RFC 4346, April, 2006. 4140 [X501] ITU-T Recommendation X.501: Information Technology - Open 4141 Systems Interconnection - The Directory: Models, 1993. 4143 [X509] ITU-T Recommendation X.509 (1997 E): Information Technology - 4144 Open Systems Interconnection - "The Directory - 4145 Authentication Framework". 1988. 4147 [XDR] Srinivansan, R., Sun Microsystems, "XDR: External Data 4148 Representation Standard", RFC 1832, August 1995. 4150 Credits 4152 Working Group Chairs 4153 Eric Rescorla 4154 EMail: ekr@networkresonance.com 4156 Pasi Eronen 4157 pasi.eronen@nokia.com 4159 Editors 4161 Tim Dierks Eric Rescorla 4162 Independent Network Resonance, Inc. 4164 EMail: tim@dierks.org EMail: ekr@networkresonance.com 4166 Other contributors 4168 Christopher Allen (co-editor of TLS 1.0) 4169 Alacrity Ventures 4170 ChristopherA@AlacrityManagement.com 4172 Martin Abadi 4173 University of California, Santa Cruz 4174 abadi@cs.ucsc.edu 4176 Steven M. Bellovin 4177 Columbia University 4178 smb@cs.columbia.edu 4180 Simon Blake-Wilson 4181 BCI 4182 EMail: sblakewilson@bcisse.com 4184 Ran Canetti 4185 IBM 4186 canetti@watson.ibm.com 4188 Pete Chown 4189 Skygate Technology Ltd 4190 pc@skygate.co.uk 4192 Taher Elgamal 4193 taher@securify.com 4194 Securify 4196 Anil Gangolli 4197 anil@busybuddha.org 4199 Kipp Hickman 4201 David Hopwood 4202 Independent Consultant 4203 EMail: david.hopwood@blueyonder.co.uk 4205 Phil Karlton (co-author of SSLv3) 4207 Paul Kocher (co-author of SSLv3) 4208 Cryptography Research 4209 paul@cryptography.com 4211 Hugo Krawczyk 4212 Technion Israel Institute of Technology 4213 hugo@ee.technion.ac.il 4215 Jan Mikkelsen 4216 Transactionware 4217 EMail: janm@transactionware.com 4219 Magnus Nystrom 4220 RSA Security 4221 EMail: magnus@rsasecurity.com 4223 Robert Relyea 4224 Netscape Communications 4225 relyea@netscape.com 4227 Jim Roskind 4228 Netscape Communications 4229 jar@netscape.com 4230 Michael Sabin 4232 Dan Simon 4233 Microsoft, Inc. 4234 dansimon@microsoft.com 4236 Tom Weinstein 4238 Tim Wright 4239 Vodafone 4240 EMail: timothy.wright@vodafone.com 4242 Comments 4244 The discussion list for the IETF TLS working group is located at the 4245 e-mail address . Information on the group and 4246 information on how to subscribe to the list is at 4247 4249 Archives of the list can be found at: 4250 4251 Full Copyright Statement 4253 Copyright (C) The IETF Trust (2007). 4255 This document is subject to the rights, licenses and restrictions 4256 contained in BCP 78, and except as set forth therein, the authors 4257 retain all their rights. 4259 This document and the information contained herein are provided on an 4260 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4261 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 4262 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 4263 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 4264 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4265 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4267 Intellectual Property 4269 The IETF takes no position regarding the validity or scope of any 4270 Intellectual Property Rights or other rights that might be claimed to 4271 pertain to the implementation or use of the technology described in 4272 this document or the extent to which any license under such rights 4273 might or might not be available; nor does it represent that it has 4274 made any independent effort to identify any such rights. Information 4275 on the procedures with respect to rights in RFC documents can be 4276 found in BCP 78 and BCP 79. 4278 Copies of IPR disclosures made to the IETF Secretariat and any 4279 assurances of licenses to be made available, or the result of an 4280 attempt made to obtain a general license or permission for the use of 4281 such proprietary rights by implementers or users of this 4282 specification can be obtained from the IETF on-line IPR repository at 4283 http://www.ietf.org/ipr. 4285 The IETF invites any interested party to bring to its attention any 4286 copyrights, patents or patent applications, or other proprietary 4287 rights that may cover technology that may be required to implement 4288 this standard. Please address the information to the IETF at 4289 ietf-ipr@ietf.org. 4291 Acknowledgment 4293 Funding for the RFC Editor function is provided by the IETF 4294 Administrative Support Activity (IASA).