idnits 2.17.1 draft-ietf-tls-rfc4346-bis-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 15. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 4492. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4503. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4510. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4516. 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 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 752 has weird spacing: '...gorithm bul...' == Line 2334 has weird spacing: '...ixed_dh a c...' == Line 2335 has weird spacing: '...ixed_dh a c...' == Line 2435 has weird spacing: '...ificate types...' == Line 2462 has weird spacing: '...ed_ecdh the...' == 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) -- Looks like a reference, but probably isn't: '0' on line 313 -- Looks like a reference, but probably isn't: '1' on line 313 -- Looks like a reference, but probably isn't: '3' on line 3802 -- Looks like a reference, but probably isn't: '9' on line 348 -- Looks like a reference, but probably isn't: '2' on line 3030 -- Looks like a reference, but probably isn't: '4' on line 384 -- Looks like a reference, but probably isn't: '8' on line 385 -- Looks like a reference, but probably isn't: '10' on line 485 -- Looks like a reference, but probably isn't: '20' on line 571 -- Looks like a reference, but probably isn't: '48' on line 3334 -- Looks like a reference, but probably isn't: '32' on line 3336 == Missing Reference: 'ChangeCipherSpec' is mentioned on line 1614, but not defined -- Looks like a reference, but probably isn't: '28' on line 3025 == Missing Reference: '4366bis' is mentioned on line 2133, but not defined -- Looks like a reference, but probably isn't: '46' on line 3159 == Missing Reference: 'Issue 41' is mentioned on line 4181, but not defined == Missing Reference: 'Issue 35' is mentioned on line 4183, but not defined == Missing Reference: 'Issue 58' is mentioned on line 4185, but not defined == Missing Reference: 'Issue 59' is mentioned on line 4187, but not defined == Missing Reference: 'Issue 57' is mentioned on line 4189, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' -- Possible downref: Non-RFC (?) normative reference: ref. '3DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DES' -- Possible downref: Non-RFC (?) normative reference: ref. 'DSS' ** Downref: Normative reference to an Informational RFC: RFC 2104 (ref. 'HMAC') -- Possible downref: Non-RFC (?) normative reference: ref. 'IDEA' ** Downref: Normative reference to an Informational RFC: RFC 1321 (ref. 'MD5') ** Obsolete normative reference: RFC 3447 (ref. 'PKCS1') (Obsoleted by RFC 8017) ** Obsolete normative reference: RFC 3280 (ref. 'PKIX') (Obsoleted by RFC 5280) ** Downref: Normative reference to an Informational RFC: RFC 2268 (ref. 'RC2') -- Possible downref: Non-RFC (?) normative reference: ref. 'SCH' -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' ** Obsolete normative reference: RFC 2434 (Obsoleted by RFC 5226) == Outdated reference: A later version (-05) exists of draft-mcgrew-auth-enc-02 -- Obsolete informational reference (is this intentional?): RFC 4307 (ref. 'IKEALG') (Obsoleted by RFC 8247) -- Obsolete informational reference (is this intentional?): RFC 4366 (Obsoleted by RFC 5246, RFC 6066) -- Obsolete informational reference (is this intentional?): RFC 1948 (ref. 'SEQNUM') (Obsoleted by RFC 6528) -- Obsolete informational reference (is this intentional?): RFC 793 (ref. 'TCP') (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 3268 (ref. 'TLSAES') (Obsoleted by RFC 5246) -- Obsolete informational reference (is this intentional?): RFC 4492 (ref. 'TLSECC') (Obsoleted by RFC 8422) == Outdated reference: A later version (-12) exists of draft-ietf-tls-rfc4366-bis-00 Summary: 7 errors (**), 0 flaws (~~), 17 warnings (==), 34 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 INTERNET-DRAFT Tim Dierks 3 Obsoletes (if approved): RFC 3268, 4346, 4366 Independent 4 Intended status: Proposed Standard Eric Rescorla 5 Network Resonance, Inc. 6 October 2007 (Expires April 2008) 8 The Transport Layer Security (TLS) Protocol 9 Version 1.2 11 Status of this Memo 12 By submitting this Internet-Draft, each author represents that any 13 applicable patent or other IPR claims of which he or she is aware 14 have been or will be disclosed, and any of which he or she becomes 15 aware will be disclosed, in accordance with Section 6 of BCP 79. 17 Internet-Drafts are working documents of the Internet Engineering 18 Task Force (IETF), its areas, and its working groups. Note that 19 other groups may also distribute working documents as Internet- 20 Drafts. 22 Internet-Drafts are draft documents valid for a maximum of six months 23 and may be updated, replaced, or obsoleted by other documents at any 24 time. It is inappropriate to use Internet-Drafts as reference 25 material or to cite them other than as "work in progress." 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt. 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 Copyright Notice 35 Copyright (C) The IETF Trust (2007). 37 Abstract 39 This document specifies Version 1.2 of the Transport Layer Security 40 (TLS) protocol. The TLS protocol provides communications security 41 over the Internet. The protocol allows client/server applications to 42 communicate in a way that is designed to prevent eavesdropping, 43 tampering, or message forgery. 45 Table of Contents 47 1. Introduction 3 48 1.1 Requirements Terminology 5 49 1.2 Major Differences from TLS 1.1 5 50 2. Goals 6 51 3. Goals of This Document 6 52 4. Presentation Language 7 53 4.1. Basic Block Size 7 54 4.2. Miscellaneous 7 55 4.3. Vectors 7 56 4.4. Numbers 8 57 4.5. Enumerateds 9 58 4.6. Constructed Types 10 59 4.6.1. Variants 10 60 4.7. Cryptographic Attributes 11 61 4.8. Constants 13 62 5. HMAC and the Pseudorandom Function 13 63 6. The TLS Record Protocol 14 64 6.1. Connection States 15 65 6.2. Record layer 17 66 6.2.1. Fragmentation 17 67 6.2.2. Record Compression and Decompression 19 68 6.2.3. Record Payload Protection 19 69 6.2.3.1. Null or Standard Stream Cipher 20 70 6.2.3.2. CBC Block Cipher 21 71 6.2.3.3. AEAD ciphers 23 72 6.3. Key Calculation 24 73 7. The TLS Handshaking Protocols 25 74 7.1. Change Cipher Spec Protocol 25 75 7.2. Alert Protocol 26 76 7.2.1. Closure Alerts 27 77 7.2.2. Error Alerts 28 78 7.3. Handshake Protocol Overview 31 79 7.4. Handshake Protocol 34 80 7.4.1. Hello Messages 35 81 7.4.1.1. Hello Request 36 82 7.4.1.2. Client Hello 36 83 7.4.1.3. Server Hello 39 84 7.4.1.4 Hello Extensions 41 85 7.4.1.4.1 Signature Hash Algorithms 42 86 7.4.2. Server Certificate 43 87 7.4.3. Server Key Exchange Message 46 88 7.4.4. Certificate Request 49 89 7.4.5 Server hello done 50 90 7.4.6. Client Certificate 51 91 7.4.7. Client Key Exchange Message 52 92 7.4.7.1. RSA Encrypted Premaster Secret Message 53 93 7.4.7.2. Client Diffie-Hellman Public Value 55 94 7.4.8. Certificate verify 56 95 7.4.9. Finished 57 96 8. Cryptographic Computations 58 97 8.1. Computing the Master Secret 58 98 8.1.1. RSA 59 99 8.1.2. Diffie-Hellman 59 100 9. Mandatory Cipher Suites 59 101 10. Application Data Protocol 59 102 11. Security Considerations 59 103 12. IANA Considerations 59 104 A. Protocol Constant Values 62 105 A.1. Record Layer 62 106 A.2. Change Cipher Specs Message 63 107 A.3. Alert Messages 63 108 A.4. Handshake Protocol 65 109 A.4.1. Hello Messages 65 110 A.4.2. Server Authentication and Key Exchange Messages 67 111 A.4.3. Client Authentication and Key Exchange Messages 68 112 A.4.4. Handshake Finalization Message 68 113 A.5. The CipherSuite 69 114 A.6. The Security Parameters 71 115 B. Glossary 73 116 C. CipherSuite Definitions 77 117 D. Implementation Notes 79 118 D.1 Random Number Generation and Seeding 79 119 D.2 Certificates and Authentication 79 120 D.3 CipherSuites 79 121 D.4 Implementation Pitfalls 79 122 E. Backward Compatibility 82 123 E.1 Compatibility with TLS 1.0/1.1 and SSL 3.0 82 124 E.2 Compatibility with SSL 2.0 83 125 E.3. Avoiding Man-in-the-Middle Version Rollback 85 126 F. Security Analysis 86 127 F.1. Handshake Protocol 86 128 F.1.1. Authentication and Key Exchange 86 129 F.1.1.1. Anonymous Key Exchange 86 130 F.1.1.2. RSA Key Exchange and Authentication 87 131 F.1.1.3. Diffie-Hellman Key Exchange with Authentication 87 132 F.1.2. Version Rollback Attacks 88 133 F.1.3. Detecting Attacks Against the Handshake Protocol 89 134 F.1.4. Resuming Sessions 89 135 F.2. Protecting Application Data 89 136 F.3. Explicit IVs 90 137 F.4. Security of Composite Cipher Modes 90 138 F.5 Denial of Service 91 139 F.6 Final Notes 92 141 1. Introduction 143 The primary goal of the TLS Protocol is to provide privacy and data 144 integrity between two communicating applications. The protocol is 145 composed of two layers: the TLS Record Protocol and the TLS Handshake 146 Protocol. At the lowest level, layered on top of some reliable 147 transport protocol (e.g., TCP[TCP]), is the TLS Record Protocol. The 148 TLS Record Protocol provides connection security that has two basic 149 properties: 151 - The connection is private. Symmetric cryptography is used for 152 data encryption (e.g., DES [DES], RC4 [SCH] etc.). The keys for 153 this symmetric encryption are generated uniquely for each 154 connection and are based on a secret negotiated by another 155 protocol (such as the TLS Handshake Protocol). The Record 156 Protocol can also be used without encryption. 158 - The connection is reliable. Message transport includes a message 159 integrity check using a keyed MAC. Secure hash functions (e.g., 160 SHA, MD5, etc.) are used for MAC computations. The Record 161 Protocol can operate without a MAC, but is generally only used in 162 this mode while another protocol is using the Record Protocol as 163 a transport for negotiating security parameters. 165 The TLS Record Protocol is used for encapsulation of various higher- 166 level protocols. One such encapsulated protocol, the TLS Handshake 167 Protocol, allows the server and client to authenticate each other and 168 to negotiate an encryption algorithm and cryptographic keys before 169 the application protocol transmits or receives its first byte of 170 data. The TLS Handshake Protocol provides connection security that 171 has three basic properties: 173 - The peer's identity can be authenticated using asymmetric, or 174 public key, cryptography (e.g., RSA [RSA], DSS [DSS], etc.). This 175 authentication can be made optional, but is generally required 176 for at least one of the peers. 178 - The negotiation of a shared secret is secure: the negotiated 179 secret is unavailable to eavesdroppers, and for any authenticated 180 connection the secret cannot be obtained, even by an attacker who 181 can place himself in the middle of the connection. 183 - The negotiation is reliable: no attacker can modify the 184 negotiation communication without being detected by the parties 185 to the communication. 187 One advantage of TLS is that it is application protocol independent. 188 Higher-level protocols can layer on top of the TLS Protocol 189 transparently. The TLS standard, however, does not specify how 190 protocols add security with TLS; the decisions on how to initiate TLS 191 handshaking and how to interpret the authentication certificates 192 exchanged are left to the judgment of the designers and implementors 193 of protocols that run on top of TLS. 195 1.1 Requirements Terminology 197 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 198 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 199 document are to be interpreted as described in RFC 2119 [REQ]. 201 1.2 Major Differences from TLS 1.1 203 This document is a revision of the TLS 1.1 [TLS1.1] protocol which 204 contains improved flexibility, particularly for negotiation of 205 cryptographic algorithms. The major changes are: 207 - Merged in TLS Extensions definition and AES Cipher Suites from 208 external documents [TLSEXT] and [TLSAES]. 210 - Replacement of MD5/SHA-1 combination in the PRF. Addition 211 of cipher-suite specified PRFs. 213 - Replacement of MD5/SHA-1 combination in the digitally-signed 214 element. 216 - Substantial cleanup to the clients and servers ability to 217 specify which digest and signature algorithms they will 218 accept. Note that this also relaxes some of the constraints 219 on signature and digest algorithms from previous versions of 220 TLS. 222 - Addition of support for authenticated encryption with additional 223 data modes. 225 - Tightened up a number of requirements. 227 - Added some guidance that DH groups should be checked for size. 229 - Cleaned up description of Bleichenbacher/Klima attack defenses. 231 - Tighter checking of EncryptedPreMasterSecret version numbers. 233 - Stronger language about when alerts MUST be sent. 235 - Added an Implementation Pitfalls sections 237 - Harmonized the requirement to send an empty certificate list 238 after certificate_request even when no certs are available. 240 - Made the verify_data length depend on the cipher suite. 242 - TLS_RSA_WITH_AES_128_CBC_SHA is now the mandatory to implement 243 cipher suite. 245 - The usual clarifications and editorial work. 247 2. Goals 249 The goals of TLS Protocol, in order of their priority, are as 250 follows: 252 1. Cryptographic security: TLS should be used to establish a secure 253 connection between two parties. 255 2. Interoperability: Independent programmers should be able to 256 develop applications utilizing TLS that can successfully exchange 257 cryptographic parameters without knowledge of one another's code. 259 3. Extensibility: TLS seeks to provide a framework into which new 260 public key and bulk encryption methods can be incorporated as 261 necessary. This will also accomplish two sub-goals: preventing 262 the need to create a new protocol (and risking the introduction 263 of possible new weaknesses) and avoiding the need to implement an 264 entire new security library. 266 4. Relative efficiency: Cryptographic operations tend to be highly 267 CPU intensive, particularly public key operations. For this 268 reason, the TLS protocol has incorporated an optional session 269 caching scheme to reduce the number of connections that need to 270 be established from scratch. Additionally, care has been taken to 271 reduce network activity. 273 3. Goals of This Document 275 This document and the TLS protocol itself are based on the SSL 3.0 276 Protocol Specification as published by Netscape. The differences 277 between this protocol and SSL 3.0 are not dramatic, but they are 278 significant enough that the various versions of TLS and SSL 3.0 do 279 not interoperate (although each protocol incorporates a mechanism by 280 which an implementation can back down to prior versions). This 281 document is intended primarily for readers who will be implementing 282 the protocol and for those doing cryptographic analysis of it. The 283 specification has been written with this in mind, and it is intended 284 to reflect the needs of those two groups. For that reason, many of 285 the algorithm-dependent data structures and rules are included in the 286 body of the text (as opposed to in an appendix), providing easier 287 access to them. 289 This document is not intended to supply any details of service 290 definition or of interface definition, although it does cover select 291 areas of policy as they are required for the maintenance of solid 292 security. 294 4. Presentation Language 296 This document deals with the formatting of data in an external 297 representation. The following very basic and somewhat casually 298 defined presentation syntax will be used. The syntax draws from 299 several sources in its structure. Although it resembles the 300 programming language "C" in its syntax and XDR [XDR] in both its 301 syntax and intent, it would be risky to draw too many parallels. The 302 purpose of this presentation language is to document TLS only; it has 303 no general application beyond that particular goal. 305 4.1. Basic Block Size 307 The representation of all data items is explicitly specified. The 308 basic data block size is one byte (i.e., 8 bits). Multiple byte data 309 items are concatenations of bytes, from left to right, from top to 310 bottom. From the bytestream, a multi-byte item (a numeric in the 311 example) is formed (using C notation) by: 313 value = (byte[0] << 8*(n-1)) | (byte[1] << 8*(n-2)) | 314 ... | byte[n-1]; 316 This byte ordering for multi-byte values is the commonplace network 317 byte order or big endian format. 319 4.2. Miscellaneous 321 Comments begin with "/*" and end with "*/". 323 Optional components are denoted by enclosing them in "[[ ]]" double 324 brackets. 326 Single-byte entities containing uninterpreted data are of type 327 opaque. 329 4.3. Vectors 331 A vector (single dimensioned array) is a stream of homogeneous data 332 elements. The size of the vector may be specified at documentation 333 time or left unspecified until runtime. In either case, the length 334 declares the number of bytes, not the number of elements, in the 335 vector. The syntax for specifying a new type, T', that is a fixed- 336 length vector of type T is 337 T T'[n]; 339 Here, T' occupies n bytes in the data stream, where n is a multiple 340 of the size of T. The length of the vector is not included in the 341 encoded stream. 343 In the following example, Datum is defined to be three consecutive 344 bytes that the protocol does not interpret, while Data is three 345 consecutive Datum, consuming a total of nine bytes. 347 opaque Datum[3]; /* three uninterpreted bytes */ 348 Datum Data[9]; /* 3 consecutive 3 byte vectors */ 350 Variable-length vectors are defined by specifying a subrange of legal 351 lengths, inclusively, using the notation . When 352 these are encoded, the actual length precedes the vector's contents 353 in the byte stream. The length will be in the form of a number 354 consuming as many bytes as required to hold the vector's specified 355 maximum (ceiling) length. A variable-length vector with an actual 356 length field of zero is referred to as an empty vector. 358 T T'; 360 In the following example, mandatory is a vector that must contain 361 between 300 and 400 bytes of type opaque. It can never be empty. The 362 actual length field consumes two bytes, a uint16, sufficient to 363 represent the value 400 (see Section 4.4). On the other hand, longer 364 can represent up to 800 bytes of data, or 400 uint16 elements, and it 365 may be empty. Its encoding will include a two-byte actual length 366 field prepended to the vector. The length of an encoded vector must 367 be an even multiple of the length of a single element (for example, a 368 17-byte vector of uint16 would be illegal). 370 opaque mandatory<300..400>; 371 /* length field is 2 bytes, cannot be empty */ 372 uint16 longer<0..800>; 373 /* zero to 400 16-bit unsigned integers */ 375 4.4. Numbers 377 The basic numeric data type is an unsigned byte (uint8). All larger 378 numeric data types are formed from fixed-length series of bytes 379 concatenated as described in Section 4.1 and are also unsigned. The 380 following numeric types are predefined. 382 uint8 uint16[2]; 383 uint8 uint24[3]; 384 uint8 uint32[4]; 385 uint8 uint64[8]; 387 All values, here and elsewhere in the specification, are stored in 388 "network" or "big-endian" order; the uint32 represented by the hex 389 bytes 01 02 03 04 is equivalent to the decimal value 16909060. 391 Note that in some cases (e.g., DH parameters) it is necessary to 392 represent integers as opaque vectors. In such cases, they are 393 represented as unsigned integers (i.e., leading zero octets are not 394 required even if the most significant bit is set). 396 4.5. Enumerateds 398 An additional sparse data type is available called enum. A field of 399 type enum can only assume the values declared in the definition. 400 Each definition is a different type. Only enumerateds of the same 401 type may be assigned or compared. Every element of an enumerated must 402 be assigned a value, as demonstrated in the following example. Since 403 the elements of the enumerated are not ordered, they can be assigned 404 any unique value, in any order. 406 enum { e1(v1), e2(v2), ... , en(vn) [[, (n)]] } Te; 408 Enumerateds occupy as much space in the byte stream as would its 409 maximal defined ordinal value. The following definition would cause 410 one byte to be used to carry fields of type Color. 412 enum { red(3), blue(5), white(7) } Color; 414 One may optionally specify a value without its associated tag to 415 force the width definition without defining a superfluous element. 416 In the following example, Taste will consume two bytes in the data 417 stream but can only assume the values 1, 2, or 4. 419 enum { sweet(1), sour(2), bitter(4), (32000) } Taste; 421 The names of the elements of an enumeration are scoped within the 422 defined type. In the first example, a fully qualified reference to 423 the second element of the enumeration would be Color.blue. Such 424 qualification is not required if the target of the assignment is well 425 specified. 427 Color color = Color.blue; /* overspecified, legal */ 428 Color color = blue; /* correct, type implicit */ 430 For enumerateds that are never converted to external representation, 431 the numerical information may be omitted. 433 enum { low, medium, high } Amount; 435 4.6. Constructed Types 437 Structure types may be constructed from primitive types for 438 convenience. Each specification declares a new, unique type. The 439 syntax for definition is much like that of C. 441 struct { 442 T1 f1; 443 T2 f2; 444 ... 445 Tn fn; 446 } [[T]]; 448 The fields within a structure may be qualified using the type's name, 449 with a syntax much like that available for enumerateds. For example, 450 T.f2 refers to the second field of the previous declaration. 451 Structure definitions may be embedded. 453 4.6.1. Variants 455 Defined structures may have variants based on some knowledge that is 456 available within the environment. The selector must be an enumerated 457 type that defines the possible variants the structure defines. There 458 must be a case arm for every element of the enumeration declared in 459 the select. The body of the variant structure may be given a label 460 for reference. The mechanism by which the variant is selected at 461 runtime is not prescribed by the presentation language. 463 struct { 464 T1 f1; 465 T2 f2; 466 .... 467 Tn fn; 468 select (E) { 469 case e1: Te1; 470 case e2: Te2; 471 .... 472 case en: Ten; 473 } [[fv]]; 474 } [[Tv]]; 476 For example: 478 enum { apple, orange } VariantTag; 479 struct { 480 uint16 number; 481 opaque string<0..10>; /* variable length */ 482 } V1; 483 struct { 484 uint32 number; 485 opaque string[10]; /* fixed length */ 486 } V2; 487 struct { 488 select (VariantTag) { /* value of selector is implicit */ 489 case apple: V1; /* VariantBody, tag = apple */ 490 case orange: V2; /* VariantBody, tag = orange */ 491 } variant_body; /* optional label on variant */ 492 } VariantRecord; 494 Variant structures may be qualified (narrowed) by specifying a value 495 for the selector prior to the type. For example, an 497 orange VariantRecord 499 is a narrowed type of a VariantRecord containing a variant_body of 500 type V2. 502 4.7. Cryptographic Attributes 504 The five cryptographic operations digital signing, stream cipher 505 encryption, block cipher encryption, authenticated encryption with 506 additional data (AEAD) encryption and public key encryption are 507 designated digitally-signed, stream-ciphered, block-ciphered, aead- 508 ciphered, and public-key-encrypted, respectively. A field's 509 cryptographic processing is specified by prepending an appropriate 510 key word designation before the field's type specification. 511 Cryptographic keys are implied by the current session state (see 512 Section 6.1). 514 In digital signing, one-way hash functions are used as input for a 515 signing algorithm. A digitally-signed element is encoded as an opaque 516 vector <0..2^16-1>, where the length is specified by the signing 517 algorithm and key. 519 In RSA signing, the opaque vector contains the signature generated 520 using the RSASSA-PKCS1-v1_5 signature scheme defined in [PKCS1]. As 521 discussed in [PKCS1], the DigestInfo MUST be DER encoded and for 522 digest algorithms without parameters (which include SHA-1) the 523 DigestInfo.AlgorithmIdentifier.parameters field MUST be NULL but 524 implementations MUST accept both without parameters and with NULL 525 parameters. Note that earlier versions of TLS used a different RSA 526 signature scheme which did not include a DigestInfo encoding. 528 In DSS, the 20 bytes of the SHA-1 hash are run directly through the 529 Digital Signing Algorithm with no additional hashing. This produces 530 two values, r and s. The DSS signature is an opaque vector, as above, 531 the contents of which are the DER encoding of: 533 Dss-Sig-Value ::= SEQUENCE { 534 r INTEGER, 535 s INTEGER 536 } 538 Note: In current terminology, DSA refers to the Digital Signature 539 Algorithm and DSS refers to the NIST standard. For historical 540 reasons, this document uses DSS and DSA interchangeably 541 to refer to the DSA algorithm, as was done in SSLv3. 543 In stream cipher encryption, the plaintext is exclusive-ORed with an 544 identical amount of output generated from a cryptographically secure 545 keyed pseudorandom number generator. 547 In block cipher encryption, every block of plaintext encrypts to a 548 block of ciphertext. All block cipher encryption is done in CBC 549 (Cipher Block Chaining) mode, and all items that are block-ciphered 550 will be an exact multiple of the cipher block length. 552 In AEAD encryption, the plaintext is simultaneously encrypted and 553 integrity protected. The input may be of any length and the output is 554 generally larger than the input in order to accomodate the integrity 555 check value. 557 In public key encryption, a public key algorithm is used to encrypt 558 data in such a way that it can be decrypted only with the matching 559 private key. A public-key-encrypted element is encoded as an opaque 560 vector <0..2^16-1>, where the length is specified by the encryption 561 algorithm and key. 563 RSA encryption is done using the RSAES-PKCS1-v1_5 encryption scheme 564 defined in [PKCS1]. 566 In the following example 568 stream-ciphered struct { 569 uint8 field1; 570 uint8 field2; 571 digitally-signed opaque hash[20]; 572 } UserType; 574 the contents of hash are used as input for the signing algorithm, and 575 then the entire structure is encrypted with a stream cipher. The 576 length of this structure, in bytes, would be equal to two bytes for 577 field1 and field2, plus two bytes for the length of the signature, 578 plus the length of the output of the signing algorithm. This is known 579 because the algorithm and key used for the signing are known prior to 580 encoding or decoding this structure. 582 4.8. Constants 584 Typed constants can be defined for purposes of specification by 585 declaring a symbol of the desired type and assigning values to it. 586 Under-specified types (opaque, variable length vectors, and 587 structures that contain opaque) cannot be assigned values. No fields 588 of a multi-element structure or vector may be elided. 590 For example: 592 struct { 593 uint8 f1; 594 uint8 f2; 595 } Example1; 597 Example1 ex1 = {1, 4}; /* assigns f1 = 1, f2 = 4 */ 599 5. HMAC and the Pseudorandom Function 601 The TLS record layer uses a keyed Message Authentication Code (MAC) 602 to protect message integrity. The cipher suites defined in this 603 document use a construction known as HMAC, described in [HMAC], which 604 is based on a hash function. Other cipher suites MAY define their own 605 MAC constructions, if needed. 607 In addition, a construction is required to do expansion of secrets 608 into blocks of data for the purposes of key generation or validation. 609 This pseudo-random function (PRF) takes as input a secret, a seed, 610 and an identifying label and produces an output of arbitrary length. 612 In this section, we define one PRF, based on HMAC. This PRF with the 613 SHA-256 hash function is used for all cipher suites defined in this 614 document and in TLS documents published prior to this document when 615 TLS 1.2 is negotiated. New cipher suites MUST explicitly specify a 616 PRF and in general SHOULD use the TLS PRF with SHA-256 or a stronger 617 standard hash function. 619 First, we define a data expansion function, P_hash(secret, data) that 620 uses a single hash function to expand a secret and seed into an 621 arbitrary quantity of output: 623 P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + 624 HMAC_hash(secret, A(2) + seed) + 625 HMAC_hash(secret, A(3) + seed) + ... 627 Where + indicates concatenation. 629 A() is defined as: 630 A(0) = seed 631 A(i) = HMAC_hash(secret, A(i-1)) 633 P_hash can be iterated as many times as is necessary to produce the 634 required quantity of data. For example, if P_SHA-1 is being used to 635 create 64 bytes of data, it will have to be iterated 4 times (through 636 A(4)), creating 80 bytes of output data; the last 16 bytes of the 637 final iteration will then be discarded, leaving 64 bytes of output 638 data. 640 TLS's PRF is created by applying P_hash to the secret as: 642 PRF(secret, label, seed) = P_(secret, label + seed) 644 The label is an ASCII string. It should be included in the exact form 645 it is given without a length byte or trailing null character. For 646 example, the label "slithy toves" would be processed by hashing the 647 following bytes: 649 73 6C 69 74 68 79 20 74 6F 76 65 73 651 6. The TLS Record Protocol 653 The TLS Record Protocol is a layered protocol. At each layer, 654 messages may include fields for length, description, and content. 655 The Record Protocol takes messages to be transmitted, fragments the 656 data into manageable blocks, optionally compresses the data, applies 657 a MAC, encrypts, and transmits the result. Received data is 658 decrypted, verified, decompressed, reassembled, and then delivered to 659 higher-level clients. 661 Four record protocol clients are described in this document: the 662 handshake protocol, the alert protocol, the change cipher spec 663 protocol, and the application data protocol. In order to allow 664 extension of the TLS protocol, additional record types can be 665 supported by the record protocol. New record type values are assigned 666 by IANA as described in Section 12. 668 Implementations MUST NOT send record types not defined in this 669 document unless negotiated by some extension. If a TLS 670 implementation receives an unexpected record type, it MUST send an 671 unexpected_message alert. 673 Any protocol designed for use over TLS MUST be carefully designed to 674 deal with all possible attacks against it. Note that because the 675 type and length of a record are not protected by encryption, care 676 SHOULD be taken to minimize the value of traffic analysis of these 677 values. 679 6.1. Connection States 681 A TLS connection state is the operating environment of the TLS Record 682 Protocol. It specifies a compression algorithm, an encryption 683 algorithm, and a MAC algorithm. In addition, the parameters for these 684 algorithms are known: the MAC secret and the bulk encryption keys for 685 the connection in both the read and the write directions. Logically, 686 there are always four connection states outstanding: the current read 687 and write states, and the pending read and write states. All records 688 are processed under the current read and write states. The security 689 parameters for the pending states can be set by the TLS Handshake 690 Protocol, and the Change Cipher Spec can selectively make either of 691 the pending states current, in which case the appropriate current 692 state is disposed of and replaced with the pending state; the pending 693 state is then reinitialized to an empty state. It is illegal to make 694 a state that has not been initialized with security parameters a 695 current state. The initial current state always specifies that no 696 encryption, compression, or MAC will be used. 698 The security parameters for a TLS Connection read and write state are 699 set by providing the following values: 701 connection end 702 Whether this entity is considered the "client" or the "server" in 703 this connection. 705 bulk encryption algorithm 706 An algorithm to be used for bulk encryption. This specification 707 includes the key size of this algorithm, how much of that key is 708 secret, whether it is a block, stream, or AEAD cipher, and the 709 block size and fixed initialization vector size of the cipher (if 710 appropriate). 712 MAC algorithm 713 An algorithm to be used for message authentication. This 714 specification includes the size of the value returned by the MAC 715 algorithm. 717 compression algorithm 718 An algorithm to be used for data compression. This specification 719 must include all information the algorithm requires to do 720 compression. 722 master secret 723 A 48-byte secret shared between the two peers in the connection. 725 client random 726 A 32-byte value provided by the client. 728 server random 729 A 32-byte value provided by the server. 731 These parameters are defined in the presentation language as: 733 enum { server, client } ConnectionEnd; 735 enum { null, rc4, rc2, des, 3des, idea, aes } 736 BulkCipherAlgorithm; 738 enum { stream, block, aead } CipherType; 740 enum { null, hmac_md5, hmac_sha, hmac_sha256, hmac_sha384, 741 hmac_sha512} MACAlgorithm; 743 /* The use of "sha" above is historical and denotes SHA-1 */ 745 enum { null(0), (255) } CompressionMethod; 747 /* The algorithms specified in CompressionMethod, 748 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 750 struct { 751 ConnectionEnd entity; 752 BulkCipherAlgorithm bulk_cipher_algorithm; 753 CipherType cipher_type; 754 uint8 enc_key_length; 755 uint8 block_length; 756 uint8 fixed_iv_length; 757 uint8 record_iv_length; 758 MACAlgorithm mac_algorithm; 759 uint8 mac_length; 760 uint8 mac_key_length; 761 uint8 verify_data_length; 762 CompressionMethod compression_algorithm; 763 opaque master_secret[48]; 764 opaque client_random[32]; 765 opaque server_random[32]; 766 } SecurityParameters; 768 The record layer will use the security parameters to generate the 769 following six items: 771 client write MAC secret 772 server write MAC secret 773 client write key 774 server write key 775 client write IV 776 server write IV 778 The client write parameters are used by the server when receiving and 779 processing records and vice-versa. The algorithm used for generating 780 these items from the security parameters is described in Section 6.3. 782 Once the security parameters have been set and the keys have been 783 generated, the connection states can be instantiated by making them 784 the current states. These current states MUST be updated for each 785 record processed. Each connection state includes the following 786 elements: 788 compression state 789 The current state of the compression algorithm. 791 cipher state 792 The current state of the encryption algorithm. This will consist 793 of the scheduled key for that connection. For stream ciphers, 794 this will also contain whatever state information is necessary to 795 allow the stream to continue to encrypt or decrypt data. 797 MAC secret 798 The MAC secret for this connection, as generated above. 800 sequence number 801 Each connection state contains a sequence number, which is 802 maintained separately for read and write states. The sequence 803 number MUST be set to zero whenever a connection state is made 804 the active state. Sequence numbers are of type uint64 and may not 805 exceed 2^64-1. Sequence numbers do not wrap. If a TLS 806 implementation would need to wrap a sequence number, it must 807 renegotiate instead. A sequence number is incremented after each 808 record: specifically, the first record transmitted under a 809 particular connection state MUST use sequence number 0. 811 6.2. Record layer 813 The TLS Record Layer receives uninterpreted data from higher layers 814 in non-empty blocks of arbitrary size. 816 6.2.1. Fragmentation 818 The record layer fragments information blocks into TLSPlaintext 819 records carrying data in chunks of 2^14 bytes or less. Client message 820 boundaries are not preserved in the record layer (i.e., multiple 821 client messages of the same ContentType MAY be coalesced into a 822 single TLSPlaintext record, or a single message MAY be fragmented 823 across several records). 825 struct { 826 uint8 major, minor; 827 } ProtocolVersion; 829 enum { 830 change_cipher_spec(20), alert(21), handshake(22), 831 application_data(23), (255) 832 } ContentType; 834 struct { 835 ContentType type; 836 ProtocolVersion version; 837 uint16 length; 838 opaque fragment[TLSPlaintext.length]; 839 } TLSPlaintext; 841 type 842 The higher-level protocol used to process the enclosed fragment. 844 version 845 The version of the protocol being employed. This document 846 describes TLS Version 1.2, which uses the version { 3, 3 }. The 847 version value 3.3 is historical, deriving from the use of 3.1 for 848 TLS 1.0. (See Appendix A.1). Note that a client that supports 849 multiple versions of TLS may not know what version will be 850 employed before it receives ServerHello. See Appendix E for 851 discussion about what record layer version number should be 852 employed for ClientHello. 854 length 855 The length (in bytes) of the following TLSPlaintext.fragment. 856 The length MUST NOT exceed 2^14. 858 fragment 859 The application data. This data is transparent and treated as an 860 independent block to be dealt with by the higher-level protocol 861 specified by the type field. 863 Implementations MUST NOT send zero-length fragments of Handshake, 864 Alert, or Change Cipher Spec content types. Zero-length fragments 865 of Application data MAY be sent as they are potentially useful as 866 a traffic analysis countermeasure. 868 Note: Data of different TLS Record layer content types MAY be 869 interleaved. Application data is generally of lower precedence 870 for transmission than other content types. However, records MUST 871 be delivered to the network in the same order as they are 872 protected by the record layer. Recipients MUST receive and 873 process interleaved application layer traffic during handshakes 874 subsequent to the first one on a connection. 876 6.2.2. Record Compression and Decompression 878 All records are compressed using the compression algorithm defined in 879 the current session state. There is always an active compression 880 algorithm; however, initially it is defined as 881 CompressionMethod.null. The compression algorithm translates a 882 TLSPlaintext structure into a TLSCompressed structure. Compression 883 functions are initialized with default state information whenever a 884 connection state is made active. 886 Compression must be lossless and may not increase the content length 887 by more than 1024 bytes. If the decompression function encounters a 888 TLSCompressed.fragment that would decompress to a length in excess of 889 2^14 bytes, it MUST report a fatal decompression failure error. 891 struct { 892 ContentType type; /* same as TLSPlaintext.type */ 893 ProtocolVersion version;/* same as TLSPlaintext.version */ 894 uint16 length; 895 opaque fragment[TLSCompressed.length]; 896 } TLSCompressed; 898 length 899 The length (in bytes) of the following TLSCompressed.fragment. 900 The length MUST NOT exceed 2^14 + 1024. 902 fragment 903 The compressed form of TLSPlaintext.fragment. 905 Note: A CompressionMethod.null operation is an identity operation; no 906 fields are altered. 908 Implementation note: 909 Decompression functions are responsible for ensuring that 910 messages cannot cause internal buffer overflows. 912 6.2.3. Record Payload Protection 913 The encryption and MAC functions translate a TLSCompressed structure 914 into a TLSCiphertext. The decryption functions reverse the process. 915 The MAC of the record also includes a sequence number so that 916 missing, extra, or repeated messages are detectable. 918 struct { 919 ContentType type; 920 ProtocolVersion version; 921 uint16 length; 922 select (SecurityParameters.cipher_type) { 923 case stream: GenericStreamCipher; 924 case block: GenericBlockCipher; 925 case aead: GenericAEADCipher; 926 } fragment; 927 } TLSCiphertext; 929 type 930 The type field is identical to TLSCompressed.type. 932 version 933 The version field is identical to TLSCompressed.version. 935 length 936 The length (in bytes) of the following TLSCiphertext.fragment. 937 The length MUST NOT exceed 2^14 + 2048. 939 fragment 940 The encrypted form of TLSCompressed.fragment, with the MAC. 942 6.2.3.1. Null or Standard Stream Cipher 944 Stream ciphers (including BulkCipherAlgorithm.null, see Appendix A.6) 945 convert TLSCompressed.fragment structures to and from stream 946 TLSCiphertext.fragment structures. 948 stream-ciphered struct { 949 opaque content[TLSCompressed.length]; 950 opaque MAC[SecurityParameters.mac_length]; 951 } GenericStreamCipher; 953 The MAC is generated as: 955 MAC(MAC_write_secret, seq_num + TLSCompressed.type + 956 TLSCompressed.version + TLSCompressed.length + 957 TLSCompressed.fragment); 959 where "+" denotes concatenation. 961 seq_num 962 The sequence number for this record. 964 MAC 965 The MAC algorithm specified by SecurityParameters.mac_algorithm. 967 Note that the MAC is computed before encryption. The stream cipher 968 encrypts the entire block, including the MAC. For stream ciphers that 969 do not use a synchronization vector (such as RC4), the stream cipher 970 state from the end of one record is simply used on the subsequent 971 packet. If the CipherSuite is TLS_NULL_WITH_NULL_NULL, encryption 972 consists of the identity operation (i.e., the data is not encrypted, 973 and the MAC size is zero, implying that no MAC is used). 974 TLSCiphertext.length is TLSCompressed.length plus 975 SecurityParameters.mac_length. 977 6.2.3.2. CBC Block Cipher 979 For block ciphers (such as RC2, DES, or AES), the encryption and MAC 980 functions convert TLSCompressed.fragment structures to and from block 981 TLSCiphertext.fragment structures. 983 struct { 984 opaque IV[SecurityParameters.record_iv_length]; 985 block-ciphered struct { 986 opaque content[TLSCompressed.length]; 987 opaque MAC[SecurityParameters.mac_length]; 988 uint8 padding[GenericBlockCipher.padding_length]; 989 uint8 padding_length; 990 }; 991 } GenericBlockCipher; 993 The MAC is generated as described in Section 6.2.3.1. 995 IV 996 The Initialization Vector (IV) SHOULD be chosen at random, and 997 MUST be unpredictable. Note that in versions of TLS prior to 1.1, 998 there was no IV field, and the last ciphertext block of the 999 previous record (the "CBC residue") was used as the IV. This was 1000 changed to prevent the attacks described in [CBCATT]. For block 1001 ciphers, the IV length is of length 1002 SecurityParameters.record_iv_length which is equal to the 1003 SecurityParameters.block_size. 1005 padding 1006 Padding that is added to force the length of the plaintext to be 1007 an integral multiple of the block cipher's block length. The 1008 padding MAY be any length up to 255 bytes, as long as it results 1009 in the TLSCiphertext.length being an integral multiple of the 1010 block length. Lengths longer than necessary might be desirable to 1011 frustrate attacks on a protocol that are based on analysis of the 1012 lengths of exchanged messages. Each uint8 in the padding data 1013 vector MUST be filled with the padding length value. The receiver 1014 MUST check this padding and MUST use the bad_record_mac alert to 1015 indicate padding errors. 1017 padding_length 1018 The padding length MUST be such that the total size of the 1019 GenericBlockCipher structure is a multiple of the cipher's block 1020 length. Legal values range from zero to 255, inclusive. This 1021 length specifies the length of the padding field exclusive of the 1022 padding_length field itself. 1024 The encrypted data length (TLSCiphertext.length) is one more than the 1025 sum of SecurityParameters.block_length, TLSCompressed.length, 1026 SecurityParameters.mac_length, and padding_length. 1028 Example: If the block length is 8 bytes, the content length 1029 (TLSCompressed.length) is 61 bytes, and the MAC length is 20 1030 bytes, then the length before padding is 82 bytes (this does 1031 not include the IV. Thus, the padding length modulo 8 must be 1032 equal to 6 in order to make the total length an even multiple 1033 of 8 bytes (the block length). The padding length can be 6, 1034 14, 22, and so on, through 254. If the padding length were the 1035 minimum necessary, 6, the padding would be 6 bytes, each 1036 containing the value 6. Thus, the last 8 octets of the 1037 GenericBlockCipher before block encryption would be xx 06 06 1038 06 06 06 06 06, where xx is the last octet of the MAC. 1040 Note: With block ciphers in CBC mode (Cipher Block Chaining), 1041 it is critical that the entire plaintext of the record be known 1042 before any ciphertext is transmitted. Otherwise, it is possible 1043 for the attacker to mount the attack described in [CBCATT]. 1045 Implementation Note: Canvel et al. [CBCTIME] have demonstrated a timing 1046 attack on CBC padding based on the time required to compute the 1047 MAC. In order to defend against this attack, implementations MUST 1048 ensure that record processing time is essentially the same 1049 whether or not the padding is correct. In general, the best way 1050 to do this is to compute the MAC even if the padding is 1051 incorrect, and only then reject the packet. For instance, if the 1052 pad appears to be incorrect, the implementation might assume a 1053 zero-length pad and then compute the MAC. This leaves a small 1054 timing channel, since MAC performance depends to some extent on 1055 the size of the data fragment, but it is not believed to be large 1056 enough to be exploitable, due to the large block size of existing 1057 MACs and the small size of the timing signal. 1059 6.2.3.3. AEAD ciphers 1061 For AEAD [AEAD] ciphers (such as [CCM] or [GCM]) the AEAD function 1062 converts TLSCompressed.fragment structures to and from AEAD 1063 TLSCiphertext.fragment structures. 1065 struct { 1066 opaque nonce_explicit[SecurityParameters.record_iv_length]; 1068 aead-ciphered struct { 1069 opaque content[TLSCompressed.length]; 1070 }; 1071 } GenericAEADCipher; 1073 AEAD ciphers take as input a single key, a nonce, a plaintext, and 1074 "additional data" to be included in the authentication check, as 1075 described in Section 2.1 of [AEAD]. The key is either the 1076 client_write_key or the server_write_key. No MAC key is used. 1078 Each AEAD cipher suite has to specify how the nonce supplied to the 1079 AEAD operation is constructed, and what is the length of the 1080 GenericAEADCipher.nonce_explicit part. In many cases, it is 1081 appropriate to use the partially implicit nonce technique described 1082 in Section 3.2.1 of [AEAD]; in this case, the implicit part SHOULD be 1083 derived from key_block as client_write_iv and server_write_iv (as 1084 described in Section 6.3), and the explicit part is included in 1085 GenericAEAEDCipher.nonce_explicit. 1087 The plaintext is the TLSCompressed.fragment. 1089 The additional authenticated data, which we denote as 1090 additional_data, is defined as follows: 1092 additional_data = seq_num + TLSCompressed.type + 1093 TLSCompressed.version + TLSCompressed.length; 1095 Where "+" denotes concatenation. 1097 The aead_output consists of the ciphertext output by the AEAD 1098 encryption operation. The length will generally be larger than 1099 TLSCompressed.length, but by an amount that varies with the AEAD 1100 cipher. Since the ciphers might incorporate padding, the amount of 1101 overhead could vary with different TLSCompressed.length values. Each 1102 AEAD cipher MUST NOT produce an expansion of greater than 1024 bytes. 1103 Symbolically, 1104 AEADEncrypted = AEAD-Encrypt(key, IV, plaintext, 1105 additional_data) 1107 In order to decrypt and verify, the cipher takes as input the key, 1108 IV, the "additional_data", and the AEADEncrypted value. The output is 1109 either the plaintext or an error indicating that the decryption 1110 failed. There is no separate integrity check. I.e., 1112 TLSCompressed.fragment = AEAD-Decrypt(write_key, IV, AEADEncrypted, 1113 additional_data) 1115 If the decryption fails, a fatal bad_record_mac alert MUST be 1116 generated. 1118 6.3. Key Calculation 1120 The Record Protocol requires an algorithm to generate keys, and MAC 1121 secrets from the security parameters provided by the handshake 1122 protocol. 1124 The master secret is hashed into a sequence of secure bytes, which 1125 are assigned to the MAC secrets and keys required by the current 1126 connection state (see Appendix A.6). CipherSpecs require a client 1127 write MAC secret, a server write MAC secret, a client write key, and 1128 a server write key, each of which is generated from the master secret 1129 in that order. Unused values are empty. 1131 When keys and MAC secrets are generated, the master secret is used as 1132 an entropy source. 1134 To generate the key material, compute 1136 key_block = PRF(SecurityParameters.master_secret, 1137 "key expansion", 1138 SecurityParameters.server_random + 1139 SecurityParameters.client_random); 1141 until enough output has been generated. Then the key_block is 1142 partitioned as follows: 1144 client_write_MAC_secret[SecurityParameters.mac_key_length] 1145 server_write_MAC_secret[SecurityParameters.mac_key_length] 1146 client_write_key[SecurityParameters.enc_key_length] 1147 server_write_key[SecurityParameters.enc_key_length] 1148 client_write_IV[SecurityParameters.fixed_iv_length] 1149 server_write_IV[SecurityParameters.fixed_iv_length] 1150 The client_write_IV and server_write_IV are only generated for 1151 implicit nonce techniques as described in Section 3.2.1 of [AEAD]. 1153 Implementation note: 1154 The currently defined cipher suite which requires the most 1155 material is AES_256_CBC_SHA. It requires 2 x 32 byte keys and 2 x 1156 20 byte MAC secrets, for a total 104 bytes of key material. 1158 7. The TLS Handshaking Protocols 1160 TLS has three subprotocols that are used to allow peers to agree 1161 upon security parameters for the record layer, to authenticate 1162 themselves, to instantiate negotiated security parameters, and to 1163 report error conditions to each other. 1165 The Handshake Protocol is responsible for negotiating a session, 1166 which consists of the following items: 1168 session identifier 1169 An arbitrary byte sequence chosen by the server to identify an 1170 active or resumable session state. 1172 peer certificate 1173 X509v3 [PKIX] certificate of the peer. This element of the 1174 state may be null. 1176 compression method 1177 The algorithm used to compress data prior to encryption. 1179 cipher spec 1180 Specifies the bulk data encryption algorithm (such as null, 1181 DES, etc.) and a MAC algorithm (such as MD5 or SHA). It also 1182 defines cryptographic attributes such as the mac_length. (See 1183 Appendix A.6 for formal definition.) 1185 master secret 1186 48-byte secret shared between the client and server. 1188 is resumable 1189 A flag indicating whether the session can be used to initiate 1190 new connections. 1192 These items are then used to create security parameters for use by 1193 the Record Layer when protecting application data. Many connections 1194 can be instantiated using the same session through the resumption 1195 feature of the TLS Handshake Protocol. 1197 7.1. Change Cipher Spec Protocol 1198 The change cipher spec protocol exists to signal transitions in 1199 ciphering strategies. The protocol consists of a single message, 1200 which is encrypted and compressed under the current (not the pending) 1201 connection state. The message consists of a single byte of value 1. 1203 struct { 1204 enum { change_cipher_spec(1), (255) } type; 1205 } ChangeCipherSpec; 1207 The change cipher spec message is sent by both the client and the 1208 server to notify the receiving party that subsequent records will be 1209 protected under the newly negotiated CipherSpec and keys. Reception 1210 of this message causes the receiver to instruct the Record Layer to 1211 immediately copy the read pending state into the read current state. 1212 Immediately after sending this message, the sender MUST instruct the 1213 record layer to make the write pending state the write active state. 1214 (See Section 6.1.) The change cipher spec message is sent during the 1215 handshake after the security parameters have been agreed upon, but 1216 before the verifying finished message is sent. 1218 Note: If a rehandshake occurs while data is flowing on a connection, 1219 the communicating parties may continue to send data using the old 1220 CipherSpec. However, once the ChangeCipherSpec has been sent, the new 1221 CipherSpec MUST be used. The first side to send the ChangeCipherSpec 1222 does not know that the other side has finished computing the new 1223 keying material (e.g., if it has to perform a time consuming public 1224 key operation). Thus, a small window of time, during which the 1225 recipient must buffer the data, MAY exist. In practice, with modern 1226 machines this interval is likely to be fairly short. 1228 7.2. Alert Protocol 1230 One of the content types supported by the TLS Record layer is the 1231 alert type. Alert messages convey the severity of the message and a 1232 description of the alert. Alert messages with a level of fatal result 1233 in the immediate termination of the connection. In this case, other 1234 connections corresponding to the session may continue, but the 1235 session identifier MUST be invalidated, preventing the failed session 1236 from being used to establish new connections. Like other messages, 1237 alert messages are encrypted and compressed, as specified by the 1238 current connection state. 1240 enum { warning(1), fatal(2), (255) } AlertLevel; 1242 enum { 1243 close_notify(0), 1244 unexpected_message(10), 1245 bad_record_mac(20), 1246 decryption_failed_RESERVED(21), 1247 record_overflow(22), 1248 decompression_failure(30), 1249 handshake_failure(40), 1250 no_certificate_RESERVED(41), 1251 bad_certificate(42), 1252 unsupported_certificate(43), 1253 certificate_revoked(44), 1254 certificate_expired(45), 1255 certificate_unknown(46), 1256 illegal_parameter(47), 1257 unknown_ca(48), 1258 access_denied(49), 1259 decode_error(50), 1260 decrypt_error(51), 1261 export_restriction_RESERVED(60), 1262 protocol_version(70), 1263 insufficient_security(71), 1264 internal_error(80), 1265 user_canceled(90), 1266 no_renegotiation(100), 1267 unsupported_extension(110), 1268 (255) 1269 } AlertDescription; 1271 struct { 1272 AlertLevel level; 1273 AlertDescription description; 1274 } Alert; 1276 7.2.1. Closure Alerts 1278 The client and the server must share knowledge that the connection is 1279 ending in order to avoid a truncation attack. Either party may 1280 initiate the exchange of closing messages. 1282 close_notify 1283 This message notifies the recipient that the sender will not send 1284 any more messages on this connection. Note that as of TLS 1.1, 1285 failure to properly close a connection no longer requires that a 1286 session not be resumed. This is a change from TLS 1.0 to conform 1287 with widespread implementation practice. 1289 Either party may initiate a close by sending a close_notify alert. 1290 Any data received after a closure alert is ignored. 1292 Unless some other fatal alert has been transmitted, each party is 1293 required to send a close_notify alert before closing the write side 1294 of the connection. The other party MUST respond with a close_notify 1295 alert of its own and close down the connection immediately, 1296 discarding any pending writes. It is not required for the initiator 1297 of the close to wait for the responding close_notify alert before 1298 closing the read side of the connection. 1300 If the application protocol using TLS provides that any data may be 1301 carried over the underlying transport after the TLS connection is 1302 closed, the TLS implementation must receive the responding 1303 close_notify alert before indicating to the application layer that 1304 the TLS connection has ended. If the application protocol will not 1305 transfer any additional data, but will only close the underlying 1306 transport connection, then the implementation MAY choose to close the 1307 transport without waiting for the responding close_notify. No part of 1308 this standard should be taken to dictate the manner in which a usage 1309 profile for TLS manages its data transport, including when 1310 connections are opened or closed. 1312 Note: It is assumed that closing a connection reliably delivers 1313 pending data before destroying the transport. 1315 7.2.2. Error Alerts 1317 Error handling in the TLS Handshake protocol is very simple. When an 1318 error is detected, the detecting party sends a message to the other 1319 party. Upon transmission or receipt of a fatal alert message, both 1320 parties immediately close the connection. Servers and clients MUST 1321 forget any session-identifiers, keys, and secrets associated with a 1322 failed connection. Thus, any connection terminated with a fatal alert 1323 MUST NOT be resumed. 1325 Whenever an implementation encounters a condition which is defined as 1326 a fatal alert, it MUST send the appropriate alert prior to closing 1327 the connection. In cases where an implementation chooses to send an 1328 alert which may be a warning alert but intends to close the 1329 connection immediately afterwards, it MUST send that alert at the 1330 fatal alert level. 1332 If an alert with a level of warning is sent and received, generally 1333 the connection can continue normally. If the receiving party decides 1334 not to proceed with the connection (e.g., after having received a 1335 no_renegotiation alert that it is not willing to accept), it SHOULD 1336 send a fatal alert to terminate the connection. 1338 The following error alerts are defined: 1340 unexpected_message 1341 An inappropriate message was received. This alert is always fatal 1342 and should never be observed in communication between proper 1343 implementations. 1345 bad_record_mac 1346 This alert is returned if a record is received with an incorrect 1347 MAC. This alert also MUST be returned if an alert is sent because 1348 a TLSCiphertext decrypted in an invalid way: either it wasn't an 1349 even multiple of the block length, or its padding values, when 1350 checked, weren't correct. This message is always fatal. 1352 decryption_failed_RESERVED 1353 This alert was used in some earlier versions of TLS, and may have 1354 permitted certain attacks against the CBC mode [CBCATT]. It MUST 1355 NOT be sent by compliant implementations. 1357 record_overflow 1358 A TLSCiphertext record was received that had a length more than 1359 2^14+2048 bytes, or a record decrypted to a TLSCompressed record 1360 with more than 2^14+1024 bytes. This message is always fatal. 1362 decompression_failure 1363 The decompression function received improper input (e.g., data 1364 that would expand to excessive length). This message is always 1365 fatal. 1367 handshake_failure 1368 Reception of a handshake_failure alert message indicates that the 1369 sender was unable to negotiate an acceptable set of security 1370 parameters given the options available. This is a fatal error. 1372 no_certificate_RESERVED 1373 This alert was used in SSLv3 but not any version of TLS. It MUST 1374 NOT be sent by compliant implementations. 1376 bad_certificate 1377 A certificate was corrupt, contained signatures that did not 1378 verify correctly, etc. 1380 unsupported_certificate 1381 A certificate was of an unsupported type. 1383 certificate_revoked 1384 A certificate was revoked by its signer. 1386 certificate_expired 1387 A certificate has expired or is not currently valid. 1389 certificate_unknown 1390 Some other (unspecified) issue arose in processing the 1391 certificate, rendering it unacceptable. 1393 illegal_parameter 1394 A field in the handshake was out of range or inconsistent with 1395 other fields. This message is always fatal. 1397 unknown_ca 1398 A valid certificate chain or partial chain was received, but the 1399 certificate was not accepted because the CA certificate could not 1400 be located or couldn't be matched with a known, trusted CA. This 1401 message is always fatal. 1403 access_denied 1404 A valid certificate was received, but when access control was 1405 applied, the sender decided not to proceed with negotiation. 1406 This message is always fatal. 1408 decode_error 1409 A message could not be decoded because some field was out of the 1410 specified range or the length of the message was incorrect. This 1411 message is always fatal. 1413 decrypt_error 1414 A handshake cryptographic operation failed, including being 1415 unable to correctly verify a signature, decrypt a key exchange, 1416 or validate a finished message. 1418 export_restriction_RESERVED 1419 This alert was used in some earlier versions of TLS. It MUST NOT 1420 be sent by compliant implementations. 1422 protocol_version 1423 The protocol version the client has attempted to negotiate is 1424 recognized but not supported. (For example, old protocol versions 1425 might be avoided for security reasons). This message is always 1426 fatal. 1428 insufficient_security 1429 Returned instead of handshake_failure when a negotiation has 1430 failed specifically because the server requires ciphers more 1431 secure than those supported by the client. This message is always 1432 fatal. 1434 internal_error 1435 An internal error unrelated to the peer or the correctness of the 1436 protocol (such as a memory allocation failure) makes it 1437 impossible to continue. This message is always fatal. 1439 user_canceled 1440 This handshake is being canceled for some reason unrelated to a 1441 protocol failure. If the user cancels an operation after the 1442 handshake is complete, just closing the connection by sending a 1443 close_notify is more appropriate. This alert should be followed 1444 by a close_notify. This message is generally a warning. 1446 no_renegotiation 1447 Sent by the client in response to a hello request or by the 1448 server in response to a client hello after initial handshaking. 1449 Either of these would normally lead to renegotiation; when that 1450 is not appropriate, the recipient should respond with this alert. 1451 At that point, the original requester can decide whether to 1452 proceed with the connection. One case where this would be 1453 appropriate is where a server has spawned a process to satisfy a 1454 request; the process might receive security parameters (key 1455 length, authentication, etc.) at startup and it might be 1456 difficult to communicate changes to these parameters after that 1457 point. This message is always a warning. 1459 unsupported_extension 1460 sent by clients that receive an extended server hello containing 1461 an extension that they did not put in the corresponding client 1462 hello. This message is always fatal. 1464 For all errors where an alert level is not explicitly specified, the 1465 sending party MAY determine at its discretion whether this is a fatal 1466 error or not; if an alert with a level of warning is received, the 1467 receiving party MAY decide at its discretion whether to treat this as 1468 a fatal error or not. However, all messages that are transmitted 1469 with a level of fatal MUST be treated as fatal messages. 1471 New Alert values are assigned by IANA as described in Section 12. 1473 7.3. Handshake Protocol Overview 1475 The cryptographic parameters of the session state are produced by the 1476 TLS Handshake Protocol, which operates on top of the TLS Record 1477 Layer. When a TLS client and server first start communicating, they 1478 agree on a protocol version, select cryptographic algorithms, 1479 optionally authenticate each other, and use public-key encryption 1480 techniques to generate shared secrets. 1482 The TLS Handshake Protocol involves the following steps: 1484 - Exchange hello messages to agree on algorithms, exchange random 1485 values, and check for session resumption. 1487 - Exchange the necessary cryptographic parameters to allow the 1488 client and server to agree on a premaster secret. 1490 - Exchange certificates and cryptographic information to allow the 1491 client and server to authenticate themselves. 1493 - Generate a master secret from the premaster secret and exchanged 1494 random values. 1496 - Provide security parameters to the record layer. 1498 - Allow the client and server to verify that their peer has 1499 calculated the same security parameters and that the handshake 1500 occurred without tampering by an attacker. 1502 Note that higher layers should not be overly reliant on whether TLS 1503 always negotiates the strongest possible connection between two 1504 peers. There are a number of ways in which a man in the middle 1505 attacker can attempt to make two entities drop down to the least 1506 secure method they support. The protocol has been designed to 1507 minimize this risk, but there are still attacks available: for 1508 example, an attacker could block access to the port a secure service 1509 runs on, or attempt to get the peers to negotiate an unauthenticated 1510 connection. The fundamental rule is that higher levels must be 1511 cognizant of what their security requirements are and never transmit 1512 information over a channel less secure than what they require. The 1513 TLS protocol is secure in that any cipher suite offers its promised 1514 level of security: if you negotiate 3DES with a 1024 bit RSA key 1515 exchange with a host whose certificate you have verified, you can 1516 expect to be that secure. 1518 These goals are achieved by the handshake protocol, which can be 1519 summarized as follows: The client sends a client hello message to 1520 which the server must respond with a server hello message, or else a 1521 fatal error will occur and the connection will fail. The client hello 1522 and server hello are used to establish security enhancement 1523 capabilities between client and server. The client hello and server 1524 hello establish the following attributes: Protocol Version, Session 1525 ID, Cipher Suite, and Compression Method. Additionally, two random 1526 values are generated and exchanged: ClientHello.random and 1527 ServerHello.random. 1529 The actual key exchange uses up to four messages: the server 1530 certificate, the server key exchange, the client certificate, and the 1531 client key exchange. New key exchange methods can be created by 1532 specifying a format for these messages and by defining the use of the 1533 messages to allow the client and server to agree upon a shared 1534 secret. This secret MUST be quite long; currently defined key 1535 exchange methods exchange secrets that range from 46 bytes upwards. 1537 Following the hello messages, the server will send its certificate, 1538 if it is to be authenticated. Additionally, a server key exchange 1539 message may be sent, if it is required (e.g., if their server has no 1540 certificate, or if its certificate is for signing only). If the 1541 server is authenticated, it may request a certificate from the 1542 client, if that is appropriate to the cipher suite selected. Next, 1543 the server will send the server hello done message, indicating that 1544 the hello-message phase of the handshake is complete. The server will 1545 then wait for a client response. If the server has sent a certificate 1546 request message, the client MUST send the certificate message. The 1547 client key exchange message is now sent, and the content of that 1548 message will depend on the public key algorithm selected between the 1549 client hello and the server hello. If the client has sent a 1550 certificate with signing ability, a digitally-signed certificate 1551 verify message is sent to explicitly verify possession of the private 1552 key in the certificate. 1554 At this point, a change cipher spec message is sent by the client, 1555 and the client copies the pending Cipher Spec into the current Cipher 1556 Spec. The client then immediately sends the finished message under 1557 the new algorithms, keys, and secrets. In response, the server will 1558 send its own change cipher spec message, transfer the pending to the 1559 current Cipher Spec, and send its finished message under the new 1560 Cipher Spec. At this point, the handshake is complete, and the client 1561 and server may begin to exchange application layer data. (See flow 1562 chart below.) Application data MUST NOT be sent prior to the 1563 completion of the first handshake (before a cipher suite other than 1564 TLS_NULL_WITH_NULL_NULL is established). 1566 Client Server 1568 ClientHello --------> 1569 ServerHello 1570 Certificate* 1571 ServerKeyExchange* 1572 CertificateRequest* 1573 <-------- ServerHelloDone 1574 Certificate* 1575 ClientKeyExchange 1576 CertificateVerify* 1577 [ChangeCipherSpec] 1578 Finished --------> 1579 [ChangeCipherSpec] 1580 <-------- Finished 1581 Application Data <-------> Application Data 1583 Fig. 1. Message flow for a full handshake 1585 * Indicates optional or situation-dependent messages that are not 1586 always sent. 1588 Note: To help avoid pipeline stalls, ChangeCipherSpec is an 1589 independent TLS Protocol content type, and is not actually a TLS 1590 handshake message. 1592 When the client and server decide to resume a previous session or 1593 duplicate an existing session (instead of negotiating new security 1594 parameters), the message flow is as follows: 1596 The client sends a ClientHello using the Session ID of the session to 1597 be resumed. The server then checks its session cache for a match. If 1598 a match is found, and the server is willing to re-establish the 1599 connection under the specified session state, it will send a 1600 ServerHello with the same Session ID value. At this point, both 1601 client and server MUST send change cipher spec messages and proceed 1602 directly to finished messages. Once the re-establishment is complete, 1603 the client and server MAY begin to exchange application layer data. 1604 (See flow chart below.) If a Session ID match is not found, the 1605 server generates a new session ID and the TLS client and server 1606 perform a full handshake. 1608 Client Server 1610 ClientHello --------> 1611 ServerHello 1612 [ChangeCipherSpec] 1613 <-------- Finished 1614 [ChangeCipherSpec] 1615 Finished --------> 1616 Application Data <-------> Application Data 1618 Fig. 2. Message flow for an abbreviated handshake 1620 The contents and significance of each message will be presented in 1621 detail in the following sections. 1623 7.4. Handshake Protocol 1625 The TLS Handshake Protocol is one of the defined higher-level clients 1626 of the TLS Record Protocol. This protocol is used to negotiate the 1627 secure attributes of a session. Handshake messages are supplied to 1628 the TLS Record Layer, where they are encapsulated within one or more 1629 TLSPlaintext structures, which are processed and transmitted as 1630 specified by the current active session state. 1632 enum { 1633 hello_request(0), client_hello(1), server_hello(2), 1634 certificate(11), server_key_exchange (12), 1635 certificate_request(13), server_hello_done(14), 1636 certificate_verify(15), client_key_exchange(16), 1637 finished(20), (255) 1638 } HandshakeType; 1640 struct { 1641 HandshakeType msg_type; /* handshake type */ 1642 uint24 length; /* bytes in message */ 1643 select (HandshakeType) { 1644 case hello_request: HelloRequest; 1645 case client_hello: ClientHello; 1646 case server_hello: ServerHello; 1647 case certificate: Certificate; 1648 case server_key_exchange: ServerKeyExchange; 1649 case certificate_request: CertificateRequest; 1650 case server_hello_done: ServerHelloDone; 1651 case certificate_verify: CertificateVerify; 1652 case client_key_exchange: ClientKeyExchange; 1653 case finished: Finished; 1654 } body; 1655 } Handshake; 1657 The handshake protocol messages are presented below in the order they 1658 MUST be sent; sending handshake messages in an unexpected order 1659 results in a fatal error. Unneeded handshake messages can be omitted, 1660 however. Note one exception to the ordering: the Certificate message 1661 is used twice in the handshake (from server to client, then from 1662 client to server), but described only in its first position. The one 1663 message that is not bound by these ordering rules is the Hello 1664 Request message, which can be sent at any time, but which SHOULD be 1665 ignored by the client if it arrives in the middle of a handshake. 1667 New Handshake message types are assigned by IANA as described in 1668 Section 12. 1670 7.4.1. Hello Messages 1672 The hello phase messages are used to exchange security enhancement 1673 capabilities between the client and server. When a new session 1674 begins, the Record Layer's connection state encryption, hash, and 1675 compression algorithms are initialized to null. The current 1676 connection state is used for renegotiation messages. 1678 7.4.1.1. Hello Request 1680 When this message will be sent: 1681 The hello request message MAY be sent by the server at any time. 1683 Meaning of this message: 1684 Hello request is a simple notification that the client should 1685 begin the negotiation process anew by sending a client hello 1686 message when convenient. This message is not intended to 1687 establish which side is the client or server but merely to 1688 initiate a new negotiation. Servers SHOULD NOT send a 1689 HelloRequest immediately upon the client's initial connection. 1690 It is the client's job to send a ClientHello at that time. 1692 This message will be ignored by the client if the client is 1693 currently negotiating a session. This message may be ignored by 1694 the client if it does not wish to renegotiate a session, or the 1695 client may, if it wishes, respond with a no_renegotiation alert. 1696 Since handshake messages are intended to have transmission 1697 precedence over application data, it is expected that the 1698 negotiation will begin before no more than a few records are 1699 received from the client. If the server sends a hello request but 1700 does not receive a client hello in response, it may close the 1701 connection with a fatal alert. 1703 After sending a hello request, servers SHOULD NOT repeat the request 1704 until the subsequent handshake negotiation is complete. 1706 Structure of this message: 1707 struct { } HelloRequest; 1709 Note: This message MUST NOT be included in the message hashes that are 1710 maintained throughout the handshake and used in the finished 1711 messages and the certificate verify message. 1713 7.4.1.2. Client Hello 1715 When this message will be sent: 1716 When a client first connects to a server it is required to send 1717 the client hello as its first message. The client can also send a 1718 client hello in response to a hello request or on its own 1719 initiative in order to renegotiate the security parameters in an 1720 existing connection. 1722 Structure of this message: 1723 The client hello message includes a random structure, which is 1724 used later in the protocol. 1726 struct { 1727 uint32 gmt_unix_time; 1728 opaque random_bytes[28]; 1729 } Random; 1731 gmt_unix_time 1732 The current time and date in standard UNIX 32-bit format (seconds 1733 since the midnight starting Jan 1, 1970, GMT, ignoring leap 1734 seconds) according to the sender's internal clock. Clocks are not 1735 required to be set correctly by the basic TLS Protocol; higher- 1736 level or application protocols may define additional 1737 requirements. 1739 random_bytes 1740 28 bytes generated by a secure random number generator. 1742 The client hello message includes a variable-length session 1743 identifier. If not empty, the value identifies a session between the 1744 same client and server whose security parameters the client wishes to 1745 reuse. The session identifier MAY be from an earlier connection, this 1746 connection, or from another currently active connection. The second 1747 option is useful if the client only wishes to update the random 1748 structures and derived values of a connection, and the third option 1749 makes it possible to establish several independent secure connections 1750 without repeating the full handshake protocol. These independent 1751 connections may occur sequentially or simultaneously; a SessionID 1752 becomes valid when the handshake negotiating it completes with the 1753 exchange of Finished messages and persists until it is removed due to 1754 aging or because a fatal error was encountered on a connection 1755 associated with the session. The actual contents of the SessionID are 1756 defined by the server. 1758 opaque SessionID<0..32>; 1760 Warning: 1761 Because the SessionID is transmitted without encryption or 1762 immediate MAC protection, servers MUST NOT place confidential 1763 information in session identifiers or let the contents of fake 1764 session identifiers cause any breach of security. (Note that the 1765 content of the handshake as a whole, including the SessionID, is 1766 protected by the Finished messages exchanged at the end of the 1767 handshake.) 1769 The CipherSuite list, passed from the client to the server in the 1770 client hello message, contains the combinations of cryptographic 1771 algorithms supported by the client in order of the client's 1772 preference (favorite choice first). Each CipherSuite defines a key 1773 exchange algorithm, a bulk encryption algorithm (including secret key 1774 length), a MAC algorithm, and a PRF. The server will select a cipher 1775 suite or, if no acceptable choices are presented, return a handshake 1776 failure alert and close the connection. 1778 uint8 CipherSuite[2]; /* Cryptographic suite selector */ 1780 The client hello includes a list of compression algorithms supported 1781 by the client, ordered according to the client's preference. 1783 enum { null(0), (255) } CompressionMethod; 1785 struct { 1786 ProtocolVersion client_version; 1787 Random random; 1788 SessionID session_id; 1789 CipherSuite cipher_suites<2..2^16-2>; 1790 CompressionMethod compression_methods<1..2^8-1>; 1791 select (extensions_present) { 1792 case false: 1793 struct {}; 1794 case true: 1795 Extension extensions<0..2^16-1>; 1796 }; 1797 } ClientHello; 1799 TLS allows extensions to follow the compression_methods field in an 1800 extensions block. The presence of extensions can be detected by 1801 determining whether there are bytes following the compression_methods 1802 at the end of the ClientHello. Note that this method of detecting 1803 optional data differs from the normal TLS method of having a 1804 variable-length field but is used for compatibility with TLS before 1805 extensions were defined. 1807 client_version 1808 The version of the TLS protocol by which the client wishes to 1809 communicate during this session. This SHOULD be the latest 1810 (highest valued) version supported by the client. For this 1811 version of the specification, the version will be 3.3 (See 1812 Appendix E for details about backward compatibility). 1814 random 1815 A client-generated random structure. 1817 session_id 1818 The ID of a session the client wishes to use for this connection. 1819 This field is empty if no session_id is available, or it the 1820 client wishes to generate new security parameters. 1822 cipher_suites 1823 This is a list of the cryptographic options supported by the 1824 client, with the client's first preference first. If the 1825 session_id field is not empty (implying a session resumption 1826 request) this vector MUST include at least the cipher_suite from 1827 that session. Values are defined in Appendix A.5. 1829 compression_methods 1830 This is a list of the compression methods supported by the 1831 client, sorted by client preference. If the session_id field is 1832 not empty (implying a session resumption request) it MUST include 1833 the compression_method from that session. This vector MUST 1834 contain, and all implementations MUST support, 1835 CompressionMethod.null. Thus, a client and server will always be 1836 able to agree on a compression method. 1838 client_hello_extension_list 1839 Clients MAY request extended functionality from servers by 1840 sending data in the client_hello_extension_list. Here the new 1841 "client_hello_extension_list" field contains a list of 1842 extensions. The actual "Extension" format is defined in Section 1843 7.4.1.4. 1845 In the event that a client requests additional functionality using 1846 extensions, and this functionality is not supplied by the server, the 1847 client MAY abort the handshake. A server that supports the 1848 extensions mechanism MUST accept client hello messages in either the 1849 original (TLS 1.0/TLS 1.1) ClientHello or the extended ClientHello 1850 format defined in this document, and (as for all other messages) MUST 1851 check that the amount of data in the message precisely matches one of 1852 these formats; if not then it MUST send a fatal "decode_error" alert. 1854 After sending the client hello message, the client waits for a server 1855 hello message. Any other handshake message returned by the server 1856 except for a hello request is treated as a fatal error. 1858 7.4.1.3. Server Hello 1860 When this message will be sent: 1861 The server will send this message in response to a client hello 1862 message when it was able to find an acceptable set of algorithms. 1863 If it cannot find such a match, it will respond with a handshake 1864 failure alert. 1866 Structure of this message: 1867 struct { 1868 ProtocolVersion server_version; 1869 Random random; 1870 SessionID session_id; 1871 CipherSuite cipher_suite; 1872 CompressionMethod compression_method; 1873 select (extensions_present) { 1874 case false: 1875 struct {}; 1876 case true: 1877 Extension extensions<0..2^16-1>; 1878 }; 1879 } ServerHello; 1881 The presence of extensions can be detected by determining whether 1882 there are bytes following the compression_method field at the end of 1883 the ServerHello. 1885 server_version 1886 This field will contain the lower of that suggested by the client 1887 in the client hello and the highest supported by the server. For 1888 this version of the specification, the version is 3.3. (See 1889 Appendix E for details about backward compatibility.) 1891 random 1892 This structure is generated by the server and MUST be 1893 independently generated from the ClientHello.random. 1895 session_id 1896 This is the identity of the session corresponding to this 1897 connection. If the ClientHello.session_id was non-empty, the 1898 server will look in its session cache for a match. If a match is 1899 found and the server is willing to establish the new connection 1900 using the specified session state, the server will respond with 1901 the same value as was supplied by the client. This indicates a 1902 resumed session and dictates that the parties must proceed 1903 directly to the finished messages. Otherwise this field will 1904 contain a different value identifying the new session. The server 1905 may return an empty session_id to indicate that the session will 1906 not be cached and therefore cannot be resumed. If a session is 1907 resumed, it must be resumed using the same cipher suite it was 1908 originally negotiated with. Note that there is no requirement 1909 that the server resume any session even if it had formerly 1910 provided a session_id. Client MUST be prepared to do a full 1911 negotiation -- including negotiating new cipher suites -- during 1912 any handshake. 1914 cipher_suite 1915 The single cipher suite selected by the server from the list in 1916 ClientHello.cipher_suites. For resumed sessions, this field is 1917 the value from the state of the session being resumed. 1919 compression_method 1920 The single compression algorithm selected by the server from the 1921 list in ClientHello.compression_methods. For resumed sessions 1922 this field is the value from the resumed session state. 1924 server_hello_extension_list 1925 A list of extensions. Note that only extensions offered by the 1926 client can appear in the server's list. 1928 7.4.1.4 Hello Extensions 1930 The extension format is: 1932 struct { 1933 ExtensionType extension_type; 1934 opaque extension_data<0..2^16-1>; 1935 } Extension; 1937 enum { 1938 signature_hash_algorithms(TBD-BY-IANA), (65535) 1939 } ExtensionType; 1941 Here: 1943 - "extension_type" identifies the particular extension type. 1945 - "extension_data" contains information specific to the particular 1946 extension type. 1948 The initial set of extensions is defined in a companion document 1949 [TLSEXT]. The list of extension types is maintained by IANA as 1950 described in Section 12. 1952 There are subtle (and not so subtle) interactions that may occur in 1953 this protocol between new features and existing features which may 1954 result in a significant reduction in overall security, The following 1955 considerations should be taken into account when designing new 1956 extensions: 1958 - Some cases where a server does not agree to an extension are 1959 error conditions, and some simply a refusal to support a 1960 particular feature. In general error alerts should be used for 1961 the former, and a field in the server extension response for the 1962 latter. 1964 - Extensions should as far as possible be designed to prevent any 1965 attack that forces use (or non-use) of a particular feature by 1966 manipulation of handshake messages. This principle should be 1967 followed regardless of whether the feature is believed to cause a 1968 security problem. 1970 Often the fact that the extension fields are included in the 1971 inputs to the Finished message hashes will be sufficient, but 1972 extreme care is needed when the extension changes the meaning of 1973 messages sent in the handshake phase. Designers and implementors 1974 should be aware of the fact that until the handshake has been 1975 authenticated, active attackers can modify messages and insert, 1976 remove, or replace extensions. 1978 - It would be technically possible to use extensions to change 1979 major aspects of the design of TLS; for example the design of 1980 cipher suite negotiation. This is not recommended; it would be 1981 more appropriate to define a new version of TLS - particularly 1982 since the TLS handshake algorithms have specific protection 1983 against version rollback attacks based on the version number, and 1984 the possibility of version rollback should be a significant 1985 consideration in any major design change. 1987 7.4.1.4.1 Signature Hash Algorithms 1989 The client MAY use the "signature_hash_algorithms" to indicate to the 1990 server which signature/hash algorithm pairs may be used in digital 1991 signatures. The "extension_data" field of this extension contains a 1992 "supported_signature_algorithms" value. 1994 enum{ 1995 none(0), md5(1), sha1(2), sha256(3), sha384(4), 1996 sha512(5), (255) 1997 } HashAlgorithm; 1999 enum { anonymous(0), rsa(1), dsa(2), (255) } SignatureAlgorithm; 2001 struct { 2002 HashAlgorithm hash; 2003 SignatureAlgorithm signature; 2004 } SignatureAndHashAlgorithm; 2006 SignatureAndHashAlgorithm 2007 supported_signature_algorithms<2..2^16-1>; 2009 Each SignatureAndHashAlgorithm value lists a single digest/signature 2010 pair which the client is willing to verify. The values are indicated 2011 in descending order of preference. 2013 Note: Because not all signature algorithms and hash algorithms may be 2014 accepted by an implementation (e.g., DSA with SHA-1, but not 2015 SHA-256), algorithms here are listed in pairs. 2017 hash 2018 This field indicates the hash algorithm which may be used. The 2019 values indicate support for undigested data, MD5 [MD5], SHA-1, 2020 SHA-256, SHA-384, and SHA-512 [SHA] respectively. The "none" 2021 value is provided for future extensibility, in case of a 2022 signature algorithm which does not require hashing before 2023 signing. 2025 signature 2026 This field indicates the signature algorithm which may be used. 2027 The values indicate anonymous signatures, RSA [PKCS1] and DSA 2028 [DSS] respectively. The "anonymous" value is meaningless in this 2029 context but used later in the specification. It MUST NOT appear 2030 in this extension. 2032 The semantics of this extension are somewhat complicated because the 2033 cipher suite indicates permissible signature algorithms but not 2034 digest algorithm. Sections 7.4.2 and 7.4.3 describe the appropriate 2035 rules. 2037 Clients SHOULD send this extension if they support any digest 2038 algorithm other than SHA-1. If this extension is not used, servers 2039 SHOULD assume that the client supports only SHA-1. Note: this is a 2040 change from TLS 1.1 where there are no explicit rules but as a 2041 practical matter one can assume that the peer supports MD5 and SHA-1. 2043 Servers MUST NOT send this extension. 2045 7.4.2. Server Certificate 2047 When this message will be sent: 2048 The server MUST send a certificate whenever the agreed-upon key 2049 exchange method uses certificates for authentication (this 2050 includes all key exchange methods defined in this document except 2051 DH_anon). This message will always immediately follow the server 2052 hello message. 2054 Meaning of this message: 2055 This message conveys the server's certificate to the client. The 2056 certificate MUST be appropriate for the negotiated cipher suite's 2057 key exchange algorithm, and any negotiated extensions. 2059 Structure of this message: 2060 opaque ASN.1Cert<1..2^24-1>; 2061 struct { 2062 ASN.1Cert certificate_list<0..2^24-1>; 2063 } Certificate; 2065 certificate_list 2067 This is a sequence (chain) of certificates. The sender's 2068 certificate MUST come first in the list. Each following 2069 certificate MUST directly certify the one preceding it. Because 2070 certificate validation requires that root keys be distributed 2071 independently, the self-signed certificate that specifies the 2072 root certificate authority MAY optionally be omitted from the 2073 chain, under the assumption that the remote end must already 2074 possess it in order to validate it in any case. 2076 The same message type and structure will be used for the client's 2077 response to a certificate request message. Note that a client MAY 2078 send no certificates if it does not have an appropriate certificate 2079 to send in response to the server's authentication request. 2081 Note: PKCS #7 [PKCS7] is not used as the format for the certificate 2082 vector because PKCS #6 [PKCS6] extended certificates are not 2083 used. Also, PKCS #7 defines a SET rather than a SEQUENCE, making 2084 the task of parsing the list more difficult. 2086 The following rules apply to the certificates sent by the server: 2088 - The certificate type MUST be X.509v3, unless explicitly 2089 negotiated otherwise (e.g., [TLSPGP]). 2091 - The certificate's public key (and associated restrictions) 2092 MUST be compatible with the selected key exchange 2093 algorithm. 2095 Key Exchange Alg. Certificate Key Type 2097 RSA RSA public key; the certificate MUST 2098 RSA_PSK allow the key to be used for encryption 2099 (the keyEncipherment bit MUST be set 2100 if the key usage extension is present). 2101 Note: RSA_PSK is defined in [TLSPSK]. 2103 DHE_RSA RSA public key; the certificate MUST 2104 ECDHE_RSA allow the key to be used for signing 2105 (the digitalSignature bit MUST be set 2106 if the key usage extension is present) 2107 with the signature scheme and hash 2108 algorithm that will be employed in the 2109 server key exchange message. 2111 DHE_DSS DSA public key; the certificate MUST 2112 allow the key to be used for signing with 2113 the hash algorithm that will be employed 2114 in the server key exchange message. 2116 DH_DSS Diffie-Hellman public key; the 2117 DH_RSA keyAgreement bit MUST be set if the 2118 key usage extension is present. 2120 ECDH_ECDSA ECDH-capable public key; the public key 2121 ECDH_RSA MUST use a curve and point format supported 2122 by the client, as described in [TLSECC]. 2124 ECDHE_ECDSA ECDSA-capable public key; the certificate 2125 MUST allow the key to be used for signing 2126 with the hash algorithm that will be 2127 employed in the server key exchange 2128 message. The public key MUST use a curve 2129 and point format supported by the client, 2130 as described in [TLSECC]. 2132 - The "server_name" and "trusted_ca_keys" extensions 2133 [4366bis] are used to guide certificate selection. 2135 If the client provided a "signature_algorithms" extension, then all 2136 certificates provided by the server MUST be signed by a 2137 digest/signature algorithm pair that appears in that extension. Note 2138 that this implies that a certificate containing a key for one 2139 signature algorithm MAY be signed using a different signature 2140 algorithm (for instance, an RSA key signed with a DSA key.) This is a 2141 departure from TLS 1.1, which required that the algorithms be the 2142 same. Note that this also implies that the DH_DS, DH_RSA, 2143 ECDH_ECDSA, and ECDH_RSA key exchange algorithms do not restrict the 2144 algorithm used to sign the certificate. Fixed DH certificates MAY be 2145 signed with any digest/signature algorithm pair appearing in the 2146 extension. The naming is historical. 2148 If no "signature_algorithms" extension is present, the end-entity 2149 certificate MUST be signed as follows: 2151 Key Exchange Alg. Signature Algorithm Used by Issuer 2153 RSA RSA (RSASSA-PKCS1-v1_5) 2154 DHE_RSA 2155 DH_RSA 2156 RSA_PSK 2157 ECDH_RSA 2158 ECDHE_RSA 2160 DHE_DSS DSA 2161 DH_DSS 2163 ECDH_ECDSA ECDSA 2164 ECDHE_ECDSA 2166 If the server has multiple certificates, it chooses one of them based 2167 on the above-mentioned criteria (in addition to other criteria, such 2168 as transport layer endpoint, local configuration and preferences, 2169 etc.). 2171 Note that there are certificates that use algorithms and/or algorithm 2172 combinations that cannot be currently used with TLS. For example, a 2173 certificate with RSASSA-PSS signature key (id-RSASSA-PSS OID in 2174 SubjectPublicKeyInfo) cannot be used because TLS defines no 2175 corresponding signature algorithm. 2177 As CipherSuites that specify new key exchange methods are specified 2178 for the TLS Protocol, they will imply certificate format and the 2179 required encoded keying information. 2181 7.4.3. Server Key Exchange Message 2183 When this message will be sent: 2184 This message will be sent immediately after the server 2185 certificate message (or the server hello message, if this is an 2186 anonymous negotiation). 2188 The server key exchange message is sent by the server only when 2189 the server certificate message (if sent) does not contain enough 2190 data to allow the client to exchange a premaster secret. This is 2191 true for the following key exchange methods: 2193 DHE_DSS 2194 DHE_RSA 2195 DH_anon 2197 It is not legal to send the server key exchange message for the 2198 following key exchange methods: 2200 RSA 2201 DH_DSS 2202 DH_RSA 2203 Meaning of this message: 2204 This message conveys cryptographic information to allow the 2205 client to communicate the premaster secret: a Diffie-Hellman 2206 public key with which the client can complete a key exchange 2207 (with the result being the premaster secret) or a public key for 2208 some other algorithm. 2210 Structure of this message: 2211 enum { diffie_hellman, rsa} KeyExchangeAlgorithm; 2213 struct { 2214 opaque dh_p<1..2^16-1>; 2215 opaque dh_g<1..2^16-1>; 2216 opaque dh_Ys<1..2^16-1>; 2217 } ServerDHParams; /* Ephemeral DH parameters */ 2219 dh_p 2220 The prime modulus used for the Diffie-Hellman operation. 2222 dh_g 2223 The generator used for the Diffie-Hellman operation. 2225 dh_Ys 2226 The server's Diffie-Hellman public value (g^X mod p). 2228 struct { 2229 select (KeyExchangeAlgorithm) { 2230 case diffie_hellman: 2231 ServerDHParams params; 2232 Signature signed_params; 2233 }; 2234 } ServerKeyExchange; 2236 struct { 2237 select (KeyExchangeAlgorithm) { 2238 case diffie_hellman: 2239 ServerDHParams params; 2240 }; 2241 } ServerParams; 2243 params 2244 The server's key exchange parameters. 2246 signed_params 2247 For non-anonymous key exchanges, a hash of the corresponding 2248 params value, with the signature appropriate to that hash 2249 applied. 2251 hash 2252 Hash(ClientHello.random + ServerHello.random + ServerParams) 2254 struct { 2255 select (SignatureAlgorithm) { 2256 case anonymous: struct { }; 2257 case rsa: 2258 SignatureAndHashAlgorithm signature_algorithm; /*NEW*/ 2259 digitally-signed struct { 2260 opaque hash[Hash.length]; 2261 }; 2262 case dsa: 2263 SignatureAndHashAlgorithm signature_algorithm; /*NEW*/ 2264 digitally-signed struct { 2265 opaque hash[Hash.length]; 2266 }; 2267 }; 2268 }; 2269 } Signature; 2271 If the client has offered the "signature_algorithms" extension, the 2272 signature algorithm and digest algorithm MUST be a pair listed in 2273 that extension. Note that there is a possibility for inconsistencies 2274 here. For instance, the client might offer DHE_DSS key exchange but 2275 omit any DSS pairs from its "signature_algorithms" extension. In 2276 order to negotiate correctly, the server MUST check any candidate 2277 cipher suites against the "signature_algorithms" extension before 2278 selecting them. This is somewhat inelegant but is a compromise 2279 designed to minimize changes to the original cipher suite design. 2281 If no "signature_algorithms" extension is present, the server MUST 2282 use SHA-1 as the hash algorithm. 2284 In addition, the digest and signature algorithms MUST be compatible 2285 with the key in the client's end-entity certificate. RSA keys MAY be 2286 used with any permitted digest algorithm. 2288 Because DSA signatures do not contain any secure indication of digest 2289 algorithm, it must be unambiguous which digest algorithm is to be 2290 used with any key. DSA keys specified with Object Identifier 2291 1 2 840 10040 4 1 MUST only be used with SHA-1. Future revisions of 2292 [PKIX] MAY define new object identifiers for DSA with other digest 2293 algorithms. 2295 The hash algorithm is denoted Hash below. Hash.length is the length 2296 of the output of that algorithm. 2298 As additional CipherSuites are defined for TLS that include new key 2299 exchange algorithms, the server key exchange message will be sent if 2300 and only if the certificate type associated with the key exchange 2301 algorithm does not provide enough information for the client to 2302 exchange a premaster secret. 2304 7.4.4. Certificate Request 2306 When this message will be sent: 2307 A non-anonymous server can optionally request a certificate from 2308 the client, if appropriate for the selected cipher suite. This 2309 message, if sent, will immediately follow the Server Key Exchange 2310 message (if it is sent; otherwise, the Server Certificate 2311 message). 2313 Structure of this message: 2314 enum { 2315 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 2316 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 2317 fortezza_dms_RESERVED(20), (255) 2318 } ClientCertificateType; 2320 opaque DistinguishedName<1..2^16-1>; 2322 struct { 2323 ClientCertificateType certificate_types<1..2^8-1>; 2324 SignatureAndHashAlgorithm 2325 supported_signature_algorithms<2^16-1>; 2326 DistinguishedName certificate_authorities<0..2^16-1>; 2327 } CertificateRequest; 2329 certificate_types 2330 A list of the types of certificate types which the client may 2331 offer. 2332 rsa_sign a certificate containing an RSA key 2333 dss_sign a certificate containing a DSS key 2334 rsa_fixed_dh a certificate containing a static DH key. 2335 dss_fixed_dh a certificate containing a static DH key 2337 supported_signature_algorithms 2338 A list of the digest/signature algorithm pairs that the server is 2339 able to verify, listed in descending order of preference. 2341 certificate_authorities 2342 A list of the distinguished names [X501] of acceptable 2343 certificate_authorities, represented in DER-encoded format. These 2344 distinguished names may specify a desired distinguished name for 2345 a root CA or for a subordinate CA; thus, this message can be used 2346 both to describe known roots and a desired authorization space. 2347 If the certificate_authorities list is empty then the client MAY 2348 send any certificate of the appropriate ClientCertificateType, 2349 unless there is some external arrangement to the contrary. 2351 The interaction of the certificate_types and 2352 supported_signature_algorithms fields is somewhat complicated. 2353 certificate_types has been present in TLS since SSLv3, but was 2354 somewhat underspecified. Much of its functionality is superseded by 2355 supported_signature_algorithms. The following rules apply: 2357 - Any certificates provided by the client MUST be signed using 2358 a digest/signature algorithm pair found in 2359 supported_signature_types. 2361 - The end-entity certificate provided by the client MUST contain a 2362 key which is compatible with certificate_types. If the key is a 2363 signature key, it MUST be usable with some digest/signature 2364 algorithm pair in supported_signature_types. 2366 - For historical reasons, the names of some client certificate 2367 types include the algorithm used to sign the certificate. For 2368 example, in earlier versions of TLS, rsa_fixed_dh meant a 2369 certificate signed with RSA and containing a static DH key. In 2370 TLS 1.2, this functionality has been obsoleted by the 2371 signature_types field, and the certificate type no longer 2372 restricts the algorithm used to sign the certificate. For 2373 example, if the server sends dss_fixed_dh certificate type and 2374 {dss_sha1, rsa_sha1} signature types, the client MAY to reply 2375 with a certificate containing a static DH key, signed with RSA- 2376 SHA1. 2378 New ClientCertificateType values are assigned by IANA as described in 2379 Section 12. 2381 Note: Values listed as RESERVED may not be used. They were used in 2382 SSLv3. 2384 Note: It is a fatal handshake_failure alert for an anonymous server to 2385 request client authentication. 2387 7.4.5 Server hello done 2389 When this message will be sent: 2390 The server hello done message is sent by the server to indicate 2391 the end of the server hello and associated messages. After 2392 sending this message, the server will wait for a client response. 2394 Meaning of this message: 2395 This message means that the server is done sending messages to 2396 support the key exchange, and the client can proceed with its 2397 phase of the key exchange. 2399 Upon receipt of the server hello done message, the client SHOULD 2400 verify that the server provided a valid certificate, if required 2401 and check that the server hello parameters are acceptable. 2403 Structure of this message: 2404 struct { } ServerHelloDone; 2406 7.4.6. Client Certificate 2408 When this message will be sent: 2409 This is the first message the client can send after receiving a 2410 server hello done message. This message is only sent if the 2411 server requests a certificate. If no suitable certificate is 2412 available, the client SHOULD send a certificate message 2413 containing no certificates. That is, the certificate_list 2414 structure has a length of zero. If client authentication is 2415 required by the server for the handshake to continue, it may 2416 respond with a fatal handshake failure alert. Client certificates 2417 are sent using the Certificate structure defined in Section 2418 7.4.2. 2420 Meaning of this message: 2421 This message conveys the client's certificate to the server; the 2422 server will use it when verifying the certificate verify message 2423 (when the client authentication is based on signing), or 2424 calculate the premaster secret (for non-ephemeral Diffie- 2425 Hellman). The certificate MUST be appropriate for the negotiated 2426 cipher suite's key exchange algorithm, and any negotiated 2427 extensions. 2429 In particular: 2431 - The certificate type MUST be X.509v3, unless explicitly 2432 negotiated otherwise (e.g. [TLSPGP]). 2434 - The certificate's public key (and associated restrictions) 2435 has to be compatible with the certificate types listed in 2436 CertificateRequest: 2438 Client Cert. Type Certificate Key Type 2439 rsa_sign RSA public key; the certificate MUST allow 2440 the key to be used for signing with the 2441 signature scheme and hash algorithm that 2442 will be employed in the certificate verify 2443 message. 2445 dss_sign DSA public key; the certificate MUST allow 2446 the key to be used for signing with the 2447 hash algorithm that will be employed in 2448 the certificate verify message. 2450 ecdsa_sign ECDSA-capable public key; the certificate 2451 MUST allow the key to be used for signing 2452 with the hash algorithm that will be 2453 employed in the certificate verify 2454 message; the public key MUST use a 2455 curve and point format supported by the 2456 server. 2458 rsa_fixed_dh Diffie-Hellman public key; MUST use 2459 dss_fixed_dh the same parameters as server's key. 2461 rsa_fixed_ecdh ECDH-capable public key; MUST use 2462 ecdsa_fixed_ecdh the same curve as server's key, and 2463 MUST use a point format supported by 2465 - If the certificate_authorities list in the certificate 2466 request message was non-empty, the certificate SHOULD be 2467 issued by one of the listed CAs. 2469 - The certificates MUST be signed using an acceptable digest/ 2470 signature algorithm pair, as described in Section 7.4.4. Note 2471 that this relaxes the constraints on certificate signing 2472 algorithms found in prior versions of TLS. 2474 Note that as with the server certificate, there are certificates that 2475 use algorithms/algorithm combinations that cannot be currently used 2476 with TLS. 2478 7.4.7. Client Key Exchange Message 2480 When this message will be sent: 2481 This message is always sent by the client. It MUST immediately follow 2482 the client certificate message, if it is sent. Otherwise it MUST be 2483 the first message sent by the client after it receives the server 2484 hello done message. 2486 Meaning of this message: 2488 With this message, the premaster secret is set, either though direct 2489 transmission of the RSA-encrypted secret, or by the transmission of 2490 Diffie-Hellman parameters that will allow each side to agree upon the 2491 same premaster secret. When the key exchange method is DH_RSA or 2492 DH_DSS, client certification has been requested, and the client was 2493 able to respond with a certificate that contained a Diffie-Hellman 2494 public key whose parameters (group and generator) matched those 2495 specified by the server in its certificate, this message MUST NOT 2496 contain any data. 2498 Structure of this message: 2499 The choice of messages depends on which key exchange method has been 2500 selected. See Section 7.4.3 for the KeyExchangeAlgorithm definition. 2502 struct { 2503 select (KeyExchangeAlgorithm) { 2504 case rsa: EncryptedPreMasterSecret; 2505 case diffie_hellman: ClientDiffieHellmanPublic; 2506 } exchange_keys; 2507 } ClientKeyExchange; 2509 7.4.7.1. RSA Encrypted Premaster Secret Message 2511 Meaning of this message: 2512 If RSA is being used for key agreement and authentication, the client 2513 generates a 48-byte premaster secret, encrypts it using the public 2514 key from the server's certificate and sends the result in an 2515 encrypted premaster secret message. This structure is a variant of 2516 the client key exchange message and is not a message in itself. 2518 Structure of this message: 2519 struct { 2520 ProtocolVersion client_version; 2521 opaque random[46]; 2522 } PreMasterSecret; 2524 client_version 2526 The latest (newest) version supported by the client. This is 2527 used to detect version roll-back attacks. 2529 random 2530 46 securely-generated random bytes. 2532 struct { 2533 public-key-encrypted PreMasterSecret pre_master_secret; 2534 } EncryptedPreMasterSecret; 2535 pre_master_secret 2537 This random value is generated by the client and is used to 2538 generate the master secret, as specified in Section 8.1. 2540 Note: The version number in the PreMasterSecret is the version 2541 offered by the client in the ClientHello.client_version, not the 2542 version negotiated for the connection. This feature is designed 2543 to prevent rollback attacks. Unfortunately, some old 2544 implementations use the negotiated version instead and therefore 2545 checking the version number may lead to failure to interoperate 2546 with such incorrect client implementations. 2548 Client implementations MUST always send the correct version 2549 number in PreMasterSecret. If ClientHello.client_version is TLS 2550 1.1 or higher, server implementations MUST check the version 2551 number as described in the note below. If the version number is 2552 earlier than 1.0, server implementations SHOULD check the version 2553 number, but MAY have a configuration option to disable the check. 2554 Note that if the check fails, the PreMasterSecret SHOULD be 2555 randomized as described below. 2557 Note: Attacks discovered by Bleichenbacher [BLEI] and Klima et al. 2558 [KPR03] can be used to attack a TLS server that reveals whether a 2559 particular message, when decrypted, is properly PKCS#1 formatted, 2560 contains a valid PreMasterSecret structure, or has the correct 2561 version number. 2563 The best way to avoid these vulnerabilities is to treat incorrectly 2564 formatted messages in a manner indistinguishable from correctly 2565 formatted RSA blocks. In other words: 2567 1. Generate a string R of 46 random bytes 2569 2. Decrypt the message M 2571 3. If the PKCS#1 padding is not correct, or the length of 2572 message M is not exactly 48 bytes: 2573 premaster secret = ClientHello.client_version || R 2574 else If ClientHello.client_version <= TLS 1.0, and 2575 version number check is explicitly disabled: 2576 premaster secret = M 2577 else: 2578 premaster secret = ClientHello.client_version || M[2..47] 2580 In any case, a TLS server MUST NOT generate an alert if processing an 2581 RSA-encrypted premaster secret message fails, or the version number 2582 is not as expected. Instead, it MUST continue the handshake with a 2583 randomly generated premaster secret. It may be useful to log the 2584 real cause of failure for troubleshooting purposes; however, care 2585 must be taken to avoid leaking the information to an attacker 2586 (though, e.g., timing, log files, or other channels.) 2588 The RSAES-OAEP encryption scheme defined in [PKCS1] is more secure 2589 against the Bleichenbacher attack. However, for maximal compatibility 2590 with earlier versions of TLS, this specification uses the RSAES- 2591 PKCS1-v1_5 scheme. No variants of the Bleichenbacher attack are known 2592 to exist provided that the above recommendations are followed. 2594 Implementation Note: Public-key-encrypted data is represented as an 2595 opaque vector <0..2^16-1> (see Section 4.7). Thus, the RSA-encrypted 2596 PreMasterSecret in a ClientKeyExchange is preceded by two length 2597 bytes. These bytes are redundant in the case of RSA because the 2598 EncryptedPreMasterSecret is the only data in the ClientKeyExchange 2599 and its length can therefore be unambiguously determined. The SSLv3 2600 specification was not clear about the encoding of public-key- 2601 encrypted data, and therefore many SSLv3 implementations do not 2602 include the the length bytes, encoding the RSA encrypted data 2603 directly in the ClientKeyExchange message. 2605 This specification requires correct encoding of the 2606 EncryptedPreMasterSecret complete with length bytes. The resulting 2607 PDU is incompatible with many SSLv3 implementations. Implementors 2608 upgrading from SSLv3 MUST modify their implementations to generate 2609 and accept the correct encoding. Implementors who wish to be 2610 compatible with both SSLv3 and TLS should make their implementation's 2611 behavior dependent on the protocol version. 2613 Implementation Note: It is now known that remote timing-based attacks 2614 on TLS are possible, at least when the client and server are on the 2615 same LAN. Accordingly, implementations that use static RSA keys MUST 2616 use RSA blinding or some other anti-timing technique, as described in 2617 [TIMING]. 2619 7.4.7.2. Client Diffie-Hellman Public Value 2621 Meaning of this message: 2622 This structure conveys the client's Diffie-Hellman public value 2623 (Yc) if it was not already included in the client's certificate. 2624 The encoding used for Yc is determined by the enumerated 2625 PublicValueEncoding. This structure is a variant of the client 2626 key exchange message, and not a message in itself. 2628 Structure of this message: 2629 enum { implicit, explicit } PublicValueEncoding; 2630 implicit 2631 If the client certificate already contains a suitable Diffie- 2632 Hellman key, then Yc is implicit and does not need to be sent 2633 again. In this case, the client key exchange message will be 2634 sent, but it MUST be empty. 2636 explicit 2637 Yc needs to be sent. 2639 struct { 2640 select (PublicValueEncoding) { 2641 case implicit: struct { }; 2642 case explicit: opaque dh_Yc<1..2^16-1>; 2643 } dh_public; 2644 } ClientDiffieHellmanPublic; 2646 dh_Yc 2647 The client's Diffie-Hellman public value (Yc). 2649 7.4.8. Certificate verify 2651 When this message will be sent: 2652 This message is used to provide explicit verification of a client 2653 certificate. This message is only sent following a client 2654 certificate that has signing capability (i.e. all certificates 2655 except those containing fixed Diffie-Hellman parameters). When 2656 sent, it MUST immediately follow the client key exchange message. 2658 Structure of this message: 2659 struct { 2660 Signature signature; 2661 } CertificateVerify; 2663 The Signature type is defined in 7.4.3. 2665 The hash algorithm is denoted Hash below. 2667 CertificateVerify.signature.hash = Hash(handshake_messages); 2669 The digest and signature algorithms MUST be one of those present 2670 in the supported_signature_algorithms field of the 2671 CertificateRequest message. In addition, the digest and signature 2672 algorithms MUST be compatible with the key in the client's end- 2673 entity certificate. RSA keys MAY be used with any permitted 2674 digest algorithm. 2676 Because DSA signatures do not contain any secure indication of 2677 digest algorithm, it must be unambiguous which digest algorithm 2678 is to be used with any key. DSA keys specified with Object 2679 Identifier 1 2 840 10040 4 1 MUST only be used with SHA-1. 2680 Future revisions of [PKIX] MAY define new object identifiers for 2681 DSA with other digest algorithms. 2683 Here handshake_messages refers to all handshake messages sent or 2684 received starting at client hello up to but not including this 2685 message, including the type and length fields of the handshake 2686 messages. This is the concatenation of all the Handshake structures 2687 as defined in 7.4 exchanged thus far. 2689 7.4.9. Finished 2691 When this message will be sent: 2692 A finished message is always sent immediately after a change 2693 cipher spec message to verify that the key exchange and 2694 authentication processes were successful. It is essential that a 2695 change cipher spec message be received between the other 2696 handshake messages and the Finished message. 2698 Meaning of this message: 2699 The finished message is the first protected with the just- 2700 negotiated algorithms, keys, and secrets. Recipients of finished 2701 messages MUST verify that the contents are correct. Once a side 2702 has sent its Finished message and received and validated the 2703 Finished message from its peer, it may begin to send and receive 2704 application data over the connection. 2706 struct { 2707 opaque verify_data[SecurityParameters.verify_data_length]; 2708 } Finished; 2710 verify_data 2711 PRF(master_secret, finished_label, Hash(handshake_messages)) 2712 [0..SecurityParameters.verify_data_length-1]; 2714 finished_label 2715 For Finished messages sent by the client, the string "client 2716 finished". For Finished messages sent by the server, the 2717 string "server finished". 2719 Hash denotes the negotiated hash used for the PRF. If a new 2720 PRF is defined, then this hash MUST be specified. 2722 In previous versions of TLS, the verify_data was always 12 2723 octets long. In the current version of TLS, it depends on the 2724 cipher suite. Any cipher suite which does not explicitly 2725 specify SecurityParameters.verify_data_length has a 2726 SecurityParameters.verify_data_length equal to 12. This 2727 includes all existing cipher suites. Note that this 2728 representation has the same encoding as with previous 2729 versions. Future cipher suites MAY specify other lengths but 2730 such length MUST be at least 12 bytes. 2732 handshake_messages 2733 All of the data from all messages in this handshake (not 2734 including any HelloRequest messages) up to but not including 2735 this message. This is only data visible at the handshake 2736 layer and does not include record layer headers. This is the 2737 concatenation of all the Handshake structures as defined in 2738 7.4, exchanged thus far. 2740 It is a fatal error if a finished message is not preceded by a change 2741 cipher spec message at the appropriate point in the handshake. 2743 The value handshake_messages includes all handshake messages starting 2744 at client hello up to, but not including, this finished message. This 2745 may be different from handshake_messages in Section 7.4.8 because it 2746 would include the certificate verify message (if sent). Also, the 2747 handshake_messages for the finished message sent by the client will 2748 be different from that for the finished message sent by the server, 2749 because the one that is sent second will include the prior one. 2751 Note: Change cipher spec messages, alerts, and any other record types 2752 are not handshake messages and are not included in the hash 2753 computations. Also, Hello Request messages are omitted from 2754 handshake hashes. 2756 8. Cryptographic Computations 2758 In order to begin connection protection, the TLS Record Protocol 2759 requires specification of a suite of algorithms, a master secret, and 2760 the client and server random values. The authentication, encryption, 2761 and MAC algorithms are determined by the cipher_suite selected by the 2762 server and revealed in the server hello message. The compression 2763 algorithm is negotiated in the hello messages, and the random values 2764 are exchanged in the hello messages. All that remains is to calculate 2765 the master secret. 2767 8.1. Computing the Master Secret 2769 For all key exchange methods, the same algorithm is used to convert 2770 the pre_master_secret into the master_secret. The pre_master_secret 2771 should be deleted from memory once the master_secret has been 2772 computed. 2774 master_secret = PRF(pre_master_secret, "master secret", 2775 ClientHello.random + ServerHello.random) 2776 [0..47]; 2778 The master secret is always exactly 48 bytes in length. The length of 2779 the premaster secret will vary depending on key exchange method. 2781 8.1.1. RSA 2783 When RSA is used for server authentication and key exchange, a 2784 48-byte pre_master_secret is generated by the client, encrypted under 2785 the server's public key, and sent to the server. The server uses its 2786 private key to decrypt the pre_master_secret. Both parties then 2787 convert the pre_master_secret into the master_secret, as specified 2788 above. 2790 8.1.2. Diffie-Hellman 2792 A conventional Diffie-Hellman computation is performed. The 2793 negotiated key (Z) is used as the pre_master_secret, and is converted 2794 into the master_secret, as specified above. Leading bytes of Z that 2795 contain all zero bits are stripped before it is used as the 2796 pre_master_secret. 2798 Note: Diffie-Hellman parameters are specified by the server and may 2799 be either ephemeral or contained within the server's certificate. 2801 9. Mandatory Cipher Suites 2803 In the absence of an application profile standard specifying 2804 otherwise, a TLS compliant application MUST implement the cipher 2805 suite TLS_RSA_WITH_AES_128_CBC_SHA. 2807 10. Application Data Protocol 2809 Application data messages are carried by the Record Layer and are 2810 fragmented, compressed, and encrypted based on the current connection 2811 state. The messages are treated as transparent data to the record 2812 layer. 2814 11. Security Considerations 2816 Security issues are discussed throughout this memo, especially in 2817 Appendices D, E, and F. 2819 12. IANA Considerations 2821 This document uses several registries that were originally created in 2823 [TLS1.1]. IANA is requested to update (has updated) these to 2824 reference this document. The registries and their allocation policies 2825 (unchanged from [TLS1.1]) are listed below. 2827 - TLS ClientCertificateType Identifiers Registry: Future 2828 values in the range 0-63 (decimal) inclusive are assigned via 2829 Standards Action [RFC2434]. Values in the range 64-223 2830 (decimal) inclusive are assigned Specification Required 2831 [RFC2434]. Values from 224-255 (decimal) inclusive are 2832 reserved for Private Use [RFC2434]. 2834 - TLS Cipher Suite Registry: Future values with the first byte 2835 in the range 0-191 (decimal) inclusive are assigned via 2836 Standards Action [RFC2434]. Values with the first byte in 2837 the range 192-254 (decimal) are assigned via Specification 2838 Required [RFC2434]. Values with the first byte 255 (decimal) 2839 are reserved for Private Use [RFC2434]. 2841 - TLS ContentType Registry: Future values are allocated via 2842 Standards Action [RFC2434]. 2844 - TLS Alert Registry: Future values are allocated via 2845 Standards Action [RFC2434]. 2847 - TLS HandshakeType Registry: Future values are allocated via 2848 Standards Action [RFC2434]. 2850 This document also uses a registry originally created in [RFC4366]. 2851 IANA is requested to update (has updated) it to reference this 2852 document. The registry and its allocation policy (unchanged from 2853 [RFC4366]) is listed below:. 2855 - TLS ExtensionType Registry: Future values are allocated 2856 via IETF Consensus [RFC2434] 2858 In addition, this document defines one new registry to be maintained 2859 by IANA: 2861 - TLS SignatureAlgorithm Registry: The registry will be initially 2862 populated with the values described in Section 7.4.1.4.1. 2863 Future values in the range 0-63 (decimal) inclusive are 2864 assigned via Standards Action [RFC2434]. Values in the 2865 range 64-223 (decimal) inclusive are assigned via 2866 Specification Required [RFC2434]. Values from 224-255 2867 (decimal) inclusive are reserved for Private Use [RFC2434]. 2869 - TLS HashAlgorithm Registry: The registry will be initially 2870 populated with the values described in Section 7.4.1.4.1. 2872 Future values in the range 0-63 (decimal) inclusive are 2873 assigned via Standards Action [RFC2434]. Values in the 2874 range 64-223 (decimal) inclusive are assigned via 2875 Specification Required [RFC2434]. Values from 224-255 2876 (decimal) inclusive are reserved for Private Use [RFC2434]. 2878 This document defines one new TLS extension, cert_hash_type, which is 2879 to be (has been) allocated value TBD-BY-IANA in the TLS ExtensionType 2880 registry. 2882 This document also uses the TLS Compression Method Identifiers 2883 Registry, defined in [RFC3749]. IANA is requested to allocate value 2884 0 for the "null" compression method. 2886 Appendix A. Protocol Constant Values 2888 This section describes protocol types and constants. 2890 A.1. Record Layer 2892 struct { 2893 uint8 major, minor; 2894 } ProtocolVersion; 2896 ProtocolVersion version = { 3, 3 }; /* TLS v1.2*/ 2898 enum { 2899 change_cipher_spec(20), alert(21), handshake(22), 2900 application_data(23), (255) 2901 } ContentType; 2903 struct { 2904 ContentType type; 2905 ProtocolVersion version; 2906 uint16 length; 2907 opaque fragment[TLSPlaintext.length]; 2908 } TLSPlaintext; 2910 struct { 2911 ContentType type; 2912 ProtocolVersion version; 2913 uint16 length; 2914 opaque fragment[TLSCompressed.length]; 2915 } TLSCompressed; 2917 struct { 2918 ContentType type; 2919 ProtocolVersion version; 2920 uint16 length; 2921 select (SecurityParameters.cipher_type) { 2922 case stream: GenericStreamCipher; 2923 case block: GenericBlockCipher; 2924 case aead: GenericAEADCipher; 2925 } fragment; 2926 } TLSCiphertext; 2928 stream-ciphered struct { 2929 opaque content[TLSCompressed.length]; 2930 opaque MAC[SecurityParameters.mac_length]; 2931 } GenericStreamCipher; 2933 struct { 2934 opaque IV[SecurityParameters.record_iv_length]; 2935 block-ciphered struct { 2936 opaque content[TLSCompressed.length]; 2937 opaque MAC[SecurityParameters.mac_length]; 2938 uint8 padding[GenericBlockCipher.padding_length]; 2939 uint8 padding_length; 2940 }; 2941 } GenericBlockCipher; 2943 aead-ciphered struct { 2944 opaque IV[SecurityParameters.record_iv_length]; 2945 opaque aead_output[AEADEncrypted.length]; 2946 } GenericAEADCipher; 2948 A.2. Change Cipher Specs Message 2950 struct { 2951 enum { change_cipher_spec(1), (255) } type; 2952 } ChangeCipherSpec; 2954 A.3. Alert Messages 2956 enum { warning(1), fatal(2), (255) } AlertLevel; 2958 enum { 2959 close_notify(0), 2960 unexpected_message(10), 2961 bad_record_mac(20), 2962 decryption_failed_RESERVED(21), 2963 record_overflow(22), 2964 decompression_failure(30), 2965 handshake_failure(40), 2966 no_certificate_RESERVED(41), 2967 bad_certificate(42), 2968 unsupported_certificate(43), 2969 certificate_revoked(44), 2970 certificate_expired(45), 2971 certificate_unknown(46), 2972 illegal_parameter(47), 2973 unknown_ca(48), 2974 access_denied(49), 2975 decode_error(50), 2976 decrypt_error(51), 2977 export_restriction_RESERVED(60), 2978 protocol_version(70), 2979 insufficient_security(71), 2980 internal_error(80), 2981 user_canceled(90), 2982 no_renegotiation(100), 2983 unsupported_extension(110), /* new */ 2984 (255) 2985 } AlertDescription; 2987 struct { 2988 AlertLevel level; 2989 AlertDescription description; 2990 } Alert; 2991 A.4. Handshake Protocol 2993 enum { 2994 hello_request(0), client_hello(1), server_hello(2), 2995 certificate(11), server_key_exchange (12), 2996 certificate_request(13), server_hello_done(14), 2997 certificate_verify(15), client_key_exchange(16), 2998 finished(20) 2999 (255) 3000 } HandshakeType; 3002 struct { 3003 HandshakeType msg_type; 3004 uint24 length; 3005 select (HandshakeType) { 3006 case hello_request: HelloRequest; 3007 case client_hello: ClientHello; 3008 case server_hello: ServerHello; 3009 case certificate: Certificate; 3010 case server_key_exchange: ServerKeyExchange; 3011 case certificate_request: CertificateRequest; 3012 case server_hello_done: ServerHelloDone; 3013 case certificate_verify: CertificateVerify; 3014 case client_key_exchange: ClientKeyExchange; 3015 case finished: Finished; 3016 } body; 3017 } Handshake; 3019 A.4.1. Hello Messages 3021 struct { } HelloRequest; 3023 struct { 3024 uint32 gmt_unix_time; 3025 opaque random_bytes[28]; 3026 } Random; 3028 opaque SessionID<0..32>; 3030 uint8 CipherSuite[2]; 3032 enum { null(0), (255) } CompressionMethod; 3034 struct { 3035 ProtocolVersion client_version; 3036 Random random; 3037 SessionID session_id; 3038 CipherSuite cipher_suites<2..2^16-1>; 3039 CompressionMethod compression_methods<1..2^8-1>; 3040 select (extensions_present) { 3041 case false: 3042 struct {}; 3043 case true: 3044 Extension extensions<0..2^16-1>; 3045 }; 3046 } ClientHello; 3048 struct { 3049 ProtocolVersion server_version; 3050 Random random; 3051 SessionID session_id; 3052 CipherSuite cipher_suite; 3053 CompressionMethod compression_method; 3054 select (extensions_present) { 3055 case false: 3056 struct {}; 3057 case true: 3058 Extension extensions<0..2^16-1>; 3059 }; 3060 } ServerHello; 3062 struct { 3063 ExtensionType extension_type; 3064 opaque extension_data<0..2^16-1>; 3065 } Extension; 3067 enum { 3068 signature_hash_algorithms(TBD-BY-IANA), (65535) 3069 } ExtensionType; 3071 enum{ 3072 none(0), md5(1), sha1(2), sha256(3), sha384(4), 3073 sha512(5), (255) 3074 } HashAlgorithm; 3076 enum { anonymous(0), rsa(1), dsa(2), (255) } SignatureAlgorithm; 3078 struct { 3079 HashAlgorithm hash; 3080 SignatureAlgorithm signature; 3081 } SignatureAndHashAlgorithm; 3083 SignatureAndHashAlgorithm 3084 supported_signature_algorithms<2..2^16-1>; 3085 A.4.2. Server Authentication and Key Exchange Messages 3087 opaque ASN.1Cert<2^24-1>; 3089 struct { 3090 ASN.1Cert certificate_list<0..2^24-1>; 3091 } Certificate; 3093 enum { rsa, diffie_hellman } KeyExchangeAlgorithm; 3095 struct { 3096 opaque dh_p<1..2^16-1>; 3097 opaque dh_g<1..2^16-1>; 3098 opaque dh_Ys<1..2^16-1>; 3099 } ServerDHParams; 3101 struct { 3102 select (KeyExchangeAlgorithm) { 3103 case diffie_hellman: 3104 ServerDHParams params; 3105 Signature signed_params; 3106 } 3107 } ServerKeyExchange; 3109 struct { 3110 select (KeyExchangeAlgorithm) { 3111 case diffie_hellman: 3112 ServerDHParams params; 3113 }; 3114 } ServerParams; 3116 struct { 3117 select (SignatureAlgorithm) { 3118 case anonymous: struct { }; 3119 case rsa: 3120 SignatureAndHashAlgorithm signature_algorithm; /*NEW*/ 3121 digitally-signed struct { 3122 opaque hash[Hash.length]; 3123 }; 3124 case dsa: 3125 SignatureAndHashAlgorithm signature_algorithm; /*NEW*/ 3126 digitally-signed struct { 3127 opaque hash[Hash.length]; 3128 }; 3129 }; 3130 }; 3131 } Signature; 3132 enum { 3133 rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), 3134 rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), 3135 fortezza_dms_RESERVED(20), 3136 (255) 3137 } ClientCertificateType; 3139 opaque DistinguishedName<1..2^16-1>; 3141 struct { 3142 ClientCertificateType certificate_types<1..2^8-1>; 3143 DistinguishedName certificate_authorities<0..2^16-1>; 3144 } CertificateRequest; 3146 struct { } ServerHelloDone; 3148 A.4.3. Client Authentication and Key Exchange Messages 3150 struct { 3151 select (KeyExchangeAlgorithm) { 3152 case rsa: EncryptedPreMasterSecret; 3153 case diffie_hellman: ClientDiffieHellmanPublic; 3154 } exchange_keys; 3155 } ClientKeyExchange; 3157 struct { 3158 ProtocolVersion client_version; 3159 opaque random[46]; 3160 } PreMasterSecret; 3162 struct { 3163 public-key-encrypted PreMasterSecret pre_master_secret; 3164 } EncryptedPreMasterSecret; 3166 enum { implicit, explicit } PublicValueEncoding; 3168 struct { 3169 select (PublicValueEncoding) { 3170 case implicit: struct {}; 3171 case explicit: opaque DH_Yc<1..2^16-1>; 3172 } dh_public; 3173 } ClientDiffieHellmanPublic; 3175 struct { 3176 Signature signature; 3177 } CertificateVerify; 3179 A.4.4. Handshake Finalization Message 3180 struct { 3181 opaque verify_data[SecurityParameters.verify_data_length]; 3182 } Finished; 3184 A.5. The CipherSuite 3186 The following values define the CipherSuite codes used in the client 3187 hello and server hello messages. 3189 A CipherSuite defines a cipher specification supported in TLS Version 3190 1.2. 3192 TLS_NULL_WITH_NULL_NULL is specified and is the initial state of a 3193 TLS connection during the first handshake on that channel, but MUST 3194 not be negotiated, as it provides no more protection than an 3195 unsecured connection. 3197 CipherSuite TLS_NULL_WITH_NULL_NULL = { 0x00,0x00 }; 3199 The following CipherSuite definitions require that the server provide 3200 an RSA certificate that can be used for key exchange. The server may 3201 request either an RSA or a DSS signature-capable certificate in the 3202 certificate request message. 3204 CipherSuite TLS_RSA_WITH_NULL_MD5 = { 0x00,0x01 }; 3205 CipherSuite TLS_RSA_WITH_NULL_SHA = { 0x00,0x02 }; 3206 CipherSuite TLS_RSA_WITH_RC4_128_MD5 = { 0x00,0x04 }; 3207 CipherSuite TLS_RSA_WITH_RC4_128_SHA = { 0x00,0x05 }; 3208 CipherSuite TLS_RSA_WITH_IDEA_CBC_SHA = { 0x00,0x07 }; 3209 CipherSuite TLS_RSA_WITH_DES_CBC_SHA = { 0x00,0x09 }; 3210 CipherSuite TLS_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0A }; 3211 CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x2F }; 3212 CipherSuite TLS_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x35 }; 3214 The following CipherSuite definitions are used for server- 3215 authenticated (and optionally client-authenticated) Diffie-Hellman. 3216 DH denotes cipher suites in which the server's certificate contains 3217 the Diffie-Hellman parameters signed by the certificate authority 3218 (CA). DHE denotes ephemeral Diffie-Hellman, where the Diffie-Hellman 3219 parameters are signed by a DSS or RSA certificate, which has been 3220 signed by the CA. The signing algorithm used is specified after the 3221 DH or DHE parameter. The server can request an RSA or DSS signature- 3222 capable certificate from the client for client authentication or it 3223 may request a Diffie-Hellman certificate. Any Diffie-Hellman 3224 certificate provided by the client must use the parameters (group and 3225 generator) described by the server. 3227 CipherSuite TLS_DH_DSS_WITH_DES_CBC_SHA = { 0x00,0x0C }; 3228 CipherSuite TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x0D }; 3229 CipherSuite TLS_DH_RSA_WITH_DES_CBC_SHA = { 0x00,0x0F }; 3230 CipherSuite TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x10 }; 3231 CipherSuite TLS_DHE_DSS_WITH_DES_CBC_SHA = { 0x00,0x12 }; 3232 CipherSuite TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = { 0x00,0x13 }; 3233 CipherSuite TLS_DHE_RSA_WITH_DES_CBC_SHA = { 0x00,0x15 }; 3234 CipherSuite TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = { 0x00,0x16 }; 3235 CipherSuite TLS_DH_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x30 }; 3236 CipherSuite TLS_DH_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x31 }; 3237 CipherSuite TLS_DHE_DSS_WITH_AES_128_CBC_SHA = { 0x00, 0x32 }; 3238 CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA = { 0x00, 0x33 }; 3239 CipherSuite TLS_DH_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x36 }; 3240 CipherSuite TLS_DH_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x37 }; 3241 CipherSuite TLS_DHE_DSS_WITH_AES_256_CBC_SHA = { 0x00, 0x38 }; 3242 CipherSuite TLS_DHE_RSA_WITH_AES_256_CBC_SHA = { 0x00, 0x39 }; 3244 The following cipher suites are used for completely anonymous Diffie- 3245 Hellman communications in which neither party is authenticated. Note 3246 that this mode is vulnerable to man-in-the-middle attacks. Using 3247 this mode therefore is of limited use: These ciphersuites MUST NOT be 3248 used by TLS 1.2 implementations unless the application layer has 3249 specifically requested to allow anonymous key exchange. (Anonymous 3250 key exchange may sometimes be acceptable, for example, to support 3251 opportunistic encryption when no set-up for authentication is in 3252 place, or when TLS is used as part of more complex security protocols 3253 that have other means to ensure authentication.) 3255 CipherSuite TLS_DH_anon_WITH_RC4_128_MD5 = { 0x00, 0x18 }; 3256 CipherSuite TLS_DH_anon_WITH_DES_CBC_SHA = { 0x00, 0x1A }; 3257 CipherSuite TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = { 0x00, 0x1B }; 3258 CipherSuite TLS_DH_anon_WITH_AES_128_CBC_SHA = { 0x00, 0x34 }; 3259 CipherSuite TLS_DH_anon_WITH_AES_256_CBC_SHA = { 0x00, 0x3A }; 3261 Note that using non-anonymous key exchange without actually verifying 3262 the key exchange is essentially equivalent to anonymous key exchange, 3263 and the same precautions apply. While non-anonymous key exchange 3264 will generally involve a higher computational and communicational 3265 cost than anonymous key exchange, it may be in the interest of 3266 interoperability not to disable non-anonymous key exchange when the 3267 application layer is allowing anonymous key exchange. 3269 When SSLv3 and TLS 1.0 were designed, the United States restricted 3270 the export of cryptographic software containing certain strong 3271 encryption algorithms. A series of cipher suites were designed to 3272 operate at reduced key lengths in order to comply with those 3273 regulations. Due to advances in computer performance, these 3274 algorithms are now unacceptably weak and export restrictions have 3275 since been loosened. TLS 1.2 implementations MUST NOT negotiate these 3276 cipher suites in TLS 1.2 mode. However, for backward compatibility 3277 they may be offered in the ClientHello for use with TLS 1.0 or SSLv3 3278 only servers. TLS 1.2 clients MUST check that the server did not 3279 choose one of these cipher suites during the handshake. These 3280 ciphersuites are listed below for informational purposes and to 3281 reserve the numbers. 3283 CipherSuite TLS_RSA_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x03 }; 3284 CipherSuite TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = { 0x00,0x06 }; 3285 CipherSuite TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x08 }; 3286 CipherSuite TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0B }; 3287 CipherSuite TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x0E }; 3288 CipherSuite TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x11 }; 3289 CipherSuite TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x14 }; 3290 CipherSuite TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = { 0x00,0x17 }; 3291 CipherSuite TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = { 0x00,0x19 }; 3293 New cipher suite values are assigned by IANA as described in Section 3294 12. 3296 Note: The cipher suite values { 0x00, 0x1C } and { 0x00, 0x1D } are 3297 reserved to avoid collision with Fortezza-based cipher suites in SSL 3298 3. 3300 A.6. The Security Parameters 3302 These security parameters are determined by the TLS Handshake 3303 Protocol and provided as parameters to the TLS Record Layer in order 3304 to initialize a connection state. SecurityParameters includes: 3306 enum { null(0), (255) } CompressionMethod; 3308 enum { server, client } ConnectionEnd; 3310 enum { null, rc4, rc2, des, 3des, des40, aes, idea } 3311 BulkCipherAlgorithm; 3313 enum { stream, block, aead } CipherType; 3315 enum { null, hmac_md5, hmac_sha, hmac_sha256, hmac_sha384, 3316 hmac_sha512} MACAlgorithm; 3318 /* The algorithms specified in CompressionMethod, 3319 BulkCipherAlgorithm, and MACAlgorithm may be added to. */ 3321 struct { 3322 ConnectionEnd entity; 3323 BulkCipherAlgorithm bulk_cipher_algorithm; 3324 CipherType cipher_type; 3325 uint8 enc_key_length; 3326 uint8 block_length; 3327 uint8 fixed_iv_length; 3328 uint8 record_iv_length; 3329 MACAlgorithm mac_algorithm; 3330 uint8 mac_length; 3331 uint8 mac_key_length; 3332 uint8 verify_data_length; 3333 CompressionMethod compression_algorithm; 3334 opaque master_secret[48]; 3335 opaque client_random[32]; 3336 opaque server_random[32]; 3337 } SecurityParameters; 3338 Appendix B. Glossary 3340 Advanced Encryption Standard (AES) 3341 AES is a widely used symmetric encryption algorithm. AES is a 3342 block cipher with a 128, 192, or 256 bit keys and a 16 byte block 3343 size. [AES] TLS currently only supports the 128 and 256 bit key 3344 sizes. 3346 application protocol 3347 An application protocol is a protocol that normally layers 3348 directly on top of the transport layer (e.g., TCP/IP). Examples 3349 include HTTP, TELNET, FTP, and SMTP. 3351 asymmetric cipher 3352 See public key cryptography. 3354 authenticated encryption with additional data (AEAD) 3355 A symmetric encryption algorithm that simultaneously provides 3356 confidentiality and message integrity. 3358 authentication 3359 Authentication is the ability of one entity to determine the 3360 identity of another entity. 3362 block cipher 3363 A block cipher is an algorithm that operates on plaintext in 3364 groups of bits, called blocks. 64 bits is a common block size. 3366 bulk cipher 3367 A symmetric encryption algorithm used to encrypt large quantities 3368 of data. 3370 cipher block chaining (CBC) 3371 CBC is a mode in which every plaintext block encrypted with a 3372 block cipher is first exclusive-ORed with the previous ciphertext 3373 block (or, in the case of the first block, with the 3374 initialization vector). For decryption, every block is first 3375 decrypted, then exclusive-ORed with the previous ciphertext block 3376 (or IV). 3378 certificate 3379 As part of the X.509 protocol (a.k.a. ISO Authentication 3380 framework), certificates are assigned by a trusted Certificate 3381 Authority and provide a strong binding between a party's identity 3382 or some other attributes and its public key. 3384 client 3385 The application entity that initiates a TLS connection to a 3386 server. This may or may not imply that the client initiated the 3387 underlying transport connection. The primary operational 3388 difference between the server and client is that the server is 3389 generally authenticated, while the client is only optionally 3390 authenticated. 3392 client write key 3393 The key used to encrypt data written by the client. 3395 client write MAC secret 3396 The secret data used to authenticate data written by the client. 3398 connection 3399 A connection is a transport (in the OSI layering model 3400 definition) that provides a suitable type of service. For TLS, 3401 such connections are peer-to-peer relationships. The connections 3402 are transient. Every connection is associated with one session. 3404 Data Encryption Standard 3405 DES is a very widely used symmetric encryption algorithm. DES is 3406 a block cipher with a 56 bit key and an 8 byte block size. Note 3407 that in TLS, for key generation purposes, DES is treated as 3408 having an 8 byte key length (64 bits), but it still only provides 3409 56 bits of protection. (The low bit of each key byte is presumed 3410 to be set to produce odd parity in that key byte.) DES can also 3411 be operated in a mode where three independent keys and three 3412 encryptions are used for each block of data; this uses 168 bits 3413 of key (24 bytes in the TLS key generation method) and provides 3414 the equivalent of 112 bits of security. [DES], [3DES] 3416 Digital Signature Standard (DSS) 3417 A standard for digital signing, including the Digital Signing 3418 Algorithm, approved by the National Institute of Standards and 3419 Technology, defined in NIST FIPS PUB 186, "Digital Signature 3420 Standard", published May, 1994 by the U.S. Dept. of Commerce. 3421 [DSS] 3423 digital signatures 3424 Digital signatures utilize public key cryptography and one-way 3425 hash functions to produce a signature of the data that can be 3426 authenticated, and is difficult to forge or repudiate. 3428 handshake 3429 An initial negotiation between client and server that establishes 3430 the parameters of their transactions. 3432 Initialization Vector (IV) 3433 When a block cipher is used in CBC mode, the initialization 3434 vector is exclusive-ORed with the first plaintext block prior to 3435 encryption. 3437 IDEA 3438 A 64-bit block cipher designed by Xuejia Lai and James Massey. 3439 [IDEA] 3441 Message Authentication Code (MAC) 3442 A Message Authentication Code is a one-way hash computed from a 3443 message and some secret data. It is difficult to forge without 3444 knowing the secret data. Its purpose is to detect if the message 3445 has been altered. 3447 master secret 3448 Secure secret data used for generating encryption keys, MAC 3449 secrets, and IVs. 3451 MD5 3452 MD5 is a secure hashing function that converts an arbitrarily 3453 long data stream into a digest of fixed size (16 bytes). [MD5] 3455 public key cryptography 3456 A class of cryptographic techniques employing two-key ciphers. 3457 Messages encrypted with the public key can only be decrypted with 3458 the associated private key. Conversely, messages signed with the 3459 private key can be verified with the public key. 3461 one-way hash function 3462 A one-way transformation that converts an arbitrary amount of 3463 data into a fixed-length hash. It is computationally hard to 3464 reverse the transformation or to find collisions. MD5 and SHA are 3465 examples of one-way hash functions. 3467 RC2 3468 A block cipher developed by Ron Rivest, described in [RC2]. 3470 RC4 3471 A stream cipher invented by Ron Rivest. A compatible cipher is 3472 described in [SCH]. 3474 RSA 3475 A very widely used public-key algorithm that can be used for 3476 either encryption or digital signing. [RSA] 3478 server 3479 The server is the application entity that responds to requests 3480 for connections from clients. See also under client. 3482 session 3483 A TLS session is an association between a client and a server. 3484 Sessions are created by the handshake protocol. Sessions define a 3485 set of cryptographic security parameters that can be shared among 3486 multiple connections. Sessions are used to avoid the expensive 3487 negotiation of new security parameters for each connection. 3489 session identifier 3490 A session identifier is a value generated by a server that 3491 identifies a particular session. 3493 server write key 3494 The key used to encrypt data written by the server. 3496 server write MAC secret 3497 The secret data used to authenticate data written by the server. 3499 SHA 3500 The Secure Hash Algorithm is defined in FIPS PUB 180-2. It 3501 produces a 20-byte output. Note that all references to SHA 3502 actually use the modified SHA-1 algorithm. [SHA] 3504 SSL 3505 Netscape's Secure Socket Layer protocol [SSL3]. TLS is based on 3506 SSL Version 3.0 3508 stream cipher 3509 An encryption algorithm that converts a key into a 3510 cryptographically strong keystream, which is then exclusive-ORed 3511 with the plaintext. 3513 symmetric cipher 3514 See bulk cipher. 3516 Transport Layer Security (TLS) 3517 This protocol; also, the Transport Layer Security working group 3518 of the Internet Engineering Task Force (IETF). See "Comments" at 3519 the end of this document. 3521 Appendix C. CipherSuite Definitions 3523 CipherSuite Key Cipher Hash 3524 Exchange 3526 TLS_NULL_WITH_NULL_NULL NULL NULL NULL 3527 TLS_RSA_WITH_NULL_MD5 RSA NULL MD5 3528 TLS_RSA_WITH_NULL_SHA RSA NULL SHA 3529 TLS_RSA_WITH_RC4_128_MD5 RSA RC4_128 MD5 3530 TLS_RSA_WITH_RC4_128_SHA RSA RC4_128 SHA 3531 TLS_RSA_WITH_IDEA_CBC_SHA RSA IDEA_CBC SHA 3532 TLS_RSA_WITH_DES_CBC_SHA RSA DES_CBC SHA 3533 TLS_RSA_WITH_3DES_EDE_CBC_SHA RSA 3DES_EDE_CBC SHA 3534 TLS_RSA_WITH_AES_128_CBC_SHA RSA AES_128_CBC SHA 3535 TLS_RSA_WITH_AES_256_CBC_SHA RSA AES_256_CBC SHA 3536 TLS_DH_DSS_WITH_DES_CBC_SHA DH_DSS DES_CBC SHA 3537 TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA DH_DSS 3DES_EDE_CBC SHA 3538 TLS_DH_RSA_WITH_DES_CBC_SHA DH_RSA DES_CBC SHA 3539 TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA DH_RSA 3DES_EDE_CBC SHA 3540 TLS_DHE_DSS_WITH_DES_CBC_SHA DHE_DSS DES_CBC SHA 3541 TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA DHE_DSS 3DES_EDE_CBC SHA 3542 TLS_DHE_RSA_WITH_DES_CBC_SHA DHE_RSA DES_CBC SHA 3543 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA DHE_RSA 3DES_EDE_CBC SHA 3544 TLS_DH_anon_WITH_RC4_128_MD5 DH_anon RC4_128 MD5 3545 TLS_DH_anon_WITH_DES_CBC_SHA DH_anon DES_CBC SHA 3546 TLS_DH_anon_WITH_3DES_EDE_CBC_SHA DH_anon 3DES_EDE_CBC SHA 3547 TLS_DH_DSS_WITH_AES_128_CBC_SHA DH_DSS AES_128_CBC SHA 3548 TLS_DH_RSA_WITH_AES_128_CBC_SHA DH_RSA AES_128_CBC SHA 3549 TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE_DSS AES_128_CBC SHA 3550 TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE_RSA AES_128_CBC SHA 3551 TLS_DH_anon_WITH_AES_128_CBC_SHA DH_anon AES_128_CBC SHA 3552 TLS_DH_DSS_WITH_AES_256_CBC_SHA DH_DSS AES_256_CBC SHA 3553 TLS_DH_RSA_WITH_AES_256_CBC_SHA DH_RSA AES_256_CBC SHA 3554 TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE_DSS AES_256_CBC SHA 3555 TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE_RSA AES_256_CBC SHA 3556 TLS_DH_anon_WITH_AES_256_CBC_SHA DH_anon AES_256_CBC SHA 3558 Key 3559 Exchange 3560 Algorithm Description Key size limit 3562 DHE_DSS Ephemeral DH with DSS signatures None 3563 DHE_RSA Ephemeral DH with RSA signatures None 3564 DH_anon Anonymous DH, no signatures None 3565 DH_DSS DH with DSS-based certificates None 3566 DH_RSA DH with RSA-based certificates None 3567 NULL No key exchange N/A 3568 RSA RSA key exchange None 3569 Key Expanded IV Block 3570 Cipher Type Material Key Material Size Size 3572 NULL Stream 0 0 0 N/A 3573 IDEA_CBC Block 16 16 8 8 3574 RC4_128 Stream 16 16 0 N/A 3575 DES_CBC Block 8 8 8 8 3576 3DES_EDE_CBC Block 24 24 8 8 3578 Type 3579 Indicates whether this is a stream cipher or a block cipher 3580 running in CBC mode. 3582 Key Material 3583 The number of bytes from the key_block that are used for 3584 generating the write keys. 3586 Expanded Key Material 3587 The number of bytes actually fed into the encryption algorithm. 3589 IV Size 3590 The amount of data needed to be generated for the initialization 3591 vector. Zero for stream ciphers; equal to the block size for 3592 block ciphers (this is equal to 3593 SecurityParameters.record_iv_length). 3595 Block Size 3596 The amount of data a block cipher enciphers in one chunk; a 3597 block cipher running in CBC mode can only encrypt an even 3598 multiple of its block size. 3600 Hash Hash Padding 3601 function Size Size 3602 NULL 0 0 3603 MD5 16 48 3604 SHA 20 40 3605 Appendix D. Implementation Notes 3607 The TLS protocol cannot prevent many common security mistakes. This 3608 section provides several recommendations to assist implementors. 3610 D.1 Random Number Generation and Seeding 3612 TLS requires a cryptographically secure pseudorandom number generator 3613 (PRNG). Care must be taken in designing and seeding PRNGs. PRNGs 3614 based on secure hash operations, most notably SHA-1, are acceptable, 3615 but cannot provide more security than the size of the random number 3616 generator state. 3618 To estimate the amount of seed material being produced, add the 3619 number of bits of unpredictable information in each seed byte. For 3620 example, keystroke timing values taken from a PC compatible's 18.2 Hz 3621 timer provide 1 or 2 secure bits each, even though the total size of 3622 the counter value is 16 bits or more. Seeding a 128-bit PRNG would 3623 thus require approximately 100 such timer values. 3625 [RANDOM] provides guidance on the generation of random values. 3627 D.2 Certificates and Authentication 3629 Implementations are responsible for verifying the integrity of 3630 certificates and should generally support certificate revocation 3631 messages. Certificates should always be verified to ensure proper 3632 signing by a trusted Certificate Authority (CA). The selection and 3633 addition of trusted CAs should be done very carefully. Users should 3634 be able to view information about the certificate and root CA. 3636 D.3 CipherSuites 3638 TLS supports a range of key sizes and security levels, including some 3639 that provide no or minimal security. A proper implementation will 3640 probably not support many cipher suites. For instance, anonymous 3641 Diffie-Hellman is strongly discouraged because it cannot prevent man- 3642 in-the-middle attacks. Applications should also enforce minimum and 3643 maximum key sizes. For example, certificate chains containing 512-bit 3644 RSA keys or signatures are not appropriate for high-security 3645 applications. 3647 D.4 Implementation Pitfalls 3649 Implementation experience has shown that certain parts of earlier TLS 3650 specifications are not easy to understand, and have been a source of 3651 interoperability and security problems. Many of these areas have been 3652 clarified in this document, but this appendix contains a short list 3653 of the most important things that require special attention from 3654 implementors. 3656 TLS protocol issues: 3658 - Do you correctly handle handshake messages that are fragmented 3659 to multiple TLS records (see Section 6.2.1)? Including corner 3660 cases like a ClientHello that is split to several small 3661 fragments? 3663 - Do you ignore the TLS record layer version number in all TLS 3664 records before ServerHello (see Appendix E.1)? 3666 - Do you handle TLS extensions in ClientHello correctly, 3667 including omitting the extensions field completely? 3669 - Do you support renegotiation, both client and server initiated? 3670 While renegotiation this is an optional feature, supporting 3671 it is highly recommended. 3673 - When the server has requested a client certificate, but no 3674 suitable certificate is available, do you correctly send 3675 an empty Certificate message, instead of omitting the whole 3676 message (see Section 7.4.6)? 3678 Cryptographic details: 3680 - In RSA-encrypted Premaster Secret, do you correctly send and 3681 verify the version number? When an error is encountered, do 3682 you continue the handshake to avoid the Bleichenbacher 3683 attack (see Section 7.4.7.1)? 3685 - What countermeasures do you use to prevent timing attacks against 3686 RSA decryption and signing operations (see Section 7.4.7.1)? 3688 - When verifying RSA signatures, do you accept both NULL and 3689 missing parameters (see Section 4.7)? Do you verify that the 3690 RSA padding doesn't have additional data after the hash value? 3691 [FI06] 3693 - When using Diffie-Hellman key exchange, do you correctly strip 3694 leading zero bytes from the negotiated key (see Section 8.1.2)? 3696 - Does your TLS client check that the Diffie-Hellman parameters 3697 sent by the server are acceptable (see Section F.1.1.3)? 3699 - How do you generate unpredictable IVs for CBC mode ciphers 3700 (see Section 6.2.3.2)? 3701 - How do you address CBC mode timing attacks (Section 6.2.3.2)? 3703 - Do you use a strong and, most importantly, properly seeded 3704 random number generator (see Appendix D.1) for generating the 3705 premaster secret (for RSA key exchange), Diffie-Hellman private 3706 values, the DSA "k" parameter, and other security-critical 3707 values? 3708 Appendix E. Backward Compatibility 3710 E.1 Compatibility with TLS 1.0/1.1 and SSL 3.0 3712 Since there are various versions of TLS (1.0, 1.1, 1.2, and any 3713 future versions) and SSL (2.0 and 3.0), means are needed to negotiate 3714 the specific protocol version to use. The TLS protocol provides a 3715 built-in mechanism for version negotiation so as not to bother other 3716 protocol components with the complexities of version selection. 3718 TLS versions 1.0, 1.1, and 1.2, and SSL 3.0 are very similar, and use 3719 compatible ClientHello messages; thus, supporting all of them is 3720 relatively easy. Similarly, servers can easily handle clients trying 3721 to use future versions of TLS as long as the ClientHello format 3722 remains compatible, and the client support the highest protocol 3723 version available in the server. 3725 A TLS 1.2 client who wishes to negotiate with such older servers will 3726 send a normal TLS 1.2 ClientHello, containing { 3, 3 } (TLS 1.2) in 3727 ClientHello.client_version. If the server does not support this 3728 version, it will respond with ServerHello containing an older version 3729 number. If the client agrees to use this version, the negotiation 3730 will proceed as appropriate for the negotiated protocol. 3732 If the version chosen by the server is not supported by the client 3733 (or not acceptable), the client MUST send a "protocol_version" alert 3734 message and close the connection. 3736 If a TLS server receives a ClientHello containing a version number 3737 greater than the highest version supported by the server, it MUST 3738 reply according to the highest version supported by the server. 3740 A TLS server can also receive a ClientHello containing version number 3741 smaller than the highest supported version. If the server wishes to 3742 negotiate with old clients, it will proceed as appropriate for the 3743 highest version supported by the server that is not greater than 3744 ClientHello.client_version. For example, if the server supports TLS 3745 1.0, 1.1, and 1.2, and client_version is TLS 1.0, the server will 3746 proceed with a TLS 1.0 ServerHello. If server supports (or is willing 3747 to use) only versions greater than client_version, it MUST send a 3748 "protocol_version" alert message and close the connection. 3750 Whenever a client already knows the highest protocol known to a 3751 server (for example, when resuming a session), it SHOULD initiate the 3752 connection in that native protocol. 3754 Note: some server implementations are known to implement version 3755 negotiation incorrectly. For example, there are buggy TLS 1.0 servers 3756 that simply close the connection when the client offers a version 3757 newer than TLS 1.0. Also, it is known that some servers will refuse 3758 connection if any TLS extensions are included in ClientHello. 3759 Interoperability with such buggy servers is a complex topic beyond 3760 the scope of this document, and may require multiple connection 3761 attempts by the client. 3763 Earlier versions of the TLS specification were not fully clear on 3764 what the record layer version number (TLSPlaintext.version) should 3765 contain when sending ClientHello (i.e., before it is known which 3766 version of the protocol will be employed). Thus, TLS servers 3767 compliant with this specification MUST accept any value {03,XX} as 3768 the record layer version number for ClientHello. 3770 TLS clients that wish to negotiate with older servers MAY send any 3771 value {03,XX} as the record layer version number. Typical values 3772 would be {03,00}, the lowest version number supported by the client, 3773 and the value of ClientHello.client_version. No single value will 3774 guarantee interoperability with all old servers, but this is a 3775 complex topic beyond the scope of this document. 3777 E.2 Compatibility with SSL 2.0 3779 TLS 1.2 clients that wish to support SSL 2.0 servers MUST send 3780 version 2.0 CLIENT-HELLO messages defined in [SSL2]. The message MUST 3781 contain the same version number as would be used for ordinary 3782 ClientHello, and MUST encode the supported TLS ciphersuites in the 3783 CIPHER-SPECS-DATA field as described below. 3785 Warning: The ability to send version 2.0 CLIENT-HELLO messages will be 3786 phased out with all due haste, since the newer ClientHello format 3787 provides better mechanisms for moving to newer versions and 3788 negotiating extensions. TLS 1.2 clients SHOULD NOT support SSL 2.0. 3790 However, even TLS servers that do not support SSL 2.0 SHOULD accept 3791 version 2.0 CLIENT-HELLO messages. The message is presented below in 3792 sufficient detail for TLS server implementors; the true definition is 3793 still assumed to be [SSL2]. 3795 For negotiation purposes, 2.0 CLIENT-HELLO is interpreted the same 3796 way as a ClientHello with a "null" compression method and no 3797 extensions. Note that this message MUST be sent directly on the wire, 3798 not wrapped as a TLS record. For the purposes of calculating Finished 3799 and CertificateVerify, the msg_length field is not considered to be a 3800 part of the handshake message. 3802 uint8 V2CipherSpec[3]; 3803 struct { 3804 uint16 msg_length; 3805 uint8 msg_type; 3806 Version version; 3807 uint16 cipher_spec_length; 3808 uint16 session_id_length; 3809 uint16 challenge_length; 3810 V2CipherSpec cipher_specs[V2ClientHello.cipher_spec_length]; 3811 opaque session_id[V2ClientHello.session_id_length]; 3812 opaque challenge[V2ClientHello.challenge_length; 3813 } V2ClientHello; 3815 msg_length 3816 The highest bit MUST be 1; the remaining bits contain the 3817 length of the following data in bytes. 3819 msg_type 3820 This field, in conjunction with the version field, identifies a 3821 version 2 client hello message. The value MUST be one (1). 3823 version 3824 Equal to ClientHello.client_version. 3826 cipher_spec_length 3827 This field is the total length of the field cipher_specs. It 3828 cannot be zero and MUST be a multiple of the V2CipherSpec length 3829 (3). 3831 session_id_length 3832 This field MUST have a value of zero for a client that claims to 3833 support TLS 1.2. 3835 challenge_length 3836 The length in bytes of the client's challenge to the server to 3837 authenticate itself. Historically, permissible values are between 3838 16 and 32 bytes inclusive. When using the SSLv2 backward 3839 compatible handshake the client SHOULD use a 32 byte challenge. 3841 cipher_specs 3842 This is a list of all CipherSpecs the client is willing and able 3843 to use. In addition to the 2.0 cipher specs defined in [SSL2], 3844 this includes the TLS cipher suites normally sent in 3845 ClientHello.cipher_suites, each cipher suite prefixed by a zero 3846 byte. For example, TLS ciphersuite {0x00,0x0A} would be sent as 3847 {0x00,0x00,0x0A}. 3849 session_id 3850 This field MUST be empty. 3852 challenge 3853 Corresponds to ClientHello.random. If the challenge length is 3854 less than 32, the TLS server will pad the data with leading 3855 (note: not trailing) zero bytes to make it 32 bytes long. 3857 Note: Requests to resume a TLS session MUST use a TLS client hello. 3859 E.3. Avoiding Man-in-the-Middle Version Rollback 3861 When TLS clients fall back to Version 2.0 compatibility mode, they 3862 MUST use special PKCS#1 block formatting. This is done so that TLS 3863 servers will reject Version 2.0 sessions with TLS-capable clients. 3865 When a client negotiates SSL 2.0 but also supports TLS, it MUST set 3866 the right-hand (least-significant) 8 random bytes of the PKCS padding 3867 (not including the terminal null of the padding) for the RSA 3868 encryption of the ENCRYPTED-KEY-DATA field of the CLIENT-MASTER-KEY 3869 to 0x03 (the other padding bytes are random). 3871 When a TLS-capable server negotiates SSL 2.0 it SHOULD, after 3872 decrypting the ENCRYPTED-KEY-DATA field, check that these eight 3873 padding bytes are 0x03. If they are not, the server SHOULD generate a 3874 random value for SECRET-KEY-DATA, and continue the handshake (which 3875 will eventually fail since the keys will not match). Note that 3876 reporting the error situation to the client could make the server 3877 vulnerable to attacks described in [BLEI]. 3879 Appendix F. Security Analysis 3881 The TLS protocol is designed to establish a secure connection between 3882 a client and a server communicating over an insecure channel. This 3883 document makes several traditional assumptions, including that 3884 attackers have substantial computational resources and cannot obtain 3885 secret information from sources outside the protocol. Attackers are 3886 assumed to have the ability to capture, modify, delete, replay, and 3887 otherwise tamper with messages sent over the communication channel. 3888 This appendix outlines how TLS has been designed to resist a variety 3889 of attacks. 3891 F.1. Handshake Protocol 3893 The handshake protocol is responsible for selecting a CipherSpec and 3894 generating a Master Secret, which together comprise the primary 3895 cryptographic parameters associated with a secure session. The 3896 handshake protocol can also optionally authenticate parties who have 3897 certificates signed by a trusted certificate authority. 3899 F.1.1. Authentication and Key Exchange 3901 TLS supports three authentication modes: authentication of both 3902 parties, server authentication with an unauthenticated client, and 3903 total anonymity. Whenever the server is authenticated, the channel is 3904 secure against man-in-the-middle attacks, but completely anonymous 3905 sessions are inherently vulnerable to such attacks. Anonymous 3906 servers cannot authenticate clients. If the server is authenticated, 3907 its certificate message must provide a valid certificate chain 3908 leading to an acceptable certificate authority. Similarly, 3909 authenticated clients must supply an acceptable certificate to the 3910 server. Each party is responsible for verifying that the other's 3911 certificate is valid and has not expired or been revoked. 3913 The general goal of the key exchange process is to create a 3914 pre_master_secret known to the communicating parties and not to 3915 attackers. The pre_master_secret will be used to generate the 3916 master_secret (see Section 8.1). The master_secret is required to 3917 generate the finished messages, encryption keys, and MAC secrets (see 3918 Sections 7.4.9 and 6.3). By sending a correct finished message, 3919 parties thus prove that they know the correct pre_master_secret. 3921 F.1.1.1. Anonymous Key Exchange 3923 Completely anonymous sessions can be established using Diffie-Hellman 3924 for key exchange. The server's public parameters are contained in the 3925 server key exchange message and the client's are sent in the client 3926 key exchange message. Eavesdroppers who do not know the private 3927 values should not be able to find the Diffie-Hellman result (i.e. the 3928 pre_master_secret). 3930 Warning: Completely anonymous connections only provide protection 3931 against passive eavesdropping. Unless an independent tamper- 3932 proof channel is used to verify that the finished messages 3933 were not replaced by an attacker, server authentication is 3934 required in environments where active man-in-the-middle 3935 attacks are a concern. 3937 F.1.1.2. RSA Key Exchange and Authentication 3939 With RSA, key exchange and server authentication are combined. The 3940 public key is contained in the server's certificate. Note that 3941 compromise of the server's static RSA key results in a loss of 3942 confidentiality for all sessions protected under that static key. TLS 3943 users desiring Perfect Forward Secrecy should use DHE cipher suites. 3944 The damage done by exposure of a private key can be limited by 3945 changing one's private key (and certificate) frequently. 3947 After verifying the server's certificate, the client encrypts a 3948 pre_master_secret with the server's public key. By successfully 3949 decoding the pre_master_secret and producing a correct finished 3950 message, the server demonstrates that it knows the private key 3951 corresponding to the server certificate. 3953 When RSA is used for key exchange, clients are authenticated using 3954 the certificate verify message (see Section 7.4.8). The client signs 3955 a value derived from all preceding handshake messages. These 3956 handshake messages include the server certificate, which binds the 3957 signature to the server, and ServerHello.random, which binds the 3958 signature to the current handshake process. 3960 F.1.1.3. Diffie-Hellman Key Exchange with Authentication 3962 When Diffie-Hellman key exchange is used, the server can either 3963 supply a certificate containing fixed Diffie-Hellman parameters or 3964 use the server key exchange message to send a set of temporary 3965 Diffie-Hellman parameters signed with a DSS or RSA certificate. 3966 Temporary parameters are hashed with the hello.random values before 3967 signing to ensure that attackers do not replay old parameters. In 3968 either case, the client can verify the certificate or signature to 3969 ensure that the parameters belong to the server. 3971 If the client has a certificate containing fixed Diffie-Hellman 3972 parameters, its certificate contains the information required to 3973 complete the key exchange. Note that in this case the client and 3974 server will generate the same Diffie-Hellman result (i.e., 3975 pre_master_secret) every time they communicate. To prevent the 3976 pre_master_secret from staying in memory any longer than necessary, 3977 it should be converted into the master_secret as soon as possible. 3978 Client Diffie-Hellman parameters must be compatible with those 3979 supplied by the server for the key exchange to work. 3981 If the client has a standard DSS or RSA certificate or is 3982 unauthenticated, it sends a set of temporary parameters to the server 3983 in the client key exchange message, then optionally uses a 3984 certificate verify message to authenticate itself. 3986 If the same DH keypair is to be used for multiple handshakes, either 3987 because the client or server has a certificate containing a fixed DH 3988 keypair or because the server is reusing DH keys, care must be taken 3989 to prevent small subgroup attacks. Implementations SHOULD follow the 3990 guidelines found in [SUBGROUP]. 3992 Small subgroup attacks are most easily avoided by using one of the 3993 DHE ciphersuites and generating a fresh DH private key (X) for each 3994 handshake. If a suitable base (such as 2) is chosen, g^X mod p can be 3995 computed very quickly, therefore the performance cost is minimized. 3996 Additionally, using a fresh key for each handshake provides Perfect 3997 Forward Secrecy. Implementations SHOULD generate a new X for each 3998 handshake when using DHE ciphersuites. 4000 Because TLS allows the server to provide arbitrary DH groups, the 4001 client should verify that the DH group is of suitable size as defined 4002 by local policy. The client SHOULD also verify that the DH public 4003 exponent appears to be of adequate size. [KEYSIZ] provides a useful 4004 guide to the strength of various group sizes. The server MAY choose 4005 to assist the client by providing a known group, such as those 4006 defined in [IKEALG] or [MODP]. These can be verified by simple 4007 comparison. 4009 F.1.2. Version Rollback Attacks 4011 Because TLS includes substantial improvements over SSL Version 2.0, 4012 attackers may try to make TLS-capable clients and servers fall back 4013 to Version 2.0. This attack can occur if (and only if) two TLS- 4014 capable parties use an SSL 2.0 handshake. 4016 Although the solution using non-random PKCS #1 block type 2 message 4017 padding is inelegant, it provides a reasonably secure way for Version 4018 3.0 servers to detect the attack. This solution is not secure against 4019 attackers who can brute force the key and substitute a new ENCRYPTED- 4020 KEY-DATA message containing the same key (but with normal padding) 4021 before the application specified wait threshold has expired. Altering 4022 the padding of the least significant 8 bytes of the PKCS padding does 4023 not impact security for the size of the signed hashes and RSA key 4024 lengths used in the protocol, since this is essentially equivalent to 4025 increasing the input block size by 8 bytes. 4027 F.1.3. Detecting Attacks Against the Handshake Protocol 4029 An attacker might try to influence the handshake exchange to make the 4030 parties select different encryption algorithms than they would 4031 normally chooses. 4033 For this attack, an attacker must actively change one or more 4034 handshake messages. If this occurs, the client and server will 4035 compute different values for the handshake message hashes. As a 4036 result, the parties will not accept each others' finished messages. 4037 Without the master_secret, the attacker cannot repair the finished 4038 messages, so the attack will be discovered. 4040 F.1.4. Resuming Sessions 4042 When a connection is established by resuming a session, new 4043 ClientHello.random and ServerHello.random values are hashed with the 4044 session's master_secret. Provided that the master_secret has not been 4045 compromised and that the secure hash operations used to produce the 4046 encryption keys and MAC secrets are secure, the connection should be 4047 secure and effectively independent from previous connections. 4048 Attackers cannot use known encryption keys or MAC secrets to 4049 compromise the master_secret without breaking the secure hash 4050 operations. 4052 Sessions cannot be resumed unless both the client and server agree. 4053 If either party suspects that the session may have been compromised, 4054 or that certificates may have expired or been revoked, it should 4055 force a full handshake. An upper limit of 24 hours is suggested for 4056 session ID lifetimes, since an attacker who obtains a master_secret 4057 may be able to impersonate the compromised party until the 4058 corresponding session ID is retired. Applications that may be run in 4059 relatively insecure environments should not write session IDs to 4060 stable storage. 4062 F.2. Protecting Application Data 4064 The master_secret is hashed with the ClientHello.random and 4065 ServerHello.random to produce unique data encryption keys and MAC 4066 secrets for each connection. 4068 Outgoing data is protected with a MAC before transmission. To prevent 4069 message replay or modification attacks, the MAC is computed from the 4070 MAC secret, the sequence number, the message length, the message 4071 contents, and two fixed character strings. The message type field is 4072 necessary to ensure that messages intended for one TLS Record Layer 4073 client are not redirected to another. The sequence number ensures 4074 that attempts to delete or reorder messages will be detected. Since 4075 sequence numbers are 64 bits long, they should never overflow. 4076 Messages from one party cannot be inserted into the other's output, 4077 since they use independent MAC secrets. Similarly, the server-write 4078 and client-write keys are independent, so stream cipher keys are used 4079 only once. 4081 If an attacker does break an encryption key, all messages encrypted 4082 with it can be read. Similarly, compromise of a MAC key can make 4083 message modification attacks possible. Because MACs are also 4084 encrypted, message-alteration attacks generally require breaking the 4085 encryption algorithm as well as the MAC. 4087 Note: MAC secrets may be larger than encryption keys, so messages can 4088 remain tamper resistant even if encryption keys are broken. 4090 F.3. Explicit IVs 4092 [CBCATT] describes a chosen plaintext attack on TLS that depends on 4093 knowing the IV for a record. Previous versions of TLS [TLS1.0] used 4094 the CBC residue of the previous record as the IV and therefore 4095 enabled this attack. This version uses an explicit IV in order to 4096 protect against this attack. 4098 F.4. Security of Composite Cipher Modes 4100 TLS secures transmitted application data via the use of symmetric 4101 encryption and authentication functions defined in the negotiated 4102 ciphersuite. The objective is to protect both the integrity and 4103 confidentiality of the transmitted data from malicious actions by 4104 active attackers in the network. It turns out that the order in 4105 which encryption and authentication functions are applied to the data 4106 plays an important role for achieving this goal [ENCAUTH]. 4108 The most robust method, called encrypt-then-authenticate, first 4109 applies encryption to the data and then applies a MAC to the 4110 ciphertext. This method ensures that the integrity and 4111 confidentiality goals are obtained with ANY pair of encryption and 4112 MAC functions, provided that the former is secure against chosen 4113 plaintext attacks and that the MAC is secure against chosen-message 4114 attacks. TLS uses another method, called authenticate-then-encrypt, 4115 in which first a MAC is computed on the plaintext and then the 4116 concatenation of plaintext and MAC is encrypted. This method has 4117 been proven secure for CERTAIN combinations of encryption functions 4118 and MAC functions, but it is not guaranteed to be secure in general. 4119 In particular, it has been shown that there exist perfectly secure 4120 encryption functions (secure even in the information-theoretic sense) 4121 that combined with any secure MAC function, fail to provide the 4122 confidentiality goal against an active attack. Therefore, new 4123 ciphersuites and operation modes adopted into TLS need to be analyzed 4124 under the authenticate-then-encrypt method to verify that they 4125 achieve the stated integrity and confidentiality goals. 4127 Currently, the security of the authenticate-then-encrypt method has 4128 been proven for some important cases. One is the case of stream 4129 ciphers in which a computationally unpredictable pad of the length of 4130 the message, plus the length of the MAC tag, is produced using a 4131 pseudo-random generator and this pad is xor-ed with the concatenation 4132 of plaintext and MAC tag. The other is the case of CBC mode using a 4133 secure block cipher. In this case, security can be shown if one 4134 applies one CBC encryption pass to the concatenation of plaintext and 4135 MAC and uses a new, independent, and unpredictable IV for each new 4136 pair of plaintext and MAC. In versions of TLS prior to 1.1, CBC mode 4137 was used properly EXCEPT that it used a predictable IV in the form of 4138 the last block of the previous ciphertext. This made TLS open to 4139 chosen plaintext attacks. This version of the protocol is immune to 4140 those attacks. For exact details in the encryption modes proven 4141 secure, see [ENCAUTH]. 4143 F.5 Denial of Service 4145 TLS is susceptible to a number of denial of service (DoS) attacks. 4146 In particular, an attacker who initiates a large number of TCP 4147 connections can cause a server to consume large amounts of CPU doing 4148 RSA decryption. However, because TLS is generally used over TCP, it 4149 is difficult for the attacker to hide his point of origin if proper 4150 TCP SYN randomization is used [SEQNUM] by the TCP stack. 4152 Because TLS runs over TCP, it is also susceptible to a number of 4153 denial of service attacks on individual connections. In particular, 4154 attackers can forge RSTs, thereby terminating connections, or forge 4155 partial TLS records, thereby causing the connection to stall. These 4156 attacks cannot in general be defended against by a TCP-using 4157 protocol. Implementors or users who are concerned with this class of 4158 attack should use IPsec AH [AH] or ESP [ESP]. 4160 F.6 Final Notes 4162 For TLS to be able to provide a secure connection, both the client 4163 and server systems, keys, and applications must be secure. In 4164 addition, the implementation must be free of security errors. 4166 The system is only as strong as the weakest key exchange and 4167 authentication algorithm supported, and only trustworthy 4168 cryptographic functions should be used. Short public keys and 4169 anonymous servers should be used with great caution. Implementations 4170 and users must be careful when deciding which certificates and 4171 certificate authorities are acceptable; a dishonest certificate 4172 authority can do tremendous damage. 4174 Changes in This Version 4176 [RFC Editor: Please delete this] 4178 - Redid the hash function advertisements for CertificateRequest 4179 and the client-side extension. They are now pairs of 4180 hash/signature and the semantics are clearly defined for 4181 all uses of signatures (hopefully). [Issue 41] 4183 - Clarified the DH group checking per list discussion [Issue 35] 4185 - Added a note about DSS vs. DSA [Issue 58] 4187 - Editorial issues [Issue 59] 4189 - Cleaned up certificate text in 7.4.2 and 7.4.6 [Issue 57] 4191 Normative References 4192 [AES] National Institute of Standards and Technology, 4193 "Specification for the Advanced Encryption Standard (AES)" 4194 FIPS 197. November 26, 2001. 4196 [3DES] National Institute of Standards and Technology, 4197 "Recommendation for the Triple Data Encryption Algorithm 4198 (TDEA) Block Cipher", NIST Special Publication 800-67, May 4199 2004. 4201 [DES] National Institute of Standards and Technology, "Data 4202 Encryption Standard (DES)", FIPS PUB 46-3, October 1999. 4204 [DSS] NIST FIPS PUB 186-2, "Digital Signature Standard," National 4205 Institute of Standards and Technology, U.S. Department of 4206 Commerce, 2000. 4208 [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 4209 Hashing for Message Authentication", RFC 2104, February 4210 1997. 4212 [IDEA] X. Lai, "On the Design and Security of Block Ciphers," ETH 4213 Series in Information Processing, v. 1, Konstanz: Hartung- 4214 Gorre Verlag, 1992. 4216 [MD5] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321, 4217 April 1992. 4219 [PKCS1] J. Jonsson, B. Kaliski, "Public-Key Cryptography Standards 4220 (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 4221 3447, February 2003. 4223 [PKIX] Housley, R., Ford, W., Polk, W. and D. Solo, "Internet X.509 4224 Public Key Infrastructure Certificate and Certificate 4225 Revocation List (CRL) Profile", RFC 3280, April 2002. 4227 [RC2] Rivest, R., "A Description of the RC2(r) Encryption 4228 Algorithm", RFC 2268, March 1998. 4230 [SCH] B. Schneier. "Applied Cryptography: Protocols, Algorithms, 4231 and Source Code in C, 2nd ed.", Published by John Wiley & 4232 Sons, Inc. 1996. 4234 [SHA] NIST FIPS PUB 180-2, "Secure Hash Standard," National 4235 Institute of Standards and Technology, U.S. Department of 4236 Commerce., August 2001. 4238 [REQ] Bradner, S., "Key words for use in RFCs to Indicate 4239 Requirement Levels", BCP 14, RFC 2119, March 1997. 4241 [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an 4242 IANA Considerations Section in RFCs", BCP 25, RFC 2434, 4243 October 1998. 4245 Informative References 4247 [AEAD] Mcgrew, D., "Authenticated Encryption", February 2007, 4248 draft-mcgrew-auth-enc-02.txt. 4250 [AH] Kent, S., and Atkinson, R., "IP Authentication Header", RFC 4251 4302, December 2005. 4253 [BLEI] Bleichenbacher D., "Chosen Ciphertext Attacks against 4254 Protocols Based on RSA Encryption Standard PKCS #1" in 4255 Advances in Cryptology -- CRYPTO'98, LNCS vol. 1462, pages: 4257 1-12, 1998. 4259 [CBCATT] Moeller, B., "Security of CBC Ciphersuites in SSL/TLS: 4260 Problems and Countermeasures", 4261 http://www.openssl.org/~bodo/tls-cbc.txt. 4263 [CBCTIME] Canvel, B., Hiltgen, A., Vaudenay, S., and M. Vuagnoux, 4264 "Password Interception in a SSL/TLS Channel", Advances in 4265 Cryptology -- CRYPTO 2003, LNCS vol. 2729, 2003. 4267 [CCM] "NIST Special Publication 800-38C: The CCM Mode for 4268 Authentication and Confidentiality", 4269 http://csrc.nist.gov/publications/nistpubs/800-38C/ 4270 SP800-38C.pdf 4272 [ENCAUTH] Krawczyk, H., "The Order of Encryption and Authentication 4273 for Protecting Communications (Or: How Secure is SSL?)", 4274 Crypto 2001. 4276 [ESP] Kent, S., and Atkinson, R., "IP Encapsulating Security 4277 Payload (ESP)", RFC 4303, December 2005. 4279 [FI06] Hal Finney, "Bleichenbacher's RSA signature forgery based on 4280 implementation error", ietf-openpgp@imc.org mailing list, 27 4281 August 2006, http://www.imc.org/ietf-openpgp/mail- 4282 archive/msg14307.html. 4284 [GCM] "NIST Special Publication 800-38D DRAFT (June, 2007): 4285 Recommendation for Block Cipher Modes of Operation: 4286 Galois/Counter Mode (GCM) and GMAC" 4288 [IKEALG] Schiller, J., "Cryptographic Algorithms for Use in the 4289 Internet Key Exchange Version 2 (IKEv2)", RFC 4307, December 4290 2005. 4292 [KEYSIZ] Orman, H., and Hoffman, P., "Determining Strengths For 4293 Public Keys Used For Exchanging Symmetric Keys" RFC 3766, 4294 April 2004. 4296 [KPR03] Klima, V., Pokorny, O., Rosa, T., "Attacking RSA-based 4297 Sessions in SSL/TLS", http://eprint.iacr.org/2003/052/, 4298 March 2003. 4300 [MODP] Kivinen, T. and M. Kojo, "More Modular Exponential (MODP) 4301 Diffie-Hellman groups for Internet Key Exchange (IKE)", RFC 4302 3526, May 2003. 4304 [PKCS6] RSA Laboratories, "PKCS #6: RSA Extended Certificate Syntax 4305 Standard," version 1.5, November 1993. 4307 [PKCS7] RSA Laboratories, "PKCS #7: RSA Cryptographic Message Syntax 4308 Standard," version 1.5, November 1993. 4310 [RANDOM] Eastlake, D., 3rd, Schiller, J., and S. Crocker, 4311 "Randomness Requirements for Security", BCP 106, RFC 4086, 4312 June 2005. 4314 [RFC3749] Hollenbeck, S., "Transport Layer Security Protocol 4315 Compression Methods", RFC 3749, May 2004. 4317 [RFC4366] Blake-Wilson, S., Nystrom, M., Hopwood, D., Mikkelsen, J., 4318 Wright, T., "Transport Layer Security (TLS) Extensions", RFC 4319 4366, April 2006. 4321 [RSA] R. Rivest, A. Shamir, and L. M. Adleman, "A Method for 4322 Obtaining Digital Signatures and Public-Key Cryptosystems," 4323 Communications of the ACM, v. 21, n. 2, Feb 1978, pp. 4324 120-126. 4326 [SEQNUM] Bellovin. S., "Defending Against Sequence Number Attacks", 4327 RFC 1948, May 1996. 4329 [SSL2] Hickman, Kipp, "The SSL Protocol", Netscape Communications 4330 Corp., Feb 9, 1995. 4332 [SSL3] A. Freier, P. Karlton, and P. Kocher, "The SSL 3.0 4333 Protocol", Netscape Communications Corp., Nov 18, 1996. 4335 [SUBGROUP] Zuccherato, R., "Methods for Avoiding the "Small-Subgroup" 4336 Attacks on the Diffie-Hellman Key Agreement Method for 4337 S/MIME", RFC 2785, March 2000. 4339 [TCP] Postel, J., "Transmission Control Protocol," STD 7, RFC 793, 4340 September 1981. 4342 [TIMING] Boneh, D., Brumley, D., "Remote timing attacks are 4343 practical", USENIX Security Symposium 2003. 4345 [TLSAES] Chown, P., "Advanced Encryption Standard (AES) Ciphersuites 4346 for Transport Layer Security (TLS)", RFC 3268, June 2002. 4348 [TLSECC] Blake-Wilson, S., Bolyard, N., Gupta, V., Hawk, C., and 4349 Moeller, B., "Elliptic Curve Cryptography (ECC) Cipher 4350 Suites for Transport Layer Security (TLS)", RFC 4492, May 4351 2006. 4353 [TLSEXT] Eastlake, D.E., "Transport Layer Security (TLS) Extensions: 4354 Extension Definitions", July 2007, draft-ietf-tls- 4355 rfc4366-bis-00.txt. 4357 [TLSPGP] Mavrogiannopoulos, N., "Using OpenPGP keys for TLS 4358 authentication", draft-ietf-tls-openpgp-keys-11, July 2006. 4360 [TLSPSK] Eronen, P., Tschofenig, H., "Pre-Shared Key Ciphersuites 4361 for Transport Layer Security (TLS)", RFC 4279, December 4362 2005. 4364 [TLS1.0] Dierks, T., and C. Allen, "The TLS Protocol, Version 1.0", 4365 RFC 2246, January 1999. 4367 [TLS1.1] Dierks, T., and E. Rescorla, "The TLS Protocol, Version 4368 1.1", RFC 4346, April, 2006. 4370 [X501] ITU-T Recommendation X.501: Information Technology - Open 4371 Systems Interconnection - The Directory: Models, 1993. 4373 [XDR] Eisler, M., "External Data Representation Standard", RFC 4374 4506, May 2006. 4376 Credits 4378 Working Group Chairs 4379 Eric Rescorla 4380 EMail: ekr@networkresonance.com 4382 Pasi Eronen 4383 pasi.eronen@nokia.com 4385 Editors 4387 Tim Dierks Eric Rescorla 4388 Independent Network Resonance, Inc. 4390 EMail: tim@dierks.org EMail: ekr@networkresonance.com 4392 Other contributors 4394 Christopher Allen (co-editor of TLS 1.0) 4395 Alacrity Ventures 4396 ChristopherA@AlacrityManagement.com 4397 Martin Abadi 4398 University of California, Santa Cruz 4399 abadi@cs.ucsc.edu 4401 Steven M. Bellovin 4402 Columbia University 4403 smb@cs.columbia.edu 4405 Simon Blake-Wilson 4406 BCI 4407 EMail: sblakewilson@bcisse.com 4409 Ran Canetti 4410 IBM 4411 canetti@watson.ibm.com 4413 Pete Chown 4414 Skygate Technology Ltd 4415 pc@skygate.co.uk 4417 Taher Elgamal 4418 taher@securify.com 4419 Securify 4421 Anil Gangolli 4422 anil@busybuddha.org 4424 Kipp Hickman 4426 Alfred Hoenes 4428 David Hopwood 4429 Independent Consultant 4430 EMail: david.hopwood@blueyonder.co.uk 4432 Phil Karlton (co-author of SSLv3) 4434 Paul Kocher (co-author of SSLv3) 4435 Cryptography Research 4436 paul@cryptography.com 4438 Hugo Krawczyk 4439 Technion Israel Institute of Technology 4440 hugo@ee.technion.ac.il 4442 Jan Mikkelsen 4443 Transactionware 4444 EMail: janm@transactionware.com 4445 Magnus Nystrom 4446 RSA Security 4447 EMail: magnus@rsasecurity.com 4449 Robert Relyea 4450 Netscape Communications 4451 relyea@netscape.com 4453 Jim Roskind 4454 Netscape Communications 4455 jar@netscape.com 4457 Michael Sabin 4459 Dan Simon 4460 Microsoft, Inc. 4461 dansimon@microsoft.com 4463 Tom Weinstein 4465 Tim Wright 4466 Vodafone 4467 EMail: timothy.wright@vodafone.com 4469 Comments 4471 The discussion list for the IETF TLS working group is located at the 4472 e-mail address . Information on the group and 4473 information on how to subscribe to the list is at 4474 4476 Archives of the list can be found at: 4477 4478 Full Copyright Statement 4480 Copyright (C) The IETF Trust (2007). 4482 This document is subject to the rights, licenses and restrictions 4483 contained in BCP 78, and except as set forth therein, the authors 4484 retain all their rights. 4486 This document and the information contained herein are provided on an 4487 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4488 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 4489 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 4490 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 4491 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4492 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4494 Intellectual Property 4496 The IETF takes no position regarding the validity or scope of any 4497 Intellectual Property Rights or other rights that might be claimed to 4498 pertain to the implementation or use of the technology described in 4499 this document or the extent to which any license under such rights 4500 might or might not be available; nor does it represent that it has 4501 made any independent effort to identify any such rights. Information 4502 on the procedures with respect to rights in RFC documents can be 4503 found in BCP 78 and BCP 79. 4505 Copies of IPR disclosures made to the IETF Secretariat and any 4506 assurances of licenses to be made available, or the result of an 4507 attempt made to obtain a general license or permission for the use of 4508 such proprietary rights by implementers or users of this 4509 specification can be obtained from the IETF on-line IPR repository at 4510 http://www.ietf.org/ipr. 4512 The IETF invites any interested party to bring to its attention any 4513 copyrights, patents or patent applications, or other proprietary 4514 rights that may cover technology that may be required to implement 4515 this standard. Please address the information to the IETF at 4516 ietf-ipr@ietf.org. 4518 Acknowledgment 4520 Funding for the RFC Editor function is provided by the IETF 4521 Administrative Support Activity (IASA).