view Side-By-Side changes
IPSEC Working GroupDan Harkins INTERNET-DRAFTCharlie KaufmanSteve Kent Tero Kivinen Radia Perlman editors draft-ietf-ipsec-ikev2-02.txt AprilINTERNET-DRAFT editor draft-ietf-ipsec-ikev2-03.txt October 2002Proposal for the IKEv2Internet Key Exchange (IKEv2) Protocol<draft-ietf-ipsec-ikev2-02.txt><draft-ietf-ipsec-ikev2-03.txt> Status of this Memo This document is an Internet Draft and is in full conformance with all provisions of Section 10 of RFC2026 [Bra96]. Internet Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and working groups. Note that other groups may also distribute working documents as Internet Drafts. Internet Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet Drafts as reference material or to cite them other than as "work in progress."The list ofTo learn the currentInternet-Drafts can be accessed at http://www.ietf.org/1id-abstracts.html The liststatus ofInternet-Draftany Internet Draft, please check the "1id-abstracts.txt" listing contained in the Internet Drafts Shadow Directoriescan be accessed at http://www.ietf.org/shadow.htmlon ftp.is.co.za (Africa), nic.nordu.net (Europe), munnari.oz.au (Australia), ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast). Abstract This document describes version 2 of the IKE (Internet Key Exchange) protocol. IKE performs mutual authentication and establishes an IKE security association that can be used to efficiently establish SAs for ESP, AH and/or IPcomp. This version greatly simplifies IKE by replacing the 8 possible phase 1 exchanges with a single exchange based on either public signature keys or shared secret keys. The single exchange provides identity hiding, yet works in 2 round trips (all the identity hiding exchanges in IKE v1 required 3 round trips). Latency of setup of an IPsec SA is further reduced from IKEv1 by allowing setup of an SA for ESP, AH, and/or IPcomp to be piggybacked on the initial IKE exchange. It also improves security by allowing the Responder to be stateless until it can be assured that the Initiator can receive at the claimed IP source address. This versionHarkins Kaufman Kent Kivinen Perlman [Page 1] INTERNET DRAFT April 2002also presents the entire protocol in a single self-contained document, in contrast to IKEv1, in which the protocol was described in ISAKMP (RFC 2408), IKE (RFC 2409), and the DOI (RFC 2407) documents. IKEv2 [Page 1] INTERNET DRAFT October 2002 Table of Contents1. Introduction..............................................3 1.1Abstract.....................................................1 1 Summary of Changes from IKEv1..............................3 2 Requirements Terminology...................................4 3 IKE Protocol Overview......................................4 3.1 The Initial (Phase 1) Exchange...........................6 3.2 The CREATE_CHILD_SA (Phase 2) Exchange...................7 3.3 Informational (Phase 2) Exchange.........................9 4 IKEProtocol.........................................3 1.2 Change History...........................................4 1.3 Requirements Terminology.................................7 2ProtocolOverview..........................................7 2.1Details and Variations.......................10 4.1 Use of RetransmissionTimers.............................8 2.2Timers............................10 4.2 Use of Sequence Numbers for MessageID...................8 2.3ID..................11 4.3 Window Size for overlappingrequests.....................9 2.4requests....................12 4.4 State Synchronization and ConnectionTimeouts............9 2.5Timeouts...........12 4.5 Version Numbers and ForwardCompatibility................11 2.6 Cookies..................................................12 2.7Compatibility...............14 4.6 Cookies.................................................15 4.7 Cryptographic AlgorithmNegotiation......................16 2.8 Rekeying.................................................17 2.9Negotiation.....................18 4.8 Rekeying................................................19 4.9 Traffic SelectorNegotiation.............................18 2.10 Nonces..................................................18 2.11Negotiation............................20 4.10 Nonces.................................................21 4.11 Address and PortAgility................................19 2.12Agility...............................22 4.12 Reuse of Diffie-HellmanExponentials....................19 3 The Phase 1 Exchange.......................................20 3.1Exponentials...................22 4.13 Generating Keying Material.............................23 4.14 Generating Keying Material for theIKE-SA................21 3.2IKE-SA..............23 4.15 Authentication of theIKE-SA.............................22 4 The CREATE-CHILD-SA (Phase 2) Exchange.....................23 4.1 Generating Keying Material for Child-SAs.................24 4.2IKE-SA...........................24 4.16 Generating Keying Material for Child-SAs...............25 4.17 Rekaying IKE-SAsduring rollover...25 5 Informational (Phase 2) Exchange...........................26 6using a CREATE_CHILD_SA exchange......26 4.18 ErrorHandling.............................................27 7Handling.........................................26 5 Header and PayloadFormats.................................28 7.1Formats................................27 5.1 The IKEHeader...........................................28 7.2Header..........................................27 5.2 Generic PayloadHeader...................................30 7.3Header..................................30 5.3 Security AssociationPayload.............................32 7.3.1Payload............................31 5.3.1 ProposalSubstructure..................................34 7.3.2 Transform Substructure.................................36 7.3.3 Mandatory Transform Types..............................39 7.3.4 Mandatory Transform-IDs................................39 7.3.5 Transform Attributes...................................40 7.3.6 Attribute Negotiation..................................41 7.4Substructure.................................32 5.4 Key ExchangePayload.....................................41 7.5Payload....................................33 5.5 IdentificationPayload...................................42 7.6Payload..................................34 5.6 CertificatePayload......................................44 7.7Payload.....................................36 5.7 Certificate RequestPayload..............................45 Harkins Kaufman Kent Kivinen Perlman [Page 2] INTERNET DRAFT April 2002 7.8Payload.............................37 5.8 AuthenticationPayload...................................46 7.9Payload..................................38 5.9 NoncePayload............................................47 7.10Payload...........................................39 5.10 NotifyPayload..........................................48 7.10.1Payload.........................................40 5.10.1 Notify MessageTypes..................................49 7.11Types.................................41 5.11 DeletePayload..........................................53 7.12Payload.........................................43 5.12 Vendor IDPayload.......................................54 7.13Payload......................................45 5.13 Traffic SelectorPayload................................55 7.13.1Payload...............................46 5.13.1 TrafficSelector Substructure.........................56 7.14Selector.....................................46 5.14 Encrypted Payload......................................48 5.15 Other Payloadtypes.....................................58types....................................49 IKEv2 [Page 2] INTERNET DRAFT October 2002 6 Conformance Requirements..................................50 7 Security Considerations...................................50 8Diffie-Hellman Groups......................................58IANA Considerations.......................................51 9Security Considerations....................................60Acknowledgements..........................................52 10IANA Considerations.......................................61 10.1 Transform Types and Attribute Values....................61 10.2 Exchange Types..........................................59 10.3 Payload Types...........................................63 11 Acknowledgements..........................................63 12 References................................................63 Appendix A: Attribute Assigned Numbers.......................66References...............................................52 Appendix B:Cryptographic ProtectionDiffie-Hellman Groups...........................55 Change History..............................................58 Author's Address............................................59 1 Summary ofIKE Data.............68 Authors' Addresses...........................................70 1. Introduction IP Security (IPsec) provides confidentiality, data integrity, and data source authentication to IP datagrams. These services are provided by maintaining shared state between the source and the sinkchanges from IKEv1 The goals ofan IP datagram. This state defines, among other things, the specific services provided to the datagram, which cryptographic algorithms will be used to provide the services, and the keys used as inputthis revision to IKE are: 1) To define thecryptographic algorithms. Establishing this shared state in a manual fashion does not scale well. Therefore aentire IKE protocolto establish this state dynamically is needed. This memo describes suchin aprotocol-- the Internet Key Exchange (IKE). This is version 2 of IKE. Version 1 of IKE was defined in RFCs 2407, 2408, and 2409. Thissingledocument is intended to replace alldocument, rather than threeof those RFCs. 1.1 The IKE Protocol IKE performs mutual authentication between two parties and establishes an IKE security association that includes shared secret informationthatcan be used to efficiently establish SAs for ESP (RFC 2406), AH (RFC 2402) and/or IPcomp (RFC 2393). We call thecross reference one another; 2) To simplify IKESA an "IKE-SA", andby replacing theSAs for ESP, AH, and/or IPcomp that get set up through that IKE-SA we call "child-SA"s. We calleight different initial phase 1 exchanges with a single four message exchange (with changes in authentication mechanisms affecting only a single AUTH payload rather than restructuring thesetupentire exchange); 3) To remove the Domain of Interpretation (DOI), Situation (SIT), and Labeled Domain Identifier fields, and theIKE-SA "phase 1"Commit andsubsequent IKE Harkins Kaufman Kent Kivinen Perlman [Page 3] INTERNET DRAFT April 2002 exchanges "phase 2" even though setup of a child-SA can be piggybacked onAuthentication only bits; 4) To decrease IKE's latency by making the initialphase 1 exchange. The phase 1exchangeis two request/response pairs. A phasebe 2exchange is one request/response pair,round trips (4 messages), andcan be used to create or delete a child- SA, rekey or deleteallowing theIKE-SA, or give information such as error conditions. IKE message flow always consistsability to piggyback setup of arequest followed by a response. It isChild-SA on that exchange; 5) To replace theresponsibility ofcryptographic syntax for protecting therequesterIKE messages themselves with one based closely on ESP toensure reliability. If the response is not received within a timeout interval, the requester retransmitssimplify implementation and security analysis; 6) To reduce therequest. The first request/responsenumber ofa phase 1 exchange, which we'll call IKE_SA_init, negotiates security parameters forpossible error states by making theIKE-SA,protocol reliable (all messages are acknowledged) andsends Diffie-Hellman values. We callsequenced. This allows shortening Phase 2 exchanges from 3 messages to 2; 7) To increase robustness by allowing theresponse IKE_SA_init_response. The second request/response, which we'll call IKE_auth, transmits identities, proves knowledge ofresponder to not do significant processing until it receives a message proving that theprivate signature key,initiator can receive messages at its claimed IP address, andsets upnot commit any state to anSA forexchange until thefirst (and often only) AH and/or ESP and/or IPcomp. We callinitiator can be cryptographically authenticated; 8) To fix bugs such as theresponse IKE_auth_response. Ifhash problem documented in [draft-ietf- ipsec-ike-hash-revised-02.txt]; 9) To specify Traffic Selectors in their own payloads type rather IKEv2 [Page 3] INTERNET DRAFT October 2002 than overloading ID payloads, and making more flexible theResponder feels it is under attack,Traffic Selectors that may be specified; 10) To replace the complex mix andwishes to use a stateless cookie (see sectionmatch negotiation of cryptographic algorithms with proposals based oncookies).suites of algorithms. 11) To specify required behavior under certain error conditions or when data that is not understood is received in order to make itcan respondeasier toan IKE_SA_init with an IKE_SA_init_reject withmake future revisions in acookie valueway thatmust be sent with a subsequent IKE_SA_init_request. The Initiator then sends another IKE_SA_init, but this time includingdoes not break backwards compatibility; 12) To simplify and clarify how shared state is maintained in theResponder's cookie value. Phase 2 exchanges each consistpresence ofa single request/response pair. The typesnetwork failures and Denial ofexchanges are CREATE_CHILD_SA (creates a child-SA), or an informational exchange which deletes a child-SA or the IKE-SA or informsService attacks; and 13) To maintain existing syntax and magic numbers to theother sideextent possible to make it likely that implementations ofsome error condition. All these messages require a response, so an informational message with no payloads can serve as a check for liveness. 1.2 Change History 1.2.1 Changes fromIKEv1 can be enhanced toIKEv2-00 November 2001 The goals ofsupport IKEv2 with minimum effort. 2 Requirements Terminology Keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT" and "MAY" that appear in thisrevisiondocument are toIKE are: 1) To define the entire IKE protocolbe interpreted as described ina single document, rather than three that cross reference one another; 2) To simplify[Bra97]. 3 IKE Protocol Overview IP Security (IPsec) provides confidentiality, data integrity, and data source authentication to IP datagrams. These services are provided byeliminatingmaintaining shared state between theAggressive Mode optionsource andall but onethe sink of an IP datagram. This state defines, among other things, theauthenticationspecific services provided to the datagram, which cryptographic algorithmsmaking phase 1 a single exchange (based on public signature keys); Harkins Kaufman Kent Kivinen Perlman [Page 4] INTERNET DRAFT April 2002 3) To removewill be used to provide theDomain of Interpretation (DOI), Situation (SIT), and Labeled Domain Identifier fields,services, and theCommit and Authentication only bits; 4) To decrease IKE's latency by makingkeys used as input to theinitial exchange becryptographic algorithms. Establishing this shared state in a manual fashion does not scale well. Therefore a protocol to establish this state dynamically is needed. This memo describes such a protocol-- the Internet Key Exchange (IKE). This is version 2round trips (4 messages),of IKE. Version 1 of IKE was defined in RFCs 2407, 2408, andallowing the ability2409. This single document is intended topiggyback setupreplace all three ofa Child-SA onthose RFCs. IKE performs mutual authentication between two parties and establishes an IKE security association thatexchange; 5) To replace the cryptographic algorithmsincludes shared secret information that can be used to efficiently establish SAs forprotectingESP (RFC 2406), AH (RFC 2402) and/or IPcomp (RFC 2393). We call the IKE SA an "IKE-SA". The SAs for ESP, AH, and/or IPcomp that get set up through that IKE-SA we call "child-SA"s. IKEv2 [Page 4] INTERNET DRAFT October 2002 We call the first four messagesthemselves with one based closely on ESP to simplify implementationestablishing an IKE-SA a "phase 1" exchange andsecurity analysis; 6) To reducesubsequent IKE exchanges "phase 2", inheriting this terminology from IKEv1. The phase 1 exchange establishes thenumber of possible error states by makingIKE-SA and theprotocol reliable (all messages are acknowledged)first child-SA. In some scenarios, only a single child-SA is needed between the IPsec endpoints andsequenced. This allows shorteningtherefore there would be no phase 2 exchanges. Phase 2 exchangesfrom 3 messages to 2; 7) To increase robustness by allowing the Responder, if under attack,MAY be used torequire return of a cookie beforeestablish additional child-SAs between theResponder commits any statesame authenticated pair of endpoints as well as other housekeeping. The phase 1 exchange consists of two request/response pairs. A phase 2 exchange is one request/response pair, and can be used to create or delete a child-SA, rekey or delete theexchange; 8) To fix bugsIKE-SA, or report information such asthe hash problem documented in [draft-ietf- ipsec-ike-hash-revised-02.txt]; 9) To specify Traffic Selectors in their own payload type rather then overloading ID payloads, and making more flexible the Traffic Selectors that may be specified; 10) To avoid unnecessary exponential explosionerror conditions. IKE message flow always consists ofspace in attribute negotiation,a request followed byallowing choices when multiple algorithms of one type (say, encryption) can work with any ofanumber of acceptable algorithmsresponse. It is the responsibility ofanother type (say, integrity protection); 11) To specify required behavior under certain error conditions or when data thatthe requester to ensure reliability. If the response is notunderstood isreceivedin order to make it easier to make future revisions inwithin away that does not break backwards compatibility; 12) To simplify and clarify how shared state is maintained intimeout interval, thepresence of network failures and Denialrequester MUST retransmit the request (or abandon the connection). The first request/response ofService attacks;a phase 1 exchange negotiates security parameters for the IKE-SA, sends nonces, and13) To maintain existing syntaxsends Diffie-Hellman values. We call the request message IKE_SA_init andmagic numbers totheextent possible to make it likely that implementations of IKEv1 can be enhanced to support IKEv2 with minimum effort. 1.2.2 Changes from IKEv2-00 to IKEv2-01 February 2002 1) Changed Appendix B to specify the encryptionresponse IKE_SA_init_response. The second request/response, which we'll call IKE_auth andauthentication processing for IKE rather than referencing ESP. Simplified the format Harkins Kaufman Kent Kivinen Perlman [Page 5] INTERNET DRAFT April 2002 by removing idiosyncracies not needed for IKE. 2) Added option for authentication via a shared secret key. 3) Specified different keys in the two directions of IKE messages. Removed requirementIKE_auth_response transmits identities, proves knowledge ofdifferent cookies in the two directions since now no longer required. 4) Changethequantities signed by the two ends in AUTH fieldssecrets corresponding toassurethe twoparties sign different quantities. 5) Changed reference to AES to AES_128. 6) Removed requirement that Diffie-Hellman be repeated when rekeying IKE SA. 7) Fixed typos. 8) Clarified requirements around use of port 500 at the remote end in support of NAT. 9) Clarified required ordering for payloads. 10) Suggested mechanismsidentities, and sets up an SA foravoiding DoS attacks. 11) Removed claims in some places thatthe firstphase 2 piggybacked on phase 1 was optional. 1.2.3 Changes from IKEv2-01(and often only) AH and/or ESP and/or IPcomp child-SA. In order toIKEv2-02 April 2002 1) Moved the Initiator CERTREQ payload from message 1allow Bob to be stateless until receiving message3. 2) Added a second optional ID payload in3, message 3for the Initiator to name a desired Respondermust repeat all of message 1 and Bob must be able tosupport the case where multiple named identities are served by a single IP address. 3) Deleted the optimization whereby the Diffie-Hellman group did not need to be specifiedreconstruct (bit for bit) what he sent inphasemessage 2. Phase 2if it wasexchanges each consist of a single request/response pair. The types of exchanges are CREATE_CHILD_SA (which creates a child-SA), or an Informational exchange which deletes a child-SA or thesame as in phase 1 (it complicatedIKE-SA or informs thedesignother side of some error condition. All these messages require a response. An informational message with nomeaningful benefit). 4) Addedpayloads is commonly used as asection on the implications of reusing Diffie-Hellman expontentials 5) Changedcheck for liveness. In thespecification of sequence numbersdescription that follow, we assume that no errors occur. Modifications tobeing at 0 in both directions. 6) Many editorial changes and corrections,themost significant beingflow should errors occur are described in section 4. 3.1 The Initial (Phase 1) Exchange The base Phase 1 exchange is aglobal replacefour message exchange (two request/response pairs). The first pair of"byte" with "octet". Harkins Kaufman Kent Kivinen Perlmanmessages (IKE_SA_init) negotiate cryptographic algorithms, exchange nonces, and do a Diffie-Hellman exchange. IKEv2 [Page6]5] INTERNET DRAFTAprilOctober 20021.3 Requirements Terminology Keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT"The second pair of messages (IKE_AUTH) authenticate the previous messages, exchange identities and"MAY" that appear in this documentcertificates, and establish the first child_SA. Parts of these messages areto be interpreted as describedencrypted and integrity protected with keys established through the IKE_SA_init exchange, so the identities are hidden from eavesdroppers and all fields in[Bra97]. 2 Protocol Overview IKE runs over UDP port 500. Since UDP is a datagram (unreliable) protocol, IKE includes in its definition recovery from transmission errors, including packet loss, packet replay, and packet forgery. IKE is designed to function so long as at least one of a series of retransmitted packets reaches its destination before timing out andall thechannel is not so full of forged and replayed packets so as to exhaustmessages are authenticated. In thenetwork or CPU capacities of either endpoint. Evenfollowing description, the payloads contained in theabsencemessage are indicated by names such as SA. The details ofthose minimum performance requirements, IKE is designed to fail cleanly (as thoughthenetwork were broken). Harkins Kaufman Kent Kivinen Perlman [Page 7] INTERNET DRAFT April 2002 2.1 Usecontents ofRetransmission Timers All messages in IKE existeach payload are described later. Payloads which may optionally appear will be shown inpairs:brackets, such as [CERTREQ], would indicate that optionally a certificate requestand a response. The setup of an IKE SA normally consists of two request/response pairs. Once the IKE SA is set up, either end of a security association may initiate requests at any time, and therepayload can bemany requests and responses "in flight" at any given moment. But each messageincluded. The Phase 1 exchange islabelledaseither a request or a responsefollows: Initiator Responder ----------- ----------- HDR, SAi1, KEi, Ni --> HDR contains the SPIs (formerly called cookies), version numbers, andfor each pair one endflags of various sorts. The SAi1 payload states thesecurity association iscryptographic algorithms the Initiatorandsupports for theotherIKE SA. The KE payload sends the Initiator's Diffie-Hellman value. Ni is theResponder. For every pair of messages, the Initiator is responsible for retransmission in the event of a timeout.Initiator's nonce. <-- HDR, SAr1, KEr, Nr, [CERTREQ] The Responderwill never retransmit a response unless it receiveschooses aretransmission ofcryptographic suite from therequest. InInitiator's offered choices and expresses thatevent, the Responder MUST either ignore the retransmitted request except insofar as it triggers a retransmission of the response OR if processingchoice in therequest a second time has no adverse effects,SAr1 payload, completes theResponder may choose to processDiffie-Hellman exchange with therequest againKEr payload, andsend a semantically equivalent reply. IKE is a reliable protocol,sends its nonce in thesenseNr payload. At this point in time each party can generate SKEYSEED from which all keys are derived for that IKE SA. Parts of theInitiator MUST retransmit a request until either it receives a corresponding reply OR it deemsfollowing two messages, theIKE security association to have failedIKE_AUTH andit discards all state associated with the IKE-SAIKE_AUTH_response, are encrypted andany Child-SAs negotiated using that IKE-SA. 2.2 Use of Sequence Numbersintegrity protected. The keys used forMessage ID Every IKE message contains a Message IDthe encryption and integrity protection are derived from SKEYSEED and are known aspart of its fixed header. This Message ID is used to match up requestsSK_e (encryption) andresponses,SK_a (authentication, a.k.a. integrity protection). A separate SK_e andto identify retransmissions of messages. The Message ID is a 32 bit quantity, whichSK_a iszerocomputed forthe first IKE request ineach direction. TheIKE SA initial setup messages will always be numbered 0 and 1. Each endpoint in the IKE Security Association maintains two "current" Message IDs: the next one to be used for a request it initiates and the next one it expects to see from the other end. These counters increment as requestsnotation SK { ... } indicates that these payloads aregeneratedencrypted andreceived. Responses always contain the same message ID as the corresponding request. That meansintegrity protected using thatafter thedirection's SK_e and SK_a. HDR, SAi1, KEi, Ni, Nr, SK {IDi, [CERT,] [CERTREQ,] [IDr,] AUTH, SAi2, TSi, TSr} --> The initialexchange, each integer n will appear aspayloads in message three are identical to the payloads in messageID1. If message 1 included any optional payloads (e.g. IKEv2 [Page 6] INTERNET DRAFT October 2002 Vendor ID), they must be repeated infour distinct messages: The nth requestmessage 3 in the same order. Then she includes Nr (Bob's nonce) copied from message 2. The Initiator identifies herself with theoriginal IKE Initiator,IDi payload, proves knowledge of the secret correspondingresponse, the nth request from the original IKE Responder,to IDi and integrity protects thecorresponding response. Ifcontents of the first twoends make very different numbers of requests,messages using theMessage IDsAUTH payload. She might also send her certificate(s) inthe two directions can be very different. There is no ambiguityCERT payload(s) and a list of her trust anchors inthe messages, however, because each packet contains enough informationCERTREQ payload(s). The optional payload IDr enables Alice todeterminespecify which of Bob's identities she wants to talk to. This is useful when Bob is hosting multiple identities at thefour messagessame IP address. She begins negotiation of aparticular one is. Harkins Kaufman Kent Kivinen Perlman [Page 8] INTERNET DRAFT April 2002 Inchild-SA using thecaseSAi2 payload. The fields starting with SAi2 are described in the description of Phase 2. There are optional fields where theIKE_SA_init is rejected (e.g.Initiator can provide certificates [CERT] the Responder might find useful inorder to require a cookie),validating AUTH, her list of preferred root certifiers [CERTREQ], and thesecond IKE_SA_init message will beginname of thesequence overentity withMessage #0. 2.3 Window Size for overlapping requests In orderwhich she is trying tomaximize IKE throughput, an IKE endpoint MAY issue multiple requests before gettingopen aresponse to any of them. For simplicity, an IKE implementation MAY choose to process requests strictly in order and/or wait forconnection [IDr] (for the case where multiple named entities exist at aresponse to one request before issuing another. Certain rules must be followed to assure interoperability between implementations using different strategies. After an IKE-SA is set up, either end can initiatesingle IP address). <-- HDR, SK {IDr, [CERT,] AUTH, SAr2, TSi, TSr} The Responder identifies himself with the IDr payload, optionally sends one or morerequests. These requests may pass one another overcertificates, authenticates himself with thenetwork. An IKE endpoint MUST be prepared to acceptAUTH payload, andprocess a request while it has a request outstanding in order to avoidcompletes negotiation of adeadlockchild-SA with the additional fields described below inthis situation. An IKE endpoint SHOULD be prepared to acceptthe phase 2 exchange. The recipients of messages 3 andprocess multiple requests while it has a request outstanding. An IKE endpoint4 MUSTNOT exceedverify that all signatures and MACs are computed correctly and that thepeer's stated window size (see section 7.3.2) for transmitted IKE requests. In other words, if Bob stated his window size is N, then when Alice needs to make a request X, she MUST wait until she has received responses to all requests up through request X-N. An IKE endpoint MUST keep a copy of (or be able to regenerate exactly) each request it has sent until it receivesnames in thecorresponding response. An IKE endpoint MUST keep a copy of (or be ableID payloads correspond toregenerate with semantic equivalence)thenumber of previous responses equalkeys used toits contracted window size in case its response was lost and the Initiator requests its retransmission by retransmittinggenerate therequest. An IKE endpoint SHOULDAUTH payload. 3.2 The CREATE_CHILD_SA (Phase 2) Exchange A phase 2 exchange is one request/response pair, and can becapable of processing incoming requests out of orderused tomaximize performance increate or delete a child-SA, delete or rekey theeventIKE-SA, check the liveness ofnetwork failuresthe IKE-SA, orpacket reordering. 2.4 State Synchronization and Connection Timeouts An IKE endpointdeliver information such as error conditions. It isallowed to forget all of its state associated with an IKE-SAencrypted and integrity protected using thecollectionkeys negotiated during the creation ofcorresponding child-SAs at any time. This istheanticipated behaviorIKE-SA. Messages are cryptographically protected using the cryptographic algorithms and keys negotiated in theeventfirst two messages ofan endpoint crash and restart. It is important when an endpoint either fails or reinitializes its state thattheother endpoint detect those conditions and not continue to waste network bandwidth by sending packets over those SAs and having them fall into a black hole. SinceIKEis designed to operateexchange using a syntax described inspite of Denial of Service (DoS) Harkins Kaufman Kent Kivinen Perlman [Page 9] INTERNET DRAFT April 2002 attackssection 5.14. Encryption uses keys derived fromthe network, an endpoint MUST NOT conclude that the other endpoint has failed based on any routing information (e.g. ICMP messages) or IKE messages that arrive without cryptographic protection (e.g., notify messages complaining about unknown SPIs). AnSK_e, one in each direction; Integrity uses keys derived from SK_a, one in each direction. Either endpointMUST conclude thatmay initiate a CREATE_CHILD_SA exchange, so in this section theother endpoint has failed only when repeated attemptsterm Initiator refers tocontact it have gone unanswered for a timeout period. An endpoint SHOULD suspect thattheotherendpointhas failed based on routing information and initiateinitiating this IKEv2 [Page 7] INTERNET DRAFT October 2002 exchange. A child-SA is created by sending a CREATE_CHILD_SA request. The CREATE_CHILD_SA request MAY optionally contain a KE payload for an additional Diffie-Hellman exchange tosee whetherenable stronger guarantees of forward secrecy for theother endpoint is alive. To check whetherchild-SA. The keying material for theother sidechild- SA isalive, IKE provides a null query notify message that requires an acknowledgment. Ifacryptographically protected message has been received from the other side recently, unprotected notifications MAY be ignored. Implementations MUST limitfunction of SK_d established during therate at which they generate responses to unprotected messages. Numbersestablishment ofretriesthe IKE-SA, the nonces exchanged during the CREATE_CHILD_SA exchange, andlengths of timeouts are not coveredthe Diffie-Hellman value (if KE payloads are included inthis specification because they do not affect interoperability. It is suggested that messages be retransmitted at least a dozen times over a periodthe CREATE_CHILD_SA exchange). In the child-SA created as part ofat least several minutes before giving up on an SA, but different environments may require different rules. An exception to this rule is that a Responder who has not receivedthe phase 1 exchange, acryptographically protected message on an IKE-SAsecond KE payload MUSTeventually time it out and delete it. Note that consuming state on an IKE Responder by setting up large numbers of half-open IKE-SAs is a likely denial of service attack, so the policy for timing these outNOT be used, andlimitingtheresources they consume shouldNonces are not transmitted but are assumed to beconsidered carefully. There is a Denial of Service attack onthe same as the phase 1 nonces. The CREATE_CHILD_SA request contains: Initiatorof an IKEResponder ----------- ----------- HDR, SK {SA, Ni, [KEi], [TSi, TSr]} --> The Initiator sends SAthat can be avoided ifoffer(s) in theInitiator takesSA payload, a nonce in theproper care. SinceNi payload, optionally a Diffie-Hellman value in the KEi payload, and the proposed traffic selectors in the TSi and TSr payloads. If thefirst two messages of anSAsetup are not cryptographically protected,offers include different Diffie-Hellman groups, KEi must be anattacker could respond toelement of theInitiator'sfirst group offered. The messagebeforepast thegenuine Responderheader is encrypted andpoisontheconnection setup attempt. To prevent this,message including theInitiator SHOULD be willing to accept multiple responses to its first message, treat each as potentially legitimate, respond to it, and then discard all the invalid half open connections when she receives a valid cryptographicallyheader is integrity protected using the cryptographic algorithms negotiated in Phase 1. The CREATE_CHILD_SA response contains: <-- HDR, SK {SA, Nr, [KEr], [TSi, TSr]} The Responder replies (using the same Message ID toany one of her responses. Note thatrespond) withthese rules, there is no reason to negotiate and agree uponthe accepted offer in an SAlifetime. If IKE presumespayload, a Diffie-Hellman value in thepartner is dead, based on repeated lack of acknowledgment to an IKE message, thenKEr payload if KEi was included in theIKE SArequest andall child-SAs set up throughthe selected cryptographic suite includes thatIKE-SA are deleted. An IKE endpoint MAY delete inactive Child-SAs to recover resources used to hold their state.group. Ifan IKE endpointthe responder choosesto do so,a cryptographic suite with a different group, itMUST send Delete payloadsmust reject the request and have the initiator make another one. The traffic selectors for traffic to be sent on that SA are specified in theother end notifying itTS payloads, which may be a subset of what thedeletion. It MAY similarly time outInitiator of theIKE-SA. Closingchild-SA proposed. Traffic selectors are omitted if this CREATE_CHILD_SA request is being used to change theIKE-SA implicitly closes all associated Child-SAs. An IKE endpoint SHOULD Harkins Kaufman Kent Kivinen Perlmankey of the IKE- IKEv2 [Page10]8] INTERNET DRAFTAprilOctober 2002send a Delete payload indicating that it has closed the IKE-SA. 2.5 Version Numbers and Forward Compatibility This document describes version 2.0 of IKE, meaning the major version number isSA. 3.3 Informational (Phase 2) Exchange At various points during an IKE-SA, peers may desire to convey control messages to each other regarding errors or notifications of certain events. To accomplish this IKE defines a (reliable) Informational exchange. Usually Informational exchanges happen during phase 2 and are cryptographically protected with theminor version number is zero. It is likelyIKE exchange. Control messages thatsome implementations will wantpertain tosupport both version 1.0 and version 2.0, and in the future, other versions. The major version number should only be incremented if the packet formats or required actions have changed so dramatically thatanolder version node would notIKE-SA MUST beablesent under that IKE-SA. Control messages that pertain tointeroperate with a newer version node if it simply ignoredChild-SAs MUST be sent under thefields it did not understand and tookprotection of theactions specified inIKE-SA which generated them (or its successor if theolder specification. The minor version number indicates new capabilities, and MUST be ignored by a node with a smaller minor version number, but usedIKE-SA is replaced forinformational purposes bythenode withpurpose of rekeying). There are two cases in which there is no IKE-SA to protect thelarger minor version number. For example, it might indicateinformation. One is in theabilityresponse toprocess a newly defined notification message. The node withan IKE_SA_init_request to refuse thelarger minor version number would simply note that its correspondentSA proposal. This wouldnotbeable to understand that message and therefore would not send it. If you receiveconveyed in amessage with a higher major version number, you MUST dropNotify payload of themessage and SHOULD send an unauthenticated notification message containingIKE_SA_init_response. The other case in which there is no IKE-SA to protect thehighest version number you support. If you support major version n, and major version m, you MUST support all versions between n and m. If you receive a message withinformation is when amajor version that you support, you MUST respondpacket is received withthat version number.an unknown SPI. Inorder to prevent two nodes from being tricked into corresponding with a lower major version number than the maximum that they both support, IKE has a flag that indicatesthat case thenodenotification of this condition will be sent in an informational exchange that iscapablenot cryptographically protected. Messages in an Informational Exchange contain zero or more Notification or Delete payloads. The Recipient ofspeaking a higher major version number. Thusan Informational Exchange request MUST send some response (else themajor version numberSender will assume the message was lost in theIKE header indicatesnetwork and will retransmit it). That response can be a message with no payloads. Actually, theversion number ofrequest message in an Informational Exchange can also contain no payloads. This is themessage, notexpected way an endpoint can ask thehighest version numberother endpoint to verify thatthe transmitter supports. If Ait iscapable of speaking versions n, n+1, and n+2,alive. ESP, AH, andBIPcomp SAs always exist in pairs, with one SA in each direction. When an SA iscapable of speaking versions n and n+1,closed, both members of the pair MUST be closed. When SAs are nested, as when data is encapsulated first with IPcomp, thenthey will negotiate speaking n+1, where A will setwith ESP, and finally with AH between theflag indicating abilitysame pair of endpoints, all of the SAs (up tospeak a higher version. If they mistakenly (perhaps throughsix) must be deleted together. To delete anactive attacker sending error messages) negotiateSA, an Informational Exchange with one or more delete payloads is sent listing the SPIs (as known toversion n, then both will notice thattheother side can support a higher version number, and theyrecipient) of the SAs to be deleted. The recipient MUSTbreakclose theconnection and reconnect using version n+1. Note that v1 does not follow these rules, because there is no waydesignated SAs. Normally, the reply inv1the Informational Exchange will contain delete payloads for the paired SAs going in the other direction. There is one exception. If by chance both ends ofnoting that you are capablea set ofspeakingSAs independently decide to close them, each may send ahigher version number. So an active attacker can trickdelete payload and the twov2-capable nodes into speaking v1. Givenrequests may cross in thedesign of v1, there is no way of preventing Harkins Kaufman Kent Kivinen Perlmannetwork. If a node receives a delete IKEv2 [Page11]9] INTERNET DRAFTAprilOctober 2002this, but this version number discipline will prevent such problems in future versions. When a v2-capable node negotiates down to v1,request for SAs that itSHOULD note that fact in its logs. ISSUE: The SSLv2 to SSLv3 upgrade handled this issue inhas already issued avery clever way,delete request for, it MUST delete the incoming SAs while processing the request andwe could copy it. SSLv3 specifiedthe outgoing SAs while processing the response. In thatcertain octetscase, the responses MUST NOT include delete payloads for the deleted SAs, since that would result inv2 were randomly generated values be set to a constant when a v3 capableduplicate deletion and could in theory delete the wrong SA. A nodenegotiated downSHOULD regard half open connections as anomalous and audit their existence should they persist. Note that this specification nowhere specifies time periods, so it is up tov2. We could, for example, choose a constant value for part of the IKEv1 cookieindividual endpoints to decide how long to wait. A node MAY refuse toindicate IKEv2 capability. Alternatively, we could define a new IKEv1 cipher suite that no IKEv1 implementation couldaccept incoming data on half open connections butwhich could be used as such a flag. Also for forward compatibility, all fields marked RESERVEDMUSTbe set to zero by a version 2.0 implementationNOT unilaterally close them andtheir content MUST be ignored byreuse the SPIs. If connection state becomes sufficiently messed up, aversion 2.0 implementation ("Be conservative in what you send and liberal in what you receive"). In this way, future versions ofnode MAY close theprotocolIKE-SA which will implicitly close all SAs negotiated under it. It canuse those fields inthen rebuild the SA's it needs on away that is guaranteed to be ignored by implementations that do not understand them. Similarly, payload types that are notclean base under a new IKE-SA. The Informational Exchange is definedare reserved for future use and implementationsas: Initiator Responder ----------- ----------- HDR, SK {N, ..., D, ...} --> <-- HDR, SK {N, ..., D, ...} The processing ofversion 2.0 MUST skip over those payloadsan Informational Exchange is determined by its component payloads. 4 IKE Protocol Details andignore their contents. IKEv2 addsVariations IKE runs over UDP port 500. Since UDP is a"critical" flag to each payload header for further flexibility for forward compatibility. If the critical flagdatagram (unreliable) protocol, IKE includes in its definition recovery from transmission errors, including packet loss, packet replay, and packet forgery. IKE issetdesigned to function so long as at least one of a series of retransmitted packets reaches its destination before timing out and thepayload typechannel isunsupported, the message MUST be rejectednot so full of forged and replayed packets so as to exhaust theresponsenetwork or CPU capacities of either endpoint. Even in the absence of those minimum performance requirements, IKE is designed to fail cleanly (as though the network were broken). 4.1 Use of Retransmission Timers All messages in IKE exist in pairs: a requestcontaining that payload MUST includeand anotify payload UNSUPPORTED-CRITICAL-PAYLOAD, indicatingresponse. The setup of anunsupported critical payload was included. IfIKE SA normally consists of two request/response pairs. Once thecritical flagIKE SA isnotsetand the payload type is unsupported, that payload is simply skipped. While new payload typesup, either end of a security association maybe added in the futureinitiate requests at any time, andmay appear interleaved with the fields defined in this specification, implementations MUST send the payloads defined in this specification in the stated orderthere can be many requests andimplementations SHOULD reject as invalid aresponses "in flight" at any given moment. But each messagewith payloads in an unexpected order. 2.6 Cookies The term "cookies" originates with Karn and Simpson [RFC 2522] in Photurus, an early proposal for key managment with IPsec. It has persisted because the IETF has never rejected an offer involving cookies. In IKEv2, the cookies serve two purposes. First, they are usedis labelled asIKE-SA identifiers in the headers of IKE messages. As with ESP and AH, in IKEv2 the recipient ofeither amessage chooses an IKE-SA identifier that uniquely defines that SA to that recipient. For this purpose (IKE-SA identifiers), it might be convenient for the cookie value to be chosen so as to berequest or atable indexresponse and forfast lookupseach request/response pair one end ofSAs. But this conflicts withthesecond purpose ofsecurity association is thecookies (to be Harkins Kaufman Kent Kivinen PerlmanIKEv2 [Page12]10] INTERNET DRAFTAprilOctober 2002explained shortly). Unlike ESPInitiator andAH where only the recipient's SA identifier appears in the message, in IKE,thesender's IKE SA identifierother isalso sent in every message. In IKEv1 the IKE-SA identifier consisted ofthe Responder. For every pair(Initiator cookie, Responder cookie), whereas in IKEv2,of messages, theSAInitiator isuniquely defined by the recipient's SA identifier even though both are includedresponsible for retransmission in theIKEv2 header. The second useevent ofcookies in IKEv2 is foralimited protection from denial of service attacks. Receipt oftimeout. The Responder will never retransmit arequest to start an SA can consume substantial resources. A likely denial of service attack against IKE is to overwhelmresponse unless it receives asystem with large numbersretransmission ofSA requests from forged IP addresses. This can consume CPU resources doing the crypto, and memory resources rememberingthestate ofrequest. In that event, the"half open" connections until they time out. A robust design would limitResponder MUST either ignore theresourcesretransmitted request except insofar as itis willing to devote to new connection establishment, but even so the denialtriggers a retransmission ofservice attack could effectively prevent any new connections. This attack can be rendered more difficult by requiring thattheResponder to an SA request do minimal computation and allocate no memory untilresponse OR if processing theInitiatorrequest a second time hasproven that it can receive messages atno adverse effects, theaddress it claimsResponder may choose tobe sending from. Thisprocess the request again and send a semantically equivalent reply. IKE isdone inastateless way by computing the cookiereliable protocol, ina way that the Responder can recomputethesame value, butsense that the Initiatorcan't guess it. A recommended strategy is to compute the cookie asMUST retransmit acryptographic hash of the Initiator's IP address,request until either it receives a corresponding reply OR it deems theInitiator's cookie value (its chosenIKE securityidentifier), and a secret known only to the Responder. That secret should be changed periodicallyassociation toprevent the "cookie jar" attack where an attacker accumulates lots of cookies from lots of IP addresses over timehave failed andthen replays themit discards allat once to overwhelm the Responder. In ISAKMP and IKEv1,state associated with theterm cookie was usedIKE-SA and any Child-SAs negotiated using that IKE-SA. 4.2 Use of Sequence Numbers forthe connection identifier, but the protocol did not permit their use against this particular denialMessage ID Every IKE message contains a Message ID as part ofservice attack. To avoid the cookie exchange adding extra messages to the protocol in the common case where the Responderits fixed header. This Message ID isnot under attack, IKEv2 goes backused tothe approach in Oakley (RFC 2412) where the cookie challenge is optional. Upon receiptmatch up requests and responses, and to identify retransmissions ofan IKE_SA_init,messages. The Message ID is aResponder may either proceed with setting up32 bit quantity, which is zero for the first IKE request in each direction. The IKE SAor may tell the Initiator to send another IKE_SA_init, this time providing a supplied cookie. It mayinitial setup messages will always beconvenient fornumbered 0 and 1. Each endpoint in theIKE-SA identifierIKE Security Association maintains two "current" Message IDs: the next one to bean index into a table. It is not difficultused forthe Initiator to choose an IKE-SA identifier that is convenient asatable identifier, since the Initiator does not need to userequest itas an anti-clogging token,initiates andis Harkins Kaufman Kent Kivinen Perlman [Page 13] INTERNET DRAFT April 2002 keeping state. IKEv2 allowstheResponder to initially choose a stateless anti-clogging type cookie by respondingnext one it expects toan IKE_SA_init with a cookie request, and then upon receipt of an IKE_SA_init with a valid cookie, change his cookie valuesee from thecomputed anti-clogging token to a more convenient value, by sending a different value for his cookie in the IKE_SA_init_response. This will not confuseother end. These counters increment as requests are generated and received. Responses always contain theInitiator (Alice), because she will have chosen a unique cookie value A, so if her SA state forsame message ID as thepartially set up IKE-SA sayscorresponding request. That means thatBob's cookie forafter theSA that Alice knowsinitial exchange, each integer n may appear as"A" is B, and she receives a response from Bob with cookies (A,C), that means that Bob wants to change his valuethe message ID in four distinct messages: The nth request fromB to C fortheSA that Alice knows uniquely as "A". Another reason why Bob might want to change his cookie value is that it is possible (though unlikely) that Bob will chooseoriginal IKE Initiator, thesame cookie for multiple SAs ifcorresponding response, thehash ofnth request from theInitiator cookie, Initiator IP address,original IKE Responder, andwhatever other information might be included happens to hash to the same value. In IKEv2, like IKEv1, both 8-octet cookies appear inthemessage, but in IKEv2 (unlike v1),corresponding response. If thevalue chosen bytwo ends make very different numbers of requests, themessage recipient always appears firstMessage IDs in themessage. This change eliminates a flawtwo directions can be very different. There is no ambiguity inIKEv1, as well as having other advantages (allowingtherecipientmessages, however, because each packet contains enough information tolook updetermine which of theSA based on a small, conveniently chosen value rather thanfour messages a16-octet pseudorandom value.) The flaw in IKEv1 isparticular one is. Note thatit was possible (though unlikely)Message IDs are cryptographically protected and provide protection against message replays. 4.3 Window Size fortwo connectionsoverlapping requests In order tohave the same setmaximize IKE throughput, an IKE endpoint MAY issue multiple requests before getting a response to any ofcookies.them. Forinstance, if Alice chose A as the Initiator cookie when initiating a connectionIKEv2 [Page 11] INTERNET DRAFT October 2002 simplicity, an IKE implementation MAY choose toBob, she might subsequently receiveprocess requests strictly in order and/or wait for aconnection request from Carol, and Carol might also have chosen A as the Initiator cookie. Whatever value Alice respondsresponse toCarol, say B, might be selected as the Responder cookie by Bob for the Alice-Bob SA. Then Alice wouldone request before issuing another. Certain rules must beinvolved in two IKE sessions, both of which had Initiator cookie=A and Responder cookie=B. To minimize, but not eliminate,followed to assure interoperability between implementations using different strategies. After an IKE-SA is set up, either end can initiate one or more requests. These requests may pass one another over theprobability of this happening, version 1network. An IKErecommended that cookiesendpoint MUST bechosen at random. The cookies are one of the inputs into the function that computes the keying material. If the Responder initially sendsprepared to accept and process astateless cookie valuerequest while it has a request outstanding inits IKE_SA_init_reject, and changesorder to avoid adifferent value when it sends its IKE_SA_init_response, it is the cookie valuedeadlock inthe IKE_SA_init_response that is the input for generating the keying material. Note that one of the denial of service attacks that cookies are designed to thwart is exhaustion of state at the target by creating half-open connections. This defense would be ineffective if there Harkins Kaufman Kent Kivinen Perlman [Page 14] INTERNET DRAFT April 2002 were another equally easy way for an attacker to consume state at the target.this situation. An IKEruns over UDP, and may send messages sufficiently large that they mustendpoint SHOULD befragmented. But accumulating fragments of UDP packets consumes state at the target, so if an IKE responder were requiredprepared to accept andreassemble UDP packets from unknown sources, another equally easy denialprocess multiple requests while it has a request outstanding. An IKE endpoint MUST wait for a response to each ofservice attack would be possible. To thwartits messages before sending a subsequent message unless it has received a Notify message from its peer informing it that theUDP reassembly buffer attack,peer is prepared to maintain state for multiple outstanding messages in order to allow greater throughput. An IKE endpoint MUST NOT exceed the peer's stated window size (see section 5.3.2) for transmitted IKEresponder SHOULD, when it detects that itrequests. In other words, if Bob stated his window size isunder attack, haveN, then when Alice needs to make amechanismrequest X, she MUST wait until she has received responses toinform IP reassemblyall requests up through request X-N. An IKE endpoint MUST keep a copy of (or be able toonly accept UDP fragments from IP addresses from whichregenerate exactly) each request it hasreceivedsent until it receives the corresponding response. An IKE endpoint MUST keep avalid cookie andcopy of (or be able torefuseregenerate with semantic equivalence) the number of previous responses equal toaccept UDP fragments from all other IP addresses. To faccilitate this,its contracted window size in case its response was lost and theIKE_SA_init messageInitiator requests its retransmission by retransmitting the request. An IKE endpoint SHOULD bekept under 500 octets and responders MAY reject fragmented IKE_SA_init messages. Harkins Kaufman Kent Kivinen Perlman [Page 15] INTERNET DRAFT April 2002 2.7 Cryptographic Algorithm Negotiation The payload type known as "SA" indicates a proposal for a setcapable ofchoicesprocessing incoming requests out ofprotocols (e.g., IKE, ESP, AH, and/or IPcomp) fororder to maximize performance in theSA as well as cryptographic algorithms associated with each protocol. In IKEv1 it was extremely complex, and required a separate proposal for each possible combination. If there were n algorithmsevent ofone type (say encryption) that were acceptablenetwork failures or packet reordering. 4.4 State Synchronization andworked with any one of m algorithms of another type (say integrity protection), then it would take space proportional to n*mConnection Timeouts An IKE endpoint is allowed toexpressforget all of its state associated with an IKE-SA and thepossibilities. IKEv2 has simplified the formatcollection of corresponding child-SAs at any time. This is theSA payload somewhat, butanticipated behavior inaddition to simplifyingtheformat, solvesevent of an endpoint crash and restart. It is important when an endpoint either fails or reinitializes its state that theexponential explosionother endpoint detect those conditions and not continue to waste network bandwidth byallowing, withinsending packets over those SAs and having them fall into aproposal, multiple algorithmsblack hole. Since IKE is designed to operate in spite ofthe same type. If more than one algorithmDenial of Service (DoS) attacks from thesame type (say encryption) appears in a proposal,network, an endpoint MUST NOT conclude thatmeans that the sender of that SA proposal is willing to accepttheproposal withother endpoint has failed based on anyof those choices, and the recipient when it accepts the proposal selects exactly one of each of the types of algorithms from the choices offered withinrouting information (e.g. ICMP messages) or IKE messages thatproposal.arrive without cryptographic IKEv2 [Page 12] INTERNET DRAFT October 2002 protection (e.g., notify messages complaining about unknown SPIs). AnSA consists of one or more proposals. Each proposalendpoint MUST conclude that the other endpoint has failed only when repeated attempts to contact it have gone unanswered for anumber (sotimeout period. An endpoint SHOULD suspect that therecipient can specify which proposalother endpoint hasbeen accepted),failed based on routing information andcontains a protocol (IKE, ESP, AH, or IPcomp),initiate aSPIrequest toidentifysee whether theSA for ESP or AH or IPcomp, and set of transforms. Each transform consists of a type (e.g., encryption, integrity protection, authentication, Diffie-Hellman group, compression) and a transform ID (e.g., DES, IDEA, HMAC-MD5).other endpoint is alive. Tonegotiatecheck whether the other side is alive, IKE specifies anSAempty Informational message thatdoes ESP, IPcomp, and AH, the SA will contain three proposals with the same proposal number, one proposing ESP,(like all IKE requests) requires an acknowledgment. If a4 octet SPI tocryptographically protected message has been received from the other side recently, unprotected notifications MAY beused with ESP, and a setignored. Implementations MUST limit the rate at which they take actions based on unprotected messages. Numbers oftransforms; one proposing AH, a 4-octet SPI to be used with AH,retries anda setlengths oftransforms; and one proposing IPcomp, a 2-octet SPI to be used with IPcomp, andtimeouts are not covered in this specification because they do not affect interoperability. It is suggested that messages be retransmitted at least asetdozen times over a period oftransforms.at least several minutes before giving up on an SA, but different environments may require different rules. Ifthe recipient selects that proposal number,there is outgoing traffic on an SA, itmeansis essential to confirm liveness of thatSAs willSA to avoid black holes. If no cryptographically protected messages have been received on an IKE-SA or any of its child-SAs recently, a liveness check MUST becreated for allperformed. Receipt ofESP, AH,a fresh cryptographically protected message on an IKE-SA or any of its child-SAs assures liveness of the IKE-SA andIPcomp. In IKEv2, sinceall of its child-SAs. There is a Denial of Service attack on the Initiatorsends her Diffie-Hellman value in the IKE_SA_init, she must guess at the Diffie-Hellman group that Bob will select from her listofsupported groups. Her guess MUSTan IKE-SA that can be avoided if thefirst inInitiator takes thelist to allow Bob to unambiguously identify which groupproper care. Since theaccompanying KE payload is from. If her guess is incorrect then Bob's response informs herfirst two messages ofthe group he would choose, and notifies her that her offer is invalid because the KE payload isan SA setup are notfromcryptographically protected, an attacker could respond to thedesired group. In this case Alice will send a new IKE_SA_init, withInitiator's message before thesame original choices ingenuine Responder and poison thelist (this is important to prevent an active attacker from tricking them into using a weaker group than they would have agreed upon) but with Bob's preferred group first,connection setup attempt. To prevent this, the Initiator SHOULD be willing to accept multiple responses to its first message, treat each as potentially legitimate, respond to it, anda KE payload containing an exponential from that group. Harkins Kaufman Kent Kivinen Perlman [Page 16] INTERNET DRAFT April 2002 If none of Alice's options are acceptable,thenBob notifies her accordingly. 2.8 Rekeying Security associations negotiated in both phase 1 and phase 2 contain secret keys which may only be used for a limited amount of time. This determines the lifetime of the entire security association. Whendiscard all thelifetimeinvalid half open connections when she receives a valid cryptographically protected response to any one of her requests. Once asecurity association expires the security association MUST NOTcryptographically valid response is received, all subsequent responses should beused. Ifignorred whether or not they are cryptographically valid. Note that with these rules, there isdemand, new security associations can be established. Reestablishment of security associationsno reason totakenegotiate and agree upon an SA lifetime. If IKE presumes theplace of ones which expirepartner isreferreddead, based on repeated lack of acknowledgment toas "rekeying". To rekey a child-SA, create a new, equivalentan IKE message, then the IKE SA(see section 4 and 4.1 below),andwhen the new one is established,all child-SAs set up through that IKE-SA are deleted. An IKE endpoint MAY deletethe old one. To rekeyinactive Child-SAs to recover resources used to hold their state. If anIKE-SA, establish a new equivalent IKE-SA (see section 4 and 4.2 below) with the peerIKE endpoint chooses to do so, it MUST send Delete payloads towhom the old IKE-SA is shared using a Phase 2 negotiation withintheexisting IKE-SA. An IKE-SA so created inherits allother end notifying it of theoriginal IKE-SA's child SAs. Usedeletion. It MAY similarly time out the IKE-SA. Closing thenewIKE-SAforimplicitly closes allcontrol messages needed to maintain the child-SAs created by the old IKE-SA, and delete the old IKE-SA. SAsassociated Child-SAs. An IKE endpoint SHOULDbe rekeyed proactively, i.e., the new SA should be established beforesend a Delete payload indicating that it has closed theold one expiresIKE-SA. IKEv2 [Page 13] INTERNET DRAFT October 2002 4.5 Version Numbers andbecomes unusable. Enough time should elapse betweenForward Compatibility This document describes version 2.0 of IKE, meaning thetimemajor version number is 2 and thenew SAminor version number isestablishedzero. It is likely that some implementations will want to support both version 1.0 and version 2.0, and in theold one becomes unusablefuture, other versions. The major version number should only be incremented if the packet formats or required actions have changed so dramatically thattraffic canan older version node would not beswitched overable to interoperate with a newer version node if it simply ignored thenew SA. A difference between IKEv1fields it did not understand andIKEv2 is that in IKEv1 SA lifetimes were negotiated. In IKEv2, each end oftook theSA is responsible for enforcing its own lifetime policy onactions specified in theSA and rekeying the SA when necessary. If the two ends have different lifetime policies,older specification. The minor version number indicates new capabilities, and MUST be ignored by a node with a smaller minor version number, but used for informational purposes by theendnode with theshorter lifetime will end up always beinglarger minor version number. For example, it might indicate theoneability torequestprocess a newly defined notification message. The node with therekeying.larger minor version number would simply note that its correspondent would not be able to understand that message and therefore would not send it. If you receive a message with a higher major version number, you MUST drop the message and SHOULD send an unauthenticated notification message containing the highest version number you support. If you support major version n, and major version m, you MUST support all versions between n and m. If you receive a message with a major version that you support, you MUST respond with that version number. In order to prevent twoends havenodes from being tricked into corresponding with a lower major version number than thesame lifetime policies, it is possiblemaximum that they bothwill initiatesupport, IKE has arekeying atflag that indicates that thesame time (which will resultnode is capable of speaking a higher major version number. Thus the major version number inredundant SAs). To reducetheprobabilityIKE header indicates the version number ofthis happening,thetimingmessage, not the highest version number that the transmitter supports. If A is capable ofrekeying requests should be jittered (delayed by a random amount of time). This formspeaking versions n, n+1, and n+2, and B is capable ofrekeyingspeaking versions n and n+1, then they willtemporarily result in multiple similar SAs betweennegotiate speaking n+1, where A will set thesame pairs of nodes. When there are two SAs eligibleflag indicating ability toreceive packets,speak anode MUST accept incoming packetshigher version. If they mistakenly (perhaps througheither SA. The nodean active attacker sending error messages) negotiate to version n, then both will notice thatinitiated the rekeying SHOULD deletetheolder SA afterother side can support a higher version number, and they MUST break thenew oneconnection and reconnect using version n+1. Note that IKEv1 does not follow these rules, because there isestablished. Harkins Kaufman Kent Kivinen Perlmanno way in v1 of noting that you are capable of speaking a higher version number. So an active attacker can trick two v2-capable nodes into speaking v1. When a v2-capable node negotiates down to v1, it SHOULD note that fact in its logs. IKEv2 [Page17]14] INTERNET DRAFTAprilOctober 20022.9 Traffic Selector Negotiation When an IP packet is receivedAlso for forward compatibility, all fields marked RESERVED MUST be set to zero byan RFC2401 compliant IPsec subsystema version 2.0 implementation andmatchestheir content MUST be ignored by a"protect" selectorversion 2.0 implementation ("Be conservative inits SPD,what you send and liberal in what you receive"). In this way, future versions of thesubsystem MUST protectprotocol can use those fields in a way thatpacket with IPsec. When no SA exists yet itisthe task of IKEguaranteed tocreate it. Information about the trafficbe ignored by implementations thatneeds protection is transmitted to the IKE subsystem in a manner outside the scope of this document (see [PFKEY] for an example). This information is negotiated between the two IKE endpoints using TS (Traffic Selector) payloads. The TSdo not understand them. Similarly, payloadconsists of a set of individual traffic selectors. The selector from the SPD has "source" and "destination" components and thesetypes that arerepresented in IKE as a pair of TS payloads, TSi (traffic selector-initiator) and TSr (traffic selector-responder). TSi describes the addressesnot defined are reserved for future use andports that the Initiator will send fromimplementations of version 2.0 MUST skip overthe SAthose payloads andwhich it will accept packets for. TSr describesignore their contents. IKEv2 adds a "critical" flag to each payload header for further flexibility for forward compatibility. If theaddressescritical flag is set andports thattheInitiator will sent to overpayload type is unsupported, theSAmessage MUST be rejected andwhich it will accept packets from. The Responder is allowedthe response tonarrowthechoices by selectingIKE request containing that payload MUST include asubset of the traffic, for instance by eliminating one or more members of the set of traffic selectors providednotify payload UNSUPPORTED-CRITICAL-PAYLOAD, indicating an unsupported critical payload was included. If theset doescritical flag is notbecomeset and theNULL set. Notepayload type is unsupported, that payload is simply skipped. While new payload types may be added in thetraffic selectors apply to both child-SAs (from the Initiator to the Responderfuture andfrommay appear interleaved with theResponder to the Initiator), but the Responder does not change the order of the TS payloads. An address within the selector of TSi would appear as a source addressfields defined in this specification, implementations MUST send thechild-SA frompayloads defined in this specification in theInitiator,stated order andwould appearimplementations SHOULD reject as invalid adestination addressmessage with payloads intraffic on the child-SA to the Initiator (from the Responder). IKEv2 is more flexible than IKEv1. IKEv2 allows sets of ranges of both addresses and ports,an unexpected order. 4.6 Cookies The term "cookies" originates with Karn andallowsSimpson [RFC 2522] in Photuris, an early proposal for key management with IPsec. It has persisted because theResponder to chooseIETF has never rejected asubset of the requested traffic rather than simply responding "not acceptable". 2.10 Noncesproposal involving cookies. TheIKE_SA_init_requestISAKMP fixed message header includes two eight octet fields titled "cookies", andthe IKE_SA_init_response each contain a nonce. These noncesthat syntax is used by both IKEv1 and IKEv2. Those eight octet fields are used asinputs to cryptographic functions. The child-create-request andan SPI or connection identifier at thechild-create-responsebeginning of IKE packets. They were alsocontain a nonce. These nonces areintended to be used as Karn/Simpson "anti-clogging" tokens in IKEv1, but certain aspects of that design prevented them from being used as such. IKEv2 was carefully constructed toadd freshnessallow an implementation to implement these anti-clogging tokens, either using thekey derivation technique usedfields titled "cookies" or by creative choices of nonces. While IKE implementations SHOULD implement anti-clogging tokens toobtain keys for child SAs. Nonces usedprotect themselves from denial of service attacks, the algorithms and syntax they use inIKEv2 MUST therefore have strong pseudo-random properties (see RFC1715). Harkins Kaufman Kent Kivinen Perlman [Page 18] INTERNET DRAFT April 2002 2.11 Address and Port Agility IKE runs over UDP port 500, and implicitly sets up ESP, AH, and IPcomp associations for the same IP addresses it runs over. The IP addresses and ports in the outer header are, however,cookies and/or nonces does notthemselves cryptographically protected,affect interoperability andIKEhence isdesigned to work even through Network Address Translation (NAT) boxes. An implementation MUST accept incoming connection requests even ifnotreceived from UDP port 500, andspecified here. The following shouldrespond tobe interpreted as an explanation of why theaddress and port from whichprotocol has therequest was received. An implementation MUST, however, accept incoming requests only on UDP port 500fields it does andsend all responses from UDP port 500. IKE functions identically over IPv4 or IPv6. 2.12 Reuseas an example ofDiffie-Hellman Exponentials IKE generates keying material usinghow anephemeral Diffie-Hellman exchangeimplementation could implementing anti-clogging tokens. In IKEv2, the cookies are used as IKE-SA identifiers inorder to gainthepropertyheaders of"perfect forward secrecy". This means that once a connection is closedIKE messages. As with ESP andits corresponding keys are forgotten, even someone who has recorded all ofAH, in IKEv2 thedata fromrecipient of a IKEv2 [Page 15] INTERNET DRAFT October 2002 message chooses an IKE-SA identifier that uniquely defines that SA to that recipient. For this purpose (IKE-SA identifiers), it might be convenient for theconnection and gets accesscookie value toallbe chosen so as to be a table index for fast lookups of SAs. But this conflicts with thelong term keyssecond use of thetwo endpoints cannot reconstruct the keys used to protect the conversation. Achieving perfect forward secrecy requires that when a connection is closed, each endpoint must forget notcookies. Unlike ESP and AH where only thekeys used byrecipient's SA identifier appears in theconnection but any information that could be used to recompute those keys.message, in IKE the sender's IKE SA identifier is also sent in every message. Inparticular, it must forgetIKEv1 thesecrets usedIKE-SA identifier consisted of the pair (Initiator cookie, Responder cookie), whereas in IKEv2, theDiffie- Hellman calculation and any state that may persistSA is uniquely defined by the recipient's SA identifier even though both are included in the IKEv2 header. An expected attack against IKE is stateof a pseudo-random number generater that could be used to recompute the Diffie-Hellman secrets. Sinceand CPU exhaustion, where thecomputing of Diffie-Hellman exponentialstarget iscomputationally expensive,flooded with session initiation requests from forged IP addresses. This attack can be made less effective if anendpoint may find it advantageousimplementation of a responder uses minimal CPU and commits no state toreuse those exponentials for multiple connection setups. There are several reasonable strategies for doing this. An endpoint could chooseanew exponential periodically though this could result in less-than- perfect forward secrecy if someconnectionlasts for less thanuntil it has received thelifetimethird message of theexponential. Orprotocol. That third message repeats information from the second message, and hence proves that the initiator can receive packets at the address itcould keep trackclaims to be sending from. Since all ofwhich exponential was used for each connection and deletethe informationassociated with the exponential only when some corresponding connection was closed. This would allow the exponential to be reused without losing perfect forward secrecy at the cost of maintaining more state. Decisions as to whether and when to reuse Diffie-Hellman exponentialsfrom message 1 isa private decisionrepeated in message 3, thesense that it willresponder need notaffect interoperability. An implementationstore any of thatreuses exponentials may choose to rememberinformation. What theexponential used byresponder must be able to do is: (1) assure itself that theother endpoint on past Harkins Kaufman Kent Kivinen Perlman [Page 19] INTERNET DRAFT April 2002 exchanges and if oneNr returned in message 3 isreused to avoidfresh and (2) assure that message 3 came from thesecond half ofsame IP address as message 1. If thecalculation. 3 The Phase 1 Exchange The base Phaseresponder uses multiple KEr's during the period of message 1exchange& 3, it must encode in message 2 some way to figure out which KEr applies to this exchange. A good way to do this is to set the IKE-SA identifier to be: SPIr = Hash(KEr | Nr | IPi | <secret>) where <secret> is afour message exchange (two request/response pairs). The first pair of messages,randomly generated secret known only to theIKE_SA_init exchange, negotiate cryptographic algorithms, (optionally) indicate trusted CA names, exchange nonces,responder anddo a Diffie-Hellman exchange.periodically changed. Thispair mightvalue can berepeated ifrecomputed when message 3 arrives and compared to theresponse indicatesSPIr in message 3. If it matches, the responder knows thatnone ofNr was generated since thecryptographic proposals are acceptable, orlast change to <secret> and that IPi must be theDiffie-Hellman group chosen bysame as theInitiator for sending her Diffie-Hellman value is notsource address it saw in message 1. To prevent replays of message 3 without remembering all thegroupNr's that were used, theResponder wouldresponder must keep a list of all of the Nr's that havechosen,been returned in a message 3 since <secret> was last changed. If this list becomes long enough to be cumbersome, the responder can change <secret> and forget all ofiftheResponderused values. If a new value for <secret> isunder attack and will only answer IKE_SA_init requests containingchosen while there are connections in IKEv2 [Page 16] INTERNET DRAFT October 2002 the process of being initialized, avalidmessage 3 might be returnedcookie value. The second pairwhere the responder does not know which ofmessages,its values for <secret> were used in generating message 2. Using theIKE_authformula above, the responder could compute SPIr with each candidate <secret> and accept message 3 if any of theIKE_auth_response, authenticatevalues match. A similar situation occurs if theprevious messages, exchange identities and certificates,responder uses multiple values of KEr. An alternative implementation would be to take a few bits of SPIr as indices of <secret>s andestablishKEr's (where thefirst child_SA. This pairrest ofmessagesSPIr isencrypted with a key established through the IKE_SA_init exchange, so the identities are hidden from eavesdroppers. Incomputed as thefollowing description,above hash). If thepayloads containedresponder wants to keep other forms of state without tying up its memory, it can encode that state in themessage are indicated by names such as SA.nonce. Thedetails ofnonce can be up to 256 octets long, and thecontents of each payloadprotocol is secure so long as values aredescribed later. Payloads which may optionally appear willnot reused, so the responder can put state there (possibly encrypted) and beshown in brackets, such as [CERTREQ], would indicate that optionally a certificate request payload can be included. The Phase 1 exchange is as follows: Initiator Responder ----------- ----------- HDR, SAi1, KEi, Ni --> The SAi1 payload states the cryptographic algorithms the Initiator supports for the IKE SA. The KE payload sends the Initiator's Diffie-Hellman value. Ni is the Initiator's nonce. <-- HDR, SAr1, KEr, Nr, [CERTREQ] The Responder chooses among the Initiator's cryptographic algorithms and expressesguaranteed thatchoice in the SAr1 payload, completes the Diffie- Hellman exchangeit will come back with message 3. For subtle cryptographic reasons, theKEr payload, and sends itsnonceinSHOULD contain some random bits - at least as many random bits as theNr payload. At this point in time each party generates SKEYSEED and its derivatives. The following two messages,size of theSA_auth and SA_auth_response, are encrypted and integrity protected (as indicated Harkins Kaufman Kent Kivinen Perlman [Page 20] INTERNET DRAFT April 2002strongest key be generated by the'*' following the IKE header) and the encryption bit inexchange. It may be convenient for theIKE headerIKE-SA identifier to be an index into a table. It isset. The keys usednot difficult for theencryption and integrity protection are derived from SK_a and SK_e as described below. HDR*, IDi, [CERT,] [CERTREQ,] [IDr,] AUTH, SAi2, TSi, TSr --> TheInitiatoridentifies herself withto choose an IKE-SA identifier that is convenient as a table identifier, since theIDi payload and authenticates herselfInitiator does not need to use it as an anti-clogging token, and is keeping state. IKEv2 allows the Responderwith the AUTH payload, and begins negotiation ofto initially choose achild-SA using the SAi2 payload. The fields startingstateless anti-clogging type cookie by responding to an IKE_SA_init withSAi2 are described in the description of Phase 2. There are optional fields where the Initiator can provide certificates [CERT] the Responder might find useful in validating AUTH, her list of preferred root certifiers [CERTREQ],a cookie request, andthe namethen upon receipt ofthe entityan IKE_SA_init withwhich she is trying to openaconnection [IDr] (forvalid cookie, change his cookie value from thecase where multiple named entities exist atcomputed anti-clogging token to asingle IP address). <-- HDR*, IDr, [CERT,] AUTH, SAr2, TSi, TSr The Responder identifies himself with an ID payload optionally sends one ormorecertificates, authenticates himself with the AUTH payload, and completes negotiation ofconvenient value, by sending achild-SA with the additional fields described belowdifferent value for his cookie in thephase 2 exchange. 3.1 Generating Keying MaterialIKE_SA_auth_response. This will not confuse the Initiator (Alice), because she will have chosen a unique cookie value A, so if her SA state for the partially set up IKE-SAThe shared secret information is computedsays that Bob's cookie for the SA that Alice knows asfollows. A quantity called SKEYSEED"A" iscalculated from the nonces exchanged during the IKE_SA_init exchange,B, andthe Diffie-Hellman shared secret established duringshe receives a response from Bob with cookies (A,C), thatexchange. SKEYSEED is usedmeans that Bob wants tocalculate three other secrets: SK_d used for deriving new keys for the child- SAs established with this IKE-SA; SK_a usedchange his value from B to C forauthenticatingthecomponent messages of subsequent exchanges; and SK_e used for encrypting (and of course decrypting) all subsequent exchanges. SKEYSEED and its derivatives are computedSA that Alice knows uniquely asfollows: Harkins Kaufman Kent Kivinen Perlman [Page 21] INTERNET DRAFT April 2002 SKEYSEED = prf(Ni | Nr, g^ir) SK_d = prf(SKEYSEED, g^ir | Ni | Nr | CKY-I | CKY-R | 0) SK_a = prf(SKEYSEED, SK_d | g^ir | Ni | Nr | CKY-I | CKY-R | 1) SK_e = prf(SKEYSEED, SK_a | g^ir | Ni | Nr | CKY-I | CKY-R | 2) CKY-I and CKY-R are the Initiator's and Responder's cookies, respectively, from the IKE header. g^ir"A". Another reason why Bob might want to change his cookie value is that it is possible (though unlikely) that Bob will choose theshared secret from the ephemeral Diffie-Hellman exchange. Ni and Nr aresame cookie for multiple SAs if thenonces, strippedhash ofany headers. 0, 1,the Initiator IP address, Nr, and2 are represented by a single octet containingwhatever other information might be included happens to hash to thevalue 0, 1, or 2 (the values, notsame value. In IKEv2, like IKEv1, both 8-octet cookies appear in theASCII representation ofmessage, but in IKEv2 (unlike v1), thedigits). prf isvalue chosen by the"pseudo-random" cryptographic function negotiatedmessage recipient always appears first in theIKE-SA-init exchange.message. Thetwo directionscookies are one offlow use different keys. Keys used to protect messages fromtheoriginal initiator are taken frominputs into thefirst bits of SK_a and SK_e. Keys used to protect messages infunction that computes theother direction are taken from subsequent bits. Each algorithm takes a fixed number of bits ofkeyingmaterial, which is specified as part of the algorithm.material. If thetotal number of key bits neededresponder changes its cookie to a different value when it sends its IKE_AUTH_response, it isgreater thanthesize ofcookie value in IKEv2 [Page 17] INTERNET DRAFT October 2002 theoutput ofIKE_SA_init_response that is theprf function,input for generating the keyingmaterial must be expanded. For situations wherematerial. 4.7 Cryptographic Algorithm Negotiation The payload type known as "SA" indicates a proposal for a set of choices of protocols (IKE, ESP, AH, and/or IPcomp) for theamountSA as well as cryptographic algorithms associated with each protocol. In IKEv1 it was extremely complex, and was one ofkeying material desired is greater than that supplied bytheprf, KEYMAT is expanded by feedingmotivations for revising theresultsspec. An SA consists ofthe prf back into itselfone or more proposals. Each proposal includes a Suite-ID, which implies one or more protocols andconcatenating results untiltherequired keying material has been reached.associated cryptographic algorithms. Inother words, KEYMAT = K1 | K2 | K3 | ... where: K1 = prf(SK_x, 0) K2 = prf(SK_x, K1) K3 = prf(SK_x, K2) etc. where 0 is represented by a single octet containingIKEv2, since the Initiator sends her Diffie-Hellman value0 (the value, notin theASCII representation ofIKE_SA_init, she must guess at thedigit), and SK_x is either SK_e or SK_a depending on which keying material needs expansion. 3.2 AuthenticationDiffie-Hellman group that Bob will select from her list of supported groups. Her guess MUST be theIKE-SA The peers are authenticated by having each sign (or MAC using a shared secret as the key) the concatenation of their ownfirstmessage andin theother peer's nonce. The octetslist tobe signed start with the first octet ofallow Bob to unambiguously identify which group theheader and end with the last octet of the last payload. The octetsaccompanying KE payload is from. If her guess is incorrect then Bob's response informs her of thenonce are only the contentgroup he chose, andnotincludes his KE from his chosen group. In this case, Alice MUST choose a KE from Bob's chosen group, compute keys based on her and Bob's values and send theheader. Note that all of payloads ofnew KE in message 3. You might wonder why Alice includes KE in thepeer's ownfirst messageare Harkins Kaufman Kent Kivinen Perlman [Page 22] INTERNET DRAFT April 2002 included under the signature, including payload types not defined in this document. It is possiblegiven thatsome other payloads defined in the future might appropriately be zeroed before signing, but such a possibility is not supported by this version of IKE. Optionally, messagesBob doesn't need it until message 3 and4 MAY include a certificate, or certificate chain providing evidence that the key used to compute a digital signature belongsit could change in message 3. The reason is tothe nameallow an optional optimization in Bob. Bob MAY start his Diffie-Hellman computation as soon as he receives message 1 and likely complete it by theID payload. The signature or MACtime he receives message 3. This willbe computed using algorithms dictated byminimize latency of connection setup in thetypecommon case where Alice correctly guesses the Diffie-Hellman group that Bob will choose. If Bob accepts Alice's first choice ofkey used byDiffie-Hellman group, Alice MUST send thesigner, an RSA-signed PKCS1-padded-SHA1-hashsame value for KE in message 3 as she sent in message 1. Note that anRSA digital signature, a DSS-signed SHA1-hash forimplementation cannot simultaneously exploit this optimization and protect itself from aDSA digital signature, ordenial of service attack using cookies. But an implementation could alternate between the two based on load. If none of Alice's options are acceptable, then Bob notifies her accordingly. 4.8 Rekeying Security associations negotiatedPRF functionin both phase 1 and phase 2 contain IKEv2 [Page 18] INTERNET DRAFT October 2002 secret keys which may only be used for apre-shared key. There is no requirement that the Initiatorlimited amount of time andResponder sign with the same cryptographic algorithms. The choiceto protect a limited amount ofcryptographic algorithms depends ondata. This determines thetypelifetime ofkey each has. This type is either indicated inthecertificate supplied or, ifentire security association. When thekeys were exchanged outlifetime ofband,a security association expires thekey types must have been similarly learned. It will commonlysecurity association MUST NOT be used. If there is demand, new security associations can be established. Reestablishment of security associations to take thecase, but itplace of ones which expire isnot required that ifreferred to as "rekeying". To rekey ashared secret is used for authentication thatchild-SA, create a new, equivalent SA (see section 4.17 below), and when thesame keynew one isused in both directions. In particular,established, delete theinitiator may be usingold one. To rekey an IKE-SA, establish a new equivalent IKE-SA (see section 4.18 below) with the peer to whom the old IKE-SA is sharedkey derived fromusing apassword whilePhase 2 negotiation within theresponder may have a public signature key and certificate. 4 The CREATE-CHILD-SA (Phase 2) Exchange A phase 2 exchange is one request/response pair, and can be used to create or delete a child-SA, delete or rekeyexisting IKE-SA. An IKE-SA so created inherits all of theIKE-SA, checkoriginal IKE-SA's child SAs. Use theliveness ofnew IKE-SA for all control messages needed to maintain the child-SAs created by the old IKE-SA,or deliver information such as error conditions. It is encryptedandintegrity protected using the keys negotiated duringdelete thecreation ofold IKE-SA. The Delete payload to delete itself MUST be the last request sent over an IKE-SA.Messages are cryptographically protected usingSAs SHOULD be rekeyed proactively, i.e., thecryptographic algorithmsnew SA should be established before the old one expires andkeys negotiated inbecomes unusable. Enough time should elapse between thefirst two messages oftime theIKE exchange using a syntax described in Appendix B. Encryption uses keys derived from SK_e, one in each direction; Integrity uses keys derived from SK_a,new SA is established and the old onein each direction. Either endpoint may initiate a phase 2 exchange,becomes unusable soin this section the term Initiator refersthat traffic can be switched over to theendpoint initiating this exchange. When relevant, the Initiatornew SA. A difference between IKEv1 and IKEv2 is that in IKEv1 SA lifetimes were negotiated. In IKEv2, each end of theIKESAwill be referred to as such. A child-SAiscreated by sending a CREATE_CHILD_SA request. If PFSresponsible for enforcing its own lifetime policy on thechild-SA is desired,SA and rekeying theCREATE_CHILD_SA request contains KE payloads for an additional Diffie-Hellman exchange. The keying material for the child-SA is a function of SK_d established during the establishment ofSA when necessary. If theIKE-SA,two ends have different lifetime policies, thenonces exchanged duringend with theCREATE_CHILD_SA exchange, andshorter lifetime will end up always being theDiffie-Hellman value (if KE Harkins Kaufman Kent Kivinen Perlman [Page 23] INTERNET DRAFT April 2002 payloads are included inone to request theCREATE_CHILD_SA exchange). Inrekeying. If thechild-SA created as part oftwo ends have thephase 1 exchange,same lifetime policies, it is possible that both will initiate asecond KE payload MUST NOT be used, and the Nonces are not transmitted but are assumed to berekeying at the sameas the phase 1 nonces. The CREATE_CHILD_SA request contains: Initiator Responder ----------- ----------- HDR*, SA, Ni, [KEi], TSi, TSr --> The Initiator sends SA offer(s)time (which will result in redundant SAs). To reduce theSA payload(s), a nonce inprobability of this happening, theNi payload, optionallytiming of rekeying requests should be jittered (delayed by aDiffie-Hellman value in the KE payload, and the proposed traffic selectorsrandom amount of time). This form of rekeying will temporarily result in multiple similar SAs between theTSi and TSr payloads.same pairs of nodes. When there are two SAs eligible to receive packets, a node MUST accept incoming packets through either SA. Themessage pastnode that initiated theheader is encrypted andrekeying SHOULD delete themessage includingolder SA after theheadernew one isintegrity protected using the cryptographic algorithms negotiatedestablished. 4.9 Traffic Selector Negotiation When an IP packet is received by an RFC2401 compliant IPsec subsystem and matches a "protect" selector inPhase 1. The CREATE_CHILD_SA response contains: <-- HDR*, SA, Nr, [KEr], TSi, TSr The Responder replies (usingits SPD, thesame Message ID to respond)subsystem MUST protect that packet with IPsec. When no SA exists yet it is theaccepted offertask IKEv2 [Page 19] INTERNET DRAFT October 2002 of IKE to create it. Information about the traffic that needs protection is transmitted to the IKE subsystem inan SA payload,aDiffie-Hellman valuemanner outside the scope of this document (see [PFKEY] for an example). This information is negotiated between the two IKE endpoints using TS (Traffic Selector) payloads. Two TS payloads appear in each of theKEmessages in the exchange that creates a child-SA pair. Each TS payloadifcontains one or more Traffic Selectors. Each Traffic Selector consists of an address range (IPv4 or IPv6), a port range, andonly if the Initiator included one,a protocol ID. IKEv2 is more flexible than IKEv1. IKEv2 allows sets of ranges of both addresses and ports, and allows thetraffic selectors for trafficresponder tobe sent on that SA in the TS payloads, which may bechoose a subset ofwhattheInitiatorrequested traffic rather than simply responding "not acceptable". This could happen when the configuration of thechild-SA proposed. 4.1 Generating Keying Material for IPsec SAs Child-SAstwo endpoints arecreated either bybeingpiggybacked onupdated but only one end has received thephase 1 exchange, ornew information. Since the two endpoints may be configured by different people, the incompatibility may persist for an extended period even ina phase 2 CREATE_CHILD_SA exchange. Keying materialthe absense of errors. It allows forthem is generatedintentionally different configurations, asfollows: KEYMAT = prf(SK_d, protocol | SPI | Nin | Nout ) For phase 2 exchanges with PFSwhen one end is configured to tunnel all addresses and depends on thekeying materialother end to have the up to date list. The first of the two TS payloads isdefined as: KEYMAT = prf(SK_d, g(p2)^ir | protocol | SPI | Nin | Nout ) where g(p2)^irknown as TSi (Traffic Selector- initiator). The second is known as TSr (Traffic Selector-responder). TSi specifies theshared secretsource address of traffic forwarded from (or theephemeral Diffie-Hellman exchangedestination address ofthis phase 2 exchange, In either case, "protocol", and "SPI", are fromtraffic forwarded to) theSA payload that Harkins Kaufman Kent Kivinen Perlman [Page 24] INTERNET DRAFT April 2002 containedinitiator of thenegotiated (and accepted) proposal, Nin ischild-SA pair. TSr specifies thebodydestination address of thesender's (inbound using thie SPI) nonce payload minustraffic forwarded from (or thegeneric header, and Nout issource address of the traffic forwarded to) thebodyresponder of thedestination's (outbound using this SPI) nonce payload minuschild-SA pair. For example, if Alice initiates the creation of thegeneric header. A singlechild-SAnegotiation results in two security associations-- one inbound and one outbound. Different Noncespair from Alice to Bob, andSPIs forwishes to tunnel all traffic from subnet 10.2.16.* on Alice's side to subnet 18.16.*.* on Bob's side, Alice would include a single traffic selector in eachSA (one chosen byTS payload. TSi would specify theInitiator,address range (10.2.16.0 - 10.2.16.255) and TSr would specify theother byaddress range (18.16.0.0 - 18.16.255.255). Assuming that proposal was acceptable to Bob, he would send identical TS payloads back. The Responder is allowed to narrow theResponder) guaranteechoices by selecting adifferent keysubset of the traffic, foreach direction. The SPI choseninstance by eliminating or narrowing thedestinationrange of one or more members of theSA andset of traffic selectors, provided theNonces (ordered source followed by destination) are used to derive KEYMATset does not become the NULL set. It is possible forthat SA. This keying material (whether with PFS or without) MUST be usedthe Responder's policy to contain multiple smaller ranges, all encompassed by the Initiator's traffic selector, and with thenegotiatedResponder's policy being that each of those ranges should be sent over a different SA.InContinuing thecaseexample above, Bob might have a policy of being willing to tunnel those addresses to and from Alice, but might require that each address pair be on a separately IKEv2 [Page 20] INTERNET DRAFT October 2002 negotiated child-SA. If Alice generated her request in response to anESP SA needing two keysincoming packet from 10.2.16.43 to 18.16.2.123, there would be no way forencryption and authentication, the encryption keyBob to determine which pair of addresses it istaken frommost urgent to tunnel, and he would have to make his best guess or reject thefirst octetsrequest with a status ofKEYMAT andSINGLE-PAIR-REQUIRED. To enable Bob to choose theauthentication key is taken fromappropriate range in this case, if Alice has initiated thenext octets. Each cryptographic algorithm takesSA due to afixed number of bits of keying material specifieddata packet, Alice MAY include aspartthe first traffic selector in each of TSi and TSr a very specific traffic selector including thealgorithm. For situations whereaddresses in theamount of keying material desired is greater than that supplied bypacket triggering theprf, KEYMAT is expanded by feedingrequest. In theresults ofexample, Alice would include in TSi two traffic selectors: theprf back into itselffirst containing the address range (10.2.16.43 - 10.2.16.43) andconcatenating results untiltherequired keying material has been reached. In other words, KEYMAT = K1 | K2 | K3 | ... where: K1 = prf(SK_d, [ g(p2)^ir | ] protocol | SPI | Nin | Nout) K2 = prf(SK_d, K1 | [ g(p2)^ir | ] protocol | SPI | Nin | Nout) K3 = prf(SK_d, K2 | [ g(p2)^ir | ]source port and protocol| SPI | Nin | Nout) etc. 4.2 Generating Keying Material for IKE-SAsfroma create-child exchange The create-child exchange can be used to re-key an existing IKE-SA (see section 2.8). New Initiator and Responder cookies are supplied intheSPI fields. The IDpacket andTS payloads are omitted when rekeying an IKE-SA. SKEYSEED for the new IKE-SA is computed using SK_d from the existing IKE-SA as follows: SKEYSEED = prf(SK_d (old), [g(p2)^ir] | 0 | CKY-I | CKY-R | Ni | Nr) where g(p2)^ir istheshared secret fromsecond containing (10.2.16.0 - 10.2.16.255) with all ports and protocols. She would similarly include two traffic selectors in TSr. If Bob's policy does not allow him to accept theephemeral Diffie-Hellman exchangeentire set ofthis phase 2 exchange, CKY-I is the 8-octet "SPI" from the SA payloadtraffic selectors inthe CREATE_CHILD_SAAlice's request,CKY-R isbut does allow him to accept the8-octet "SPI" fromfirst selector of TSi and TSr, then Bob MUST narrow theSA payloadtraffic selectors to a subset that includes Alice's first choices. In this example, Bob might respond with TSi being (10.2.16.43 - 10.2.16.43) with all ports and protocols. If Alice creates the child-SA pair not in response to an arriving packet, but rather - say - upon startup, then there may be no specific data packet to describe. In that case, theCREATE_CHILD_SA response, and Nifirst values in TSi andNrTSr arethe two nonces stripped of any headers. "0" isranges rather than specific values, and Bob chooses asingle octet containing the value zero (the protocol IDsubset ofIKE). Harkins Kaufman Kent Kivinen Perlman [Page 25] INTERNET DRAFT April 2002 The new IKE SA MUST reset its message counters to 1. SK_d, SK_a,Alice's TSi andSK_eTSr that arecomputed from SKEYSEED as specified in section 3.1. 5 Informational (Phase 2) Exchange At various points during an IKE-SA, peers may desire to convey control messagesacceptable toeach other regarding errors or notifications of certain events. To accomplish this IKE defines a (reliable) Informational exchange. Usually Informational exchanges happen during phase 2him. If more than one subset is acceptable but their union is not, Bob MUST accept some subset andare cryptographically protected with the IKE exchange. Control messages that pertainMAY include a NOTIFY payload of type ADDITIONAL-TS- POSSIBLE toan IKE-SA MUST be sent under that IKE-SA. Control messagesindicate thatpertainAlice might want toChild-SAs MUST be sent under the protection of the IKE-SA which generated them (or its successor iftry again. 4.10 Nonces The IKE_SA_init and theIKE-SA keys are rolled over). ThereIKE_SA_init_response each contain a nonce. These nonces aretwo cases in which there is no IKE-SAused as inputs toprotect the information. One is incryptographic functions. The CREATE_CHILD_SA request and the CREATE_CHILD_SA response also contain nonces. These nonces are used toan IKE_SA_init_request to request a cookie oradd freshness torefusetheSA proposal. This would be conveyedkey derivation technique used to obtain keys for child SAs. Nonces used ina Notify payloadIKEv2 MUST therefore be unique (either deterministically by use ofthe IKE_SA_init_response. The other case in which there is no IKE-SA to protect the information is when a packet is received with an unknown SPI. In that case the notificationtimestamps and sequence numbers or probabilistically by use ofthis condition will be sent in an informational exchange that is cryptographically unprotected. Messages in an Informational Exchange contain zero or more Notification or Delete payloads. The Recipient of an Informational Exchange request MUST send some response (else the Sender will assume the message was lost in the network and will retransmit it). That response can beamessage with no payloads. Actually, the request message in an Informational Exchange can also contain no payloads. This is the expected way an endpoint can ask the other endpoint to verify that it is alive.strong pseudo-random number generator). 4.11 Address and Port Agility IKE runs over UDP port 500, and implicitly sets up ESP, AH, and IPcompSAs always exist in pairs, with one SA in each direction. When an SA is closed, both members of the pair MUST be closed. When SAs are nested, as when data is encapsulated first with IPcomp, then with ESP, and finally with AH betweenassociations for the samepair of endpoints, all of the SAs (up to six) must be deleted together. To delete an SA, an Informational Exchange with one or more delete payloads is sent listing the SPIs (as known to the recipient) of the SAs to be deleted.IP addresses it runs over. Therecipient MUST close the designated SAs. Normally, the reply in the Informational Exchange will contain delete payloads for the paired SAs goingIP addresses and ports in theother direction. There is Harkins Kaufman Kent Kivinen Perlmanouter header are, however, not themselves IKEv2 [Page26]21] INTERNET DRAFTAprilOctober 2002one exception. If by chance both ends of a set of SAs independently decidecryptographically protected, and IKE is designed toclose them, each may send a delete payloadwork even through Network Address Translation (NAT) boxes. An implementation MUST accept incoming connection requests even if not received from UDP port 500, and should respond to thetwoaddress and port from which the request was received. An implementation MUST, however, accept incoming requestsmay crossonly on UDP port 500 and send all responses from UDP port 500. IKE functions identically over IPv4 or IPv6. 4.12 Reuse of Diffie-Hellman Exponentials IKE generates keying material using an ephemeral Diffie-Hellman exchange in order to gain thenetwork. If a node receives a delete request for SAsproperty of "perfect forward secrecy". This means thatit has already issuedonce adelete request for, it MUST deleteconnection is closed and its corresponding keys are forgotten, even someone who has recorded all of theincoming SAs while processingdata from therequestconnection and gets access to all of theoutgoing SAs while processinglong term keys of theresponse. Intwo endpoints cannot reconstruct the keys used to protect the conversation. Achieving perfect forward secrecy requires thatcase,when a connection is closed, each endpoint must forget not only theresponses MUST NOT include delete payloads forkeys used by thedeleted SAs, sinceconnection but any information thatwould result in duplicate deletion andcould be used to recompute those keys. In particular, it must forget the secrets used intheory deletethewrong SA. A node SHOULD regard half open connections as anomalousDiffie- Hellman calculation andaudit their existence should they persist. Noteany state thatthis specification nowhere specifies time periods, so it is up to individual endpoints to decide how long to wait. A node MAY refuse to accept incoming data on half open connections but MUST NOT unilaterally close them and reusemay persist in theSPIs. If connectionstatebecomes sufficiently messed up,of anode MAY closepseudo-random number generater that could be used to recompute theIKE-SA which will implicitly close all SAs negotiated under it. It can then rebuildDiffie-Hellman secrets. Since theSA's it needs on a clean base under a new IKE-SA. The Informational Exchange is defined as: Initiator Responder ----------- ----------- HDR*, N, ..., D, ... --> <-- HDR*, N, ..., D, ... The processingcomputing ofan Informational ExchangeDiffie-Hellman exponentials isdetermined by its component payloads. 6 Error Handlingcomputationally expensive, an endpoint may find it advantageous to reuse those exponentials for multiple connection setups. There aremany kinds of errors that can occur during IKE processing. If a request is received that is badly formatted or unacceptableseveral reasonable strategies forreasons of policy (e.g. no matching cryptographic algorithms), the response MUST containdoing this. An endpoint could choose aNotify payload indicating the error. If an error occurs outsidenew exponential periodically though this could result in less-than- perfect forward secrecy if some connection lasts for less than thecontextlifetime ofan IKE request (e.g.thenode is getting ESP messages on a non-existent SPI),exponential. Or it could keep track of which exponential was used for each connection and delete thenode SHOULD initiate an Informational Exchangeinformation associated witha Notify payload describingtheproblem. Errors that occur before a cryptographically protected IKE-SA is established must be handled very carefully. There is a trade-off between wantingexponential only when some corresponding connection was closed. This would allow the exponential to behelpful in diagnosing a problem and respondingreused without losing perfect forward secrecy at the cost of maintaining more state. Decisions as toitwhether andwantingwhen toavoid beingreuse Diffie-Hellman exponentials is adupeprivate decision ina denial of service attack based on forged messages. If a node receives a messagethe sense that it will not affect interoperability. An implementation that reuses exponentials may choose to remember the exponential used by the other endpoint onUDP port 500 outsidepast exchanges and if one is reused to avoid thecontextsecond half ofHarkins Kaufman Kent Kivinen Perlmanthe calculation. 4.13 Generating Keying Material IKEv2 [Page27]22] INTERNET DRAFTAprilOctober 2002an IKE-SA (and not a request to start one), it may beIn theresultcontext ofa recent crash. If the message is marked as a response, the node MAY audit the suspicious event but MUST NOT respond. Ifthemessage is marked asIKE SA, three cryptographic algorithms are negotiated: an encryption algorithm, arequest, the node MAY audit the suspicious eventDiffie-Hellman group, andMAY sendaresponse. If a responsepseudo-random function (prf). The pseudo-random function issent, the response MUST be sent toused both for integrity protection of theIP addressIKE payloads andport from whence it came withfor theIKE cookies reversedconstruction of keying material for all of the cryptographic algorithms used in both theheaderIKE SA and theMessage ID copied. The response MUST NOT be cryptographically protectedChild-SAs. We assume that each cryptographic algorithm accepts a fixed size key, andMUST containthat any randomly chosen value of that fixed size can serve as an appropriate key. For functions that accept anotify payload indicating INVALID-COOKIE. A node receiving suchvariable length key, amessage MUST NOT respond andfixed key size MUSTNOT changebe specified as part of thestatecryptographic suite negotiated. For prf functions based on HMAC, the fixed key size is the size ofany existing SAs. The message might be a forgery or might be a responsethegenuine correspondent was tricked into sending. A node SHOULD treat such a message (and also a network message like ICMP destination unreachable) as a hint that there mightoutput of the HMAC. Keying material will always beproblems with SAs to that IP address and SHOULD initiate a liveness test for any such IKE-SA. An implementation SHOULD limitderived as thefrequencyoutput ofsuch tests to avoid being tricked into participating in a denialthe negotiated prf algorithm. If the amount ofservice attack. A node receiving a suspicious message from an IP address with which it has an IKE-SA MAY send an IKE notify payload in an IKE Informational exchange over that SA. The recipient MUST NOT changekeying material is greater than thestatesize ofany SA's as a result but SHOULD audittheevent to aid in diagnosing malfunctions. A node MUST limitoutput of therate at which itprf algorithm, we willsend messages in response to unprotected messages. 7 Header and Payload Formats 7.1 The IKE Header IKE messagesuseUDP port 500, with one IKE message per UDP datagram. Information fromtheUDP header is largely ignored except thatprf iteratively. We will use theIP addresses and UDP ports fromterminology prf+ to describe theheadersfunction that outputs a pseudo-random stream based on the inputs to a prf as follows: prf+ (K,S) = T1 | T2 | T3 | T4 | ... where: T1 = prf (K, S | 0x01) T2 = prf (K, T1 | S | 0x02) T3 = prf (K, T2 | S | 0x03) T4 = prf (K, T3 | S | 0x04) as needed to compute all required keys. The keys arereversed and used for return packets. Each IKE message begins withtaken from theIKE header, denoted HDR in this memo. Followingoutput string without regard to boundaries (e.g. if theheaderrequired keys areone or more IKE payloads each identified bya"Next Payload" field in256 bit AES key and a 160 bit HMAC key, and thepreceding payload. Payloads are processed inprf function generates 160 bits, theorder in which they appear in an IKE message by invokingAES key will come from T1 and theappropriate processing routine according tobeginning of T2, while the"Next Payload" field inHMAC key will come from theIKE headerrest of T2 andsubsequently according to the "Next Payload" field intheIKE payload itself until a "Next Payload" fieldbeginning ofzero indicates that no payloads follow.T3). TheRecipient SPI inconstant concatenated to theheader identifies an instanceend ofan IKE security association. Iteach string feeding the prf istherefore possible fora singleinstance of IKE to multiplex distinct sessions with multiple peers. Harkins Kaufman Kent Kivinen Perlman [Page 28] INTERNET DRAFT April 2002 The formatoctet. prf+ in this document is not defined beyond 255 times the size of theIKE header is shown in Figure 1. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Recipient ! ! SPI (aka Cookie) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Sender ! ! SPI (aka Cookie) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload ! MjVer ! MnVer ! Exchange Type ! Flags ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Message ID ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~ Initialization Vector ~ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 1: IKE Header Format o Recipient SPI (aka Cookie) (8 octets) - A value chosen byprf output. 4.14 Generating Keying Material for therecipient to identify a unique IKE security association. [NOTE: thisIKE-SA The shared keys are computed as follows. A quantity called SKEYSEED isa deviationcalculated fromISAKMP and IKEv1, where the cookies were always sent withtheInitiator ofnonces exchanged during theIKE-SA's cookie firstIKE_SA_init exchange and theResponder's second. See section 2.6.] o Sender SPI (aka Cookie) (8 octets) - A value chosen by the senderDiffie-Hellman shared secret established during that exchange. SKEYSEED is used toidentifycalculate three other secrets: SK_d used for deriving new keys for the child-SAs established with this IKE-SA; SK_a used as aunique IKE security association. o Next Payload (1 octet) - Indicateskey to thetype of payload that immediately followsprf algorithm for authenticating IKEv2 [Page 23] INTERNET DRAFT October 2002 theheader. The formatcomponent messages of subsequent exchanges; andvalueSK_e used for encrypting (and ofeach payload is defined below. o Major Version (4 bits) - indicates the major versioncourse decrypting) all subsequent exchanges. SKEYSEED and its derivatives are computed as follows: SKEYSEED = prf(Ni | Nr, g^ir) {SK_d, SK_ai, SK_ar, SK_ei, SK_er} = prf+ (SKEYSEED, Ni | Nr | CKY-I | CKY-R) g^ir is the shared secret from the ephemeral Diffie-Hellman exchange. Ni and Nr are the nonces, stripped of any headers. The two directions of flow use different keys. The keys used to protect messages from theIKE protocoloriginal initiator are SK_ai and SK_ei. The keys used to protect messages inuse. Implementations based on this versionthe other direction are SK_ar and SK_er. Each algorithm takes a fixed number of bits of keying material, which is specified as part ofIKE MUST settheMajor Version to 2. Implementationsalgorithm. For integrity algorithms based onprevious versions of IKE and ISAKMP MUST setHMAC, theMajor Versionkey size is always equal to1. Implementations based on this versionthe length ofIKE MUST rejectthe underlying hash function. 4.15 Authentication of the IKE-SA The peers are authenticated by having each sign (orignore) messages containingMAC using aversion number greater than 2. o Minor Version (4 bits) - indicatesshared secret as theminor versionkey) a block of data. For theIKE protocol in use. Implementations based on this version of IKE MUST setresponder, theMinor Versionoctets to0. They MUST ignorebe signed start with theminor version numberfirst octet ofreceived messages. o Exchange Type (1 octet) - indicatesthetypeheader ofexchange being Harkins Kaufman Kent Kivinen Perlman [Page 29] INTERNET DRAFT April 2002 used. This dictatesthepayloads sent in eachsecond message andmessage orderingsend with the last octet of the last payload in theexchanges. Exchange Type Value RESERVED 0 Reserved for ISAKMP 1 - 31 Reserved for IKEv1 32 - 33 Phase One 34 CREATE-CHILD-SA 35 Informational 36 Reserved for IKEv2+ 37-239 Reserved for private use 240-255 o Flags (1 octet) - indicates specific options that are set for thesecond message.PresenceAppended to this (for purposes ofoptions are indicated bycomputing theappropriate bit insignature) is theflags field being set.initiator's nonce Ni (just the value, not the payload containing it). Thebits are defined LSB first, so bit 0 would beinitiator signs theleast significant bitunencrypted part of message 3, starting with theFlags octet. In the description below, a bit being 'set' means its value is '1', while 'cleared' means its value is '0'. -- E(ncryption) (bit 0first octet ofFlags) - If set, all payloads followingthe IKE headerare encryptedandintegrity protected usingending with thealgorithms negotiated during session establishment and a key derived duringlast octet of the last unencrypted payload. Note that message 3 includes Nr, so it does not need to be appended in order to be included under the signature. It is critical to the security of thekeyexchangeportionthat each side sign the other side's nonce. Note that all ofIKE. If cleared,the payloads are included under the signature, including any payload types notprotected. All payloads MUST be protected ifdefined in this document. Optionally, messages 3 and 4 MAY include a certificate, or certificate chain providing evidence that the keyhas been negotiated and any unprotected payload may only beused toestablishcompute anew sessiondigital signature belongs to the name in the ID payload. The signature orindicate a problem. -- C(ommit) (bit 1 of Flags) - This bit is defined by ISAKMP but not used by IKEv2. Implementations of IKEv2 MUST clear this bit when sending and SHOULD ignore it in incoming messages. -- A(uthentication Only) (bit 2 of Flags) - This bit is defined by ISAKMP but not used by IKEv2. Implementations of IKEv2 MUST clear this bit when sending and SHOULD ignore it in incoming messages. -- I(nitiator) (bit 3 of Flags) - This bit MUSTMAC will beset in messages sentcomputed using algorithms dictated by theoriginal Initiatortype ofthe IKE exchange and MUST be cleared in messages sentkey used by theoriginal Responder. Itsigner, an RSA-signed PKCS1-padded-hash for an RSA digital signature, a DSS-signed SHA1-hash for a DSA digital signature, or the negotiated PRF function for a pre-shared key. There isused byno requirement that therecipient to determine whetherInitiator and Responder sign with themessage number should be interpreted insame cryptographic algorithms. The choice of cryptographic algorithms depends on thecontexttype ofits Harkins Kaufman Kent Kivinen Perlmankey each has. This type is either indicated in the certificate supplied or, if the keys were exchanged IKEv2 [Page30]24] INTERNET DRAFTAprilOctober 2002initiating state or its responding state. -- V(ersion) (bit 4out ofFlags) - This bit indicates thatband, thetransmitterkey types must have been similarly learned. It will commonly be the case (but it iscapable of speakingnot required) that if ahigher major version number of the protocol thanshared secret is used for authentication that theone indicatedsame key is used in both directions. In particular, themajor version number field. -- R(eserved) (bits 5-7 of Flags) - These bit MUSTinitiator may becleared in messages sentusing a shared key while the responder may have a public signature key andreceived messages with these bits set MUST be rejected. o Message ID (4 octets) - Message identifier usedcertificate. Note that it is a common but insecure practice tocontrol retransmission of lost packets and matching of requests and responses. See section 2.2.have a shared key derived from a user chosen password. This is insecure because user chosen passwords are unlikely to have sufficient randomness to resist dictionary attacks. The pre-shared key SHOULD contain as much randomness as the strongest key being negotiated. In thefirst messagecase of aPhase 1 negotiation,pre-shared key, the AUTH valueMUSTis computed as: AUTH = prf(Shared Secret | "Key Pad for IKEv2", <message bytes>) where the string "Key Pad for IKEv2" is ASCII encoded and not null terminated. The shared secret can beset to 0.variable length. Theresponse topad string is added so thatmessage MUST also haveif the shared secret is derived from aMessage ID of 0. o Length (4 octets) - Lengthpassword, this exchange will not compromise use oftotal message (header + payloads)the same password inoctets. Session encryption can expandother protocols. Note that thesize of an IKE message andrequirement thatis reflected inthetotal length ofresponder sign themessage. o Initialization Vector (variable) - random octets used to provide initialization to an encryption mode-- e.g. cipher block chaining (CBC) mode. This field MUST be presentcontent of message 2 in message 4 introduces some special challenges when theencryption bitresponder isset in the flags field (see below)not maintaining state between messages 2 andMUST NOT be present otherwise. The length of4 (see Section 4.6). Either theInitialization Vector is cipher and mode dependent. 7.2 Generic Payload Header Each IKE payload defined in sections 7.3 through 7.13 begins with a generic header, shown in Figure 2. Figures for each payload below will include the generic payload header butresponder must be able to regenerate message 2 octet forbrevity a repeat ofoctet from thedescription of each field willinformation in message 3, or it must encode in its nonce enough information to beomitted. The construction and processing ofable to construct thegeneric payload header is identical for each payload and will similarly be omitted. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1signature on message 2 after message 34 5 6 7 8 9 0is returned. 4.16 Generating Keying Material for CHILD-SAs Child-SAs are created either by being piggybacked on the phase 1 exchange, or in a phase 23 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 2: Generic Payload Header The Generic Payload Header fields are definedCREATE_CHILD_SA exchange. Keying material for them is generated as follows:Harkins Kaufman Kent Kivinen Perlman [Page 31] INTERNET DRAFT April 2002 o Next Payload (1 octet) - Identifier for the payload type of the next payload inKEYMAT = prf+(SK_d, Ni | Nr) Where Ni and Nr are themessage. IfNonces from thecurrent payloadIKE_init exchange if this request is thelast infirst CHILD-SA created or themessage, thenfresh Ni and Nr from the CREATE_CHILD_SA exchange if thisfield will be 0. This field provides a "chaining" capability whereby additional payloads can be added tois amessage by appending it tosubsequent creation. For phase 2 exchanges with PFS theend ofkeying material is defined as: KEYMAT = prf+(SK_d, g^ir (ph2) | Ni | Nr ) where g^ir (ph2) is themessage and settingshared secret from the"Next Payload" fieldephemeral Diffie- Hellman exchange ofthe preceding payload to indicate the new payload's type. o Critical (1 bit) - MUSTthis phase 2 exchange, A single child-SA negotiation may result in multiple security associations. ESP, AH, and IPcomp SAs exist in pairs (one in each IKEv2 [Page 25] INTERNET DRAFT October 2002 direction), and six SAs could beset to zerocreated in a single child-SA negotiation if a combination of ESP, AH, and IPcomp is being negotiated. KEYMAT is generated as described in section 4.13. Keying material is taken from thesender wantsexpanded KEYMAT in therecipient to skip this payload if he does not understandfollowing order: All keys for SAs carrying data from thepayload type code. MUST be setinitiator toone ifthesender wants the recipient to reject this entire message if he does not understand this payload type. MUST be ignored by recipient ifresponder are taken before SAs going in therecipient understandsreverse direction. If multiple protocols are negotiated, keying material is taken in thepayload type code. MUST be set to zero for payload types definedorder inthis document. Note thatwhich thecritical bit applies toprotocol headers will appear in thecurrent payload rather thanencapsulated packet. If a single protocol has both encryption and authentication keys, the"next" payload whose type code appears inencryption key is taken from the firstoctet. The reasoning behind not setting the critical bit for payloads defined in this document is that all implementations MUST understand all payload types defined in this document and therefore must ignore its value. o RESERVED (7 bits) - MUST be sent as zero; MUST be ignored. o Payload Length (2 octets) - Length inoctets of KEYMAT and thecurrent payload, including the generic payload header. 7.3 Security Association Payload The Security Association Payload, denoted SA in this memo,authentication key isused to negotiate attributes oftaken from the next octets. Each cryptographic algorithm takes asecurity association. Assemblyfixed number ofSecurity Association Payloads requires great peacebits ofmind. An SA may contain multiple proposals. Each proposal may contain multiple protocols (wherekeying material specified as part of the algorithm. 4.17 Rekeying IKE-SAs using aprotocol is IKE, ESP, AH, or IPCOMP), each protocol may contain multiple transforms, and each transform may contain multiple attributes. When parsingCREATE_CHILD_SA exchange The CREATE_CHILD_SA exchange can be used to re-key anSA,existing IKE-SA (see section 4.8). New Initiator and Responder cookies are supplied in the SPI fields. The TS payloads are omitted when rekeying animplementation MUST check thatIKE- SA. SKEYSEED for thetotal Payload Lengthnew IKE-SA isconsistent withcomputed using SK_d from thepayload's internal lengthsexisting IKE-SA as follows: SKEYSEED = prf(SK_d (old), [g^ir (ph2)] | Ni | Nr) where g^ir (ph2) is the shared secret from the ephemeral Diffie- Hellman exchange of this phase 2 exchange andcounts. Proposals, Transforms,Ni andAttributes each have their own variable length encodings. TheyNr arenested such thatthePayload Lengthtwo nonces stripped ofanany headers. The new IKE SAincludes the combined contents of the SA, Proposal, Transform,MUST reset its message counters to 0. SK_d, SK_ai, SK_ar, andAttribute information. The lengthSK_ei, and SK_er are computed from SKEYSEED as specified in section 4.14. 4.18 Error Handling There are many kinds of errors that can occur during IKE processing. If aProposal includes the lengths of all Transforms and Attributes it contains. The lengthrequest is received that is badly formatted or unacceptable for reasons of policy (e.g. no matching cryptographic algorithms), the response MUST contain aTransform includesNotify payload indicating thelengths of all Attributes it contains. The syntaxerror. If an error occurs outside the context ofSecurity Associations, Proposals, Transforms, and Attributesan IKE request (e.g. the node isbasedgetting ESP messages onISAKMP, however the semantics are somewhat different. The reason for the complexity anda non-existent SPI), thehierarchy is to Harkins Kaufman Kent Kivinen Perlmannode SHOULD initiate IKEv2 [Page32]26] INTERNET DRAFTAprilOctober 2002allow for multiple possible combinations of algorithmsan Informational Exchange with a Notify payload describing the problem. Errors that occur before a cryptographically protected IKE-SA is established must be handled very carefully. There is a trade-off between wanting to beencodedhelpful in diagnosing asingle SA. Sometimes there isproblem and responding to it and wanting to avoid being achoicedupe in a denial ofmultiple algorithms, while other times there isservice attack based on forged messages. If acombinationnode receives a message on UDP port 500 outside the context ofalgorithms. For example,anInitiator might wantIKE-SA (and not a request topropose using (AH w/MD5 and ESP w/3DES) OR (ESP w/MD5 and 3DES). One of the reasonsstart one), it may be thesemanticsresult of a recent crash. If theSA payload has changed from ISAKMP and IKEv1message isto make the encodings more compact in common cases. The Proposal structure contains within it a Proposal # andmarked as aProtocol-id. Each structureresponse, the node MAY audit the suspicious event but MUSThaveNOT respond. If thesame Proposal #message is marked as a request, theprevious one or one greater. The first Proposal MUST havenode MAY audit the suspicious event and MAY send aProposal # of one.response. Iftwo successive structures havea response is sent, thesame Proposal number, it means thatresponse MUST be sent to theproposal consists ofIP address and port from whence it came with thefirst structure ANDIKE cookies reversed in thesecond. So a proposal of AH AND ESP would have two proposal structures, one for AHheader andone for ESPthe Message ID copied. The response MUST NOT be cryptographically protected andboth would have Proposal #1.MUST contain a notify payload indicating INVALID-COOKIE. Aproposal of AH OR ESP would have two proposal structures, one for AH with proposal #1node receiving such a message MUST NOT respond andone for ESP with proposal #2. Each Proposal/Protocol structure is followed by one or more transform structures. The numberMUST NOT change the state ofdifferent transforms is generally determined byany existing SAs. The message might be a forgery or might be a response theProtocol. AH generally hasgenuine correspondent was tricked into sending. A node SHOULD treat such asingle transform: an integrity check algorithm. ESP generally has two: an encryption algorithm AND an integrity check algorithm. IKE generally has five transforms:message (and also aDiffie-Hellman group, an authentication algorithm, an integrity check algorithm,network message like ICMP destination unreachable) as aPRF algorithm, and an encryption algorithm. For each Protocol, the set of permissible transforms are assigned transform ID numbers, which appear in the header of each transform. Ifhint that thereare multiple transforms with the same Transform Type, the proposal is an OR of those transforms. If there are multiple Transformsmight be problems withdifferent Transform Types, the proposal is an AND of the different groups. For example,SAs topropose ESP with (3DES or IDEA) and (HMAC-MD5 or HMAC-SHA), the ESP proposal would contain two Transform Type 1 candidates (one for 3DES and one for IDEA) and two Transform Type 2 candidates (one for HMAC-MD5that IP address andoneSHOULD initiate a liveness test forHMAC-SHA). This effectively proposes four combinations of algorithms. Ifany such IKE-SA. An implementation SHOULD limit theInitiator wantedfrequency of such tests topropose onlyavoid being tricked into participating in asubsetdenial ofthose - say (3DES and HMAC-MD5) or (IDEA and HMAC-SHA), there is no way to encode that as multiple transforms withinservice attack. A node receiving asingle Proposal/Protocol. Instead, the Initiator would have to construct two different Proposals, eachsuspicious message from an IP address withtwo transforms. A given transformwhich it has an IKE-SA MAYhave one or more Attributes. Attributes are necessary when the transform can be usedsend an IKE notify payload inmore than one way, as whenanencryption algorithm has a variable key size. The transform Harkins Kaufman Kent Kivinen Perlman [Page 33] INTERNET DRAFT April 2002 would specify the algorithm and the attribute would specify the key size. Most transforms do not have attributes. NoteIKE Informational exchange over that SA. The recipient MUST NOT change thesemanticsstate ofTransforms and Attributes are quite different than in IKEv1. In IKEv1, a single Transform carried multiple algorithms forany SA's as aprotocol with one carried in the Transform andresult but SHOULD audit theothers carriedevent to aid in diagnosing malfunctions. A node MUST limit theAttributes. 1 2 3 0 1 2 3 4 5 6 7rate at which it will send messages in response to unprotected messages. 5 Header and Payload Formats 5.1 The IKE Header IKE messages use UDP port 500, with one IKE message per UDP datagram. Information from the UDP header is largely ignored except that the IP addresses and UDP ports from the headers are reversed and used for return packets. Each IKE message begins with the IKE header, denoted HDR in this memo. Following the header are one or more IKE payloads each identified by a "Next Payload" field in the preceding payload. Payloads are processed in the order in which they appear in an IKE IKEv2 [Page 27] INTERNET DRAFT October 2002 message by invoking the appropriate processing routine according to the "Next Payload" field in the IKE header and subsequently according to the "Next Payload" field in the IKE payload itself until a "Next Payload" field of zero indicates that no payloads follow. If a payload of type "Encrypted" is found, that payload is decrypted and its contents parsed as additional payloads. An Encrypted payload must be the last payload in a packet and an encrypted payload may not contain another encrypted payload. The Recipient SPI in the header identifies an instance of an IKE security association. It is therefore possible for a single instance of IKE to multiplex distinct sessions with multiple peers. The format of the IKE header is shown in Figure 1. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ !Next Payload !C! RESERVEDRecipient !Payload Length! SPI (aka Cookie) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Sender !~ <Proposals> ~! SPI (aka Cookie) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Figure 3: Security Association Payload o Proposals (variable) - one or more proposal substructures. The payload type for the Security Association Payload is one (1). 7.3.1 Proposal Substructure 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! 0 (last) or 2!RESERVEDNext Payload !Proposal LengthMjVer !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+MnVer !Proposal #Exchange Type !Protocol-IdFlags !SPI Size !# of Transforms! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~ SPI (variable) ~+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Message ID !~ <Transforms> ~+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure4: Proposal Substructure1: IKE Header Format o0 (last) or 2 (more) (1 octet)Recipient SPI (aka Cookie) (8 octets) -Specifies whether this isA value chosen by thelast Proposal Substructure inrecipient to identify a unique IKE security association. For theSA. This syntaxfirst packet of an IKE_SA_init, this value MUST be zero. It MUST NOT be zero for any other packet. [NOTE: this isinheriteda deviation fromISAKMP, but is unnecessary becauseISAKMP and IKEv1, where thelast Proposal could be identified fromcookies were always sent with thelengthInitiator of theSA. The value (2) corresponds to a Payload Type of Proposal,IKE-SA's cookie first and thefirst four octets ofResponder's second. See section 3.6.] o Sender SPI (aka Cookie) (8 octets) - A value chosen by theProposal structure are designedsender tolook Harkins Kaufman Kent Kivinen Perlman [Page 34] INTERNET DRAFT April 2002 somewhat like the header ofidentify aPayload. o RESERVED (1 octet) -unique IKE security association. This value MUST NOT besent as zero; MUST be ignored.zero. oProposal Length (2 octets)Next Payload (1 octet) -LengthIndicates the type ofthis proposal, including all transforms and attributespayload thatfollow.immediately follows the header. The format and value of each payload is defined below. IKEv2 [Page 28] INTERNET DRAFT October 2002 oProposal # (1 octet)Major Version (4 bits) -When a proposal is made,indicates thefirst proposalmajor version of the IKE protocol inan SA MUST be #1, and subsequent proposalsuse. Implementations based on this version of IKE MUSTeither be the same asset the Major Version to 2. Implementations based on previousproposal (indicating an ANDversions of IKE and ISAKMP MUST set thetwo proposals) or one more than the previous proposal (indicating an ORMajor Version to 1. Implementations based on this version ofthe two proposals). WhenIKE MUST reject (or ignore) messages containing aproposal is accepted, allversion number greater than 2. o Minor Version (4 bits) - indicates the minor version of theproposal numbersIKE protocol in use. Implementations based on this version of IKE MUST set theSA must be the same and must matchMinor Version to 0. They MUST ignore the minor version numberon the proposal sent that was accepted.of received messages. oProtocol-IdExchange Type (1 octet) -Specifies the protocol identifier for the current negotiation. During phase 1 negotiation this field MUST be zero (0). During phase 2 it will beindicates theprotocoltype ofthe SAexchange beingestablished as assigned by IANA, for example, 50 for ESP, 51 for AH,used. This dictates the payloads sent in each message and108 for IPComp. o SPI Size (1 octet) - During phase 1 negotiation this field MUST be zero. During phase 2 negotiation it is equal to the size,message orderings inoctets, of the SPI ofthecorresponding protocol (8exchanges. Exchange Type Value RESERVED 0 Reserved forIKE, 4ISAKMP 1 - 31 Reserved forESP and AH, 2IKEv1 32 - 33 IKE_SA_init 34 IKE_SA_AUTH 35 CREATE_CHILD_SA 36 Informational 37 Reserved forIPcomp).IKEv2+ 38-239 Reserved for private use 240-255 o# of TransformsFlags (1 octet) -Specifiesindicates specific options that are set for thenumbermessage. Presence oftransformsoptions are indicated by the appropriate bit inthis proposal. o SPI (variable) -the flags field being set. Thesending entity's SPI. Even ifbits are defined LSB first, so bit 0 would be theSPI Size is not a multipleleast significant bit of4 octets, there is no padding applied tothepayload. WhenFlags octet. In theSPI Size fielddescription below, a bit being 'set' means its value iszero, this field'1', while 'cleared' means its value isnot present'0'. -- R(eserved) (bits 0-2) - These bits MUST be cleared when sending and MUST be ignored on receipt. -- I(nitiator) (bit 3 of Flags) - This bit MUST be set in messages sent by theSecurity Association payload. This case occurs when negotiatingoriginal Initiator of theIKE-SA (but not duringIKE SA and MUST be cleared in messages sent by therekeyingoriginal Responder. It is used by the recipient to determine whether the message ID should be interpreted in the context ofan IKE-SA). o Transforms (variable) - oneits initiating state ormore transform substructures. Harkins Kaufman Kent Kivinen Perlmanits responding state. IKEv2 [Page35]29] INTERNET DRAFTAprilOctober 20027.3.2 Transform Substructure 1 2-- V(ersion) (bit 4 of Flags) - This bit indicates that the transmitter is capable of speaking a higher major version number of the protocol than the one indicated in the major version number field. Implementations of IKEv2 must clear this bit when sending and MUST ignore it in incoming messages. -- R(eserved) (bits 5-7 of Flags) - These bits MUST be cleared when sending and MUST be ignored on receipt. o Message ID (4 octets) - Message identifier used to control retransmission of lost packets and matching of requests and responses. See section 4.2. In the first message of a Phase 1 negotiation, the value MUST be set to 0. The response to that message MUST also have a Message ID of 0. o Length (4 octets) - Length of total message (header + payloads) in octets. Session encryption can expand the size of an IKE message and that is reflected in the total length of the message. 5.2 Generic Payload Header Each IKE payload defined in sections 5.3 through 5.14 begins with a generic header, shown in Figure 2. Figures for each payload below will include the generic payload header but for brevity the description of each field will be omitted. The construction and processing of the generic payload header is identical for each payload and will similarly be omitted. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ !0 (last) or 3 !Next Payload !C! RESERVED !TransformPayload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+!Transform Type ! RESERVED ! Transform ID ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Transform Attributes ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Figure5: Transform Substructure o 0 (last) or 3 (more) (1 octet)2: Generic Payload Header The Generic Payload Header fields are defined as follows: o Next Payload (1 octet) -Specifies whether this isIdentifier for thelast Transform Substructurepayload type of the next payload in theProposal. This syntax is inherited from ISAKMP, butmessage. If the current payload isunnecessary becausethe lastProposal could be identified from the length ofin theSA. The value (3) correspondsmessage, then this field will be 0. This field provides a "chaining" capability whereby additional payloads can be added to aPayload Typemessage by appending it to the end ofTransform,the message and setting thefirst four octets"Next Payload" field of theTransform structure are designedpreceding payload tolook somewhat likeindicate theheadernew payload's type. For an Encrypted payload, which must always be the last payload of aPayload.message, the Next IKEv2 [Page 30] INTERNET DRAFT October 2002 Payload field is set to the payload type of the first contained payload. oRESERVEDCritical (1 bit) - MUST besent as zero;set to zero if the sender wants the recipient to skip this payload if he does not understand the payload type code. MUST beignored. o Transform Length - The length (in octets) ofset to one if theTransform Substructure including Header and Attributes. o Transform Type (1 octet) - The type of transform being specified in this transform. Different protocols support different transform types. For some protocols, some ofsender wants thetransforms mayrecipient to reject this entire message if he does not understand this payload type. MUST beoptional. o Transform-ID (1 octet) - The specific instance ofignored by the recipient if thetransformrecipient understands the payload typebeing proposed. Harkins Kaufman Kent Kivinen Perlman [Page 36] INTERNET DRAFT April 2002 Transform Type Values Transform Used In Type Encryption Algorithm 1 (IKE and ESP) Pseudo-random Function 2 (IKE) Authentication Method 3 (IKE) Integrity Algorithm 4 (IKE, AH, and optional in ESP) Diffie-Hellman Group 5 (IKE and optional in AH and ESP) Compression 6 (IPcomp) Window Size 7 (IKE) values 8-240 are reservedcode. SHOULD be set toIANA. Values 241-255 arezero forprivate use among mutually consenting parties. For Transform Type 1 (Encryption Algorithm),payload types definedTransform-IDs are: Name Number Defined In RESERVED 0 ENCR_DES_IV64 1 (RFC1827) ENCR_DES 2 (RFC2405) ENCR_3DES 3 (RFC2451) ENCR_RC5 4 (RFC2451) ENCR_IDEA 5 (RFC2451) ENCR_CAST 6 (RFC2451) ENCR_BLOWFISH 7 (RFC2451) ENCR_3IDEA 8 (RFC2451) ENCR_DES_IV32 9 ENCR_RC4 10 ENCR_NULL 11 (RFC2410) ENCR_AES_128 12 values 12-240 are reservedin this document. Note that the critical bit applies toIANA. Values 241-255 arethe current payload rather than the "next" payload whose type code appears in the first octet. The reasoning behind not setting the critical bit forprivate use among mutually consenting parties. For Transform Type 2 (Pseudo-random Function),payloads definedTransform-IDs are: Name Number Defined In RESERVED 0 PRF_HMAC_MD5 1 (RFC2104) PRF_HMAC_SHA 2 (RFC2104) PRF_HMAC_TIGER 3 (RFC2104) values 3-240 are reserved to IANA. Values 241-255 are for private use among mutually consenting parties. Harkins Kaufman Kent Kivinen Perlman [Page 37] INTERNET DRAFT April 2002 For Transform Type 3 (Authentication Method),in this document is that all implementations MUST understand all payload types definedTransform-IDs are: Name Number Defined In RESERVED 0in this document and therefore must ignore the Critical bit's value. o RESERVEDfor IKEv1 1(7 bits) -5 (RFC2409) Authenticated Diffie-Hellman 6 (this memo) values 7-240 are reserved to IANA. Values 241-255 are for private use among mutually consenting parties. For Transform Type 4 (Integrity Algorithm), defined Transform-IDs are: Name Number Defined In RESERVED 0 AUTH_HMAC_MD5 1 (RFC2403) AUTH_HMAC_SHA 2 (RFC2404) AUTH_DES_MAC 3 AUTH_KPDK_MD5 4 (RFC1826) For Transform Type 5 (Diffie-Hellman Group), defined Transform-IDs are: Name Number RESERVED 0 Pre-defined (see section 8) 1MUST be sent as zero; MUST be ignored. o Payload Length (2 octets) -5 RESERVED 6 - 200 MODP (exponentiation) 201 (w/attributes) ECP (elliptic curve over GF[P] 202 (w/attributes) EC2N (elliptic curve over GF[2^N]) 203 (w/attributes) values 6-200 are reserved to IANA for new MODP, ECP or EC2N groups. Values 204-255 are for private use among mutually consenting parties. Specification of values 201, 202 or 203 allow peers to define a new Diffie-Hellman group in-line as partLength in octets of theexchange. Private use of values 204-255 may entail complete definitioncurrent payload, including the generic payload header. 5.3 Security Association Payload The Security Association Payload, denoted SA in this memo, is used to negotiate attributes of agroup orsecurity association. An SA mayrequire attributes to accompany them. Attributes MUST NOT accompany groups using values between 6 and 200. Harkins Kaufman Kent Kivinen Perlman [Page 38] INTERNET DRAFT April 2002 For Transform Type 6 (Compression), defined Transform-IDs are: Name Number Defined In RESERVED 0 IPCOMP_OUI 1 (w/attributes) IPCOMP_DEFLATE 2 (RFC2394) IPCOMP_LZS 3 (RFC2395) values 4-240 are reserved to IANA. Values 241-255 are for private use among mutually consenting parties. For Transform Type 7 (Window Size), the Transform-ID specifies the window sizecontain multiple proposals. Each proposal may propose multiple protocols (where apeerprotocol iscontracting to supportIKE, ESP, AH, or IPcomp), along with a suite of cryptographic algorithms tohandle overlapping requests (see section 2.3). 7.3.3 Mandatory Transform Typesbe used by the protocols. Thenumberprotocol(s), cryptographic algorithms, andtype of transforms that accompany an SA payloadany associated parameters aredependent on the protocol indetermined by theSA itself.suite number. An SA payloadproposing the establishment of an SA has the following mandatoryMAY contain proposals for different protocols. For example, one suite might contain AH, ESP, andoptional transform types. A compliant implementation MUST support all mandatoryIPcomp, while another might contain only ESP andoptional types for each protocol it supports. Whether the optional types are present inaparticular proposal depends solely on the discretion of the sender. Protocol Mandatory Types Optional Types IKE 1, 2, 3, 5, 7third ESP1 4, 5 AH 4 5 IPCOMP 6 7.3.4 Mandatory Transform-IDs Each transform type has corresponding transform IDs to specify the specific transform. Some transforms are mandatory to supportandothers are optional to support.IPcomp. Themandatory transform IDs for AH, ESP, and IPCOMP are left to their respective RFCs, RFC2402, RFC2406,Proposal structure contains within it a Proposal # andRFC2393. The transform IDs that are mandatory to support for IKEv2 are: Name TransType Mandatory Transform-ID Encryption Algorithm 1 12 (ENCR_AES_128) Pseudo-Random Function 2 2 (PRF_HMAC_SHA) Authentication Method 3 6 (signed D-H) Diffie-Hellman Group 5 5 (1536 bit MODP) Window Size 7 1 Harkins Kaufman Kent Kivinen Perlman [Page 39] INTERNET DRAFT April 2002 All other transform-IDs foragiven transform type are optional to support. While implementationsSuite- ID. The first proposal MUSTsupport a window size ofhave Proposal # = 1,they SHOULD support a window size of at least 10 and MAY support larger window sizes. 7.3.5 Transform Attributes Each transform in a Security Association payload may include attributes that modify or complete the specification of the transform. These attributes are type/value pairs and are defined in Appendix A. For example, if an encryption algorithm has a variable length key,thekey length to be used may be specified as an attribute. Attributes cansecond MUST havea value with a fixed two octet length or a variable length value. For the latterProposal # = 2, etc. If theattribute isproposals are misnumbered, theformresponder MUST reject all oftype/length/value.them. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+!A! Attribute Type ! AF=0 Attribute Length!!F!Next Payload !C! RESERVED !AF=1 Attribute ValuePayload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ !AF=0 Attribute Value! ~ <Proposals> ~ IKEv2 [Page 31] INTERNET DRAFT October 2002 !AF=1 Not Transmitted! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure6: Data Attributes3: Security Association Payload oAttribute Type (2 octets)Proposals (variable) -Unique identifier for each type of attribute. The identifiers for IKE are defined in Appendix A.one or more proposal substructures. Themost significant bit of this field ispayload type for theAttribute Format bit (AF). It indicatesSecurity Association Payload is one (1). 5.3.1 Proposal Substructure 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! 0 (last) or 2 ! RESERVED ! Proposal Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Proposal # ! RESERVED-MBZ ! Suite-ID ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~ SPI(S) (variable) ~ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 4: Proposal Substructure o 0 (last) or 2 (more) (1 octet) - Specifies whether this is thedata attributes follow the Type/Length/Value (TLV) format or a shortened Type/Value (TV) format. Iflast Proposal Substructure in theAF bitSA. This syntax iszero (0), theninherited from ISAKMP, but is unnecessary because theData Attributes are oflast Proposal could be identified from theType/Length/Value (TLV) form. Iflength of theAF bit isSA. The value (2) corresponds to aone (1), thenPayload Type of Proposal, and theData Attributes arefirst four octets of theType/Value form.Proposal structure are designed to look somewhat like the header of a Payload. oAttributeRESERVED (1 octet) - MUST be sent as zero; MUST be ignored. o Proposal Length (2 octets) - Lengthin octetsof this proposal, including theAttribute Value.SPI o Proposal # (1 octet) - Whenthe AF bit isaone (1), the Attribute Valueproposal isonly 2 octetsmade, the first proposal in an SA MUST be #1, and subsequent proposals MUST be one greater than theAttribute Length fieldprevious proposal. When a proposal isnot present. o Attribute Value (variable length) - Value ofaccepted, theAttribute associated with the Attribute Type. If the AF bit is a zero (0), this field hasSA MUST contain avariable length defined bysingle proposal and theAttribute Length field. Ifproposal number MUST match theAF bitaccepted proposal from the Initiator. o RESERVED-MBZ (1 octet) - This field is reserved for possible use in specifying different kinds of proposals. This field MUST be sent as zero and aone (1), the Attribute Value hasproposal containing alength of 2 octets. Harkins Kaufman Kent Kivinen Perlmannon-zero value MUST NOT be accepted. IKEv2 [Page40]32] INTERNET DRAFTAprilOctober 20027.3.6 Attribute Negotiation During security association negotiation Initiators present offers to Responders. Responders MUST selecto Suite-ID (2 octets) - This field specifies asingle complete setsuite ofparameters from the offers (or reject all offers if none are acceptable).protocols and cryptographic algorithms. See table below. o SPI(S) (variable) - The sending entity's SPI(s). Ifthere are multiple proposals,theResponder MUST choose a single proposal number and return all ofsuite proposed includes more than one protocol, theProposal substructures with that Proposal number. If thereSPIs aremultiple Transforms with the same typeconcatenated together in theResponder MUST choose a single one. Any attributes oforder in which they would appear in aselected transform MUST be returned unmodified. The Initiator of an exchange MUST check thatpacket sent using theaccepted offersuite (i.e. AH followed by ESP followed by IPcomp. When an initial IKE SA isconsistent with one of its proposals,being proposed, SPIs are implicit from the IKE header and are not repeated here. Even if the SPI Size is notthat response MUST be rejected. Negotiating Diffie-Hellman groups presents some special challenges. Diffie-Hellman groups are specified either usingadefined group description (section 5) or by defining all attributesmultiple ofa group (see Appendix A) in an IKE policy offer. Group attributes, such as group type or prime number MUST NOT be offered in conjunction with a previously defined group. SA offers include proposed attributes and a Diffie-Hellman public number (KE) in the same message. If the Initiator offers to use one of several Diffie-Hellman groups, it SHOULD pick the one the Responder4 octets, there ismost likely to accept and include a KE corresponding to that group. If the guess turns outno padding applied tobe wrong,theResponder will indicatepayload. When thecorrect groupSPI Size field is zero, this field is not present in theresponse andSecurity Association payload. For Suite-ID, theInitiator SHOULD start over this time using a different group (see section 2.7). Implementation Note: Certain negotiable attributes can have ranges or could have multiple acceptable values. Thesefollowing values arethe Diffie-Hellman group and the key length of a variable key length symmetric cipher. To further interoperabilitydefined: Name Number Algorithms IKE_CLASSIC 0 DH-Group #5 (1536 bits) 3DES encryption HMAC-SHA1 integrity andto support upgrading endpoints independently, implementers of this protocol SHOULD acceptprf ESP_CLASSIC 1 3DES encryption HMAC-SHA1 integrity <some AES variants, ESP+IPcomp, AH (?)) valueswhich they deem to supply greater security. For instance if a peer is configured to accept a variable lengthed cipher with a key length of X bits and is offered that cipher with a larger key length an implementation SHOULD accept the offer. Support of this capability allows an implementation2-65000 are reserved toexpress a concept of "at least" a certain level of security-- "a key length of _at least_ X bitsIANA. Values 65501-65533 are forcipher foo". 7.4private use among mutually consenting parties. 5.4 Key Exchange Payload The Key Exchange Payload, denoted KE in this memo, is used to exchange Diffie-Hellman public numbers as part of a Diffie-HellmanHarkins Kaufman Kent Kivinen Perlman [Page 41] INTERNET DRAFT April 2002key exchange. The Key Exchange Payload consists of the IKE generic header followed by the Diffie-Hellman public value itself. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Key Exchange Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ IKEv2 [Page 33] INTERNET DRAFT October 2002 Figure 7: Key Exchange Payload Format A key exchange payload is constructed by copying one's Diffie-Hellman public value into the "Key Exchange Data" portion of the payload. The length of the Diffie-Hellman public value MUST be equal to the length of the prime modulus over which the exponentiation was performed, prepending zero bits to the value if necessary. A key exchange payload is processed by first checking whether the length of the key exchange data (the "Payload Length" from the generic header minus the size of the generic header) is equal to the length of the prime modulus over which the exponentiation was performed. The payload type for the Key Exchange payload is four (4).7.55.5 Identification Payload The Identification Payload, denoted ID in this memo, allows peers to identify themselves to each other. In Phase 1, the ID Payload names the identity to be authenticated with the signature. In Phase 2, the ID Payload is optional and if present names an identity asserted to be responsible for this SA. An example use would be a shared computer opening an IKE-SA to a server and asserting the name of its logged in user for the Phase 2 SA. If missing, this defaults to the Phase 1 identity. NOTE: In IKEv1, two ID payloads were used in each direction in Phase 2 to hold Traffic Selector information for data passing over the SA. In IKEv2, this information is carried in Traffic Selector (TS) payloads (see section7.13).5.13). The Identification Payload consists of the IKE generic header followed by identification fields as follows:Harkins Kaufman Kent Kivinen Perlman [Page 42] INTERNET DRAFT April 20021 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ID Type ! RESERVED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Identification Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 8: Identification Payload Format IKEv2 [Page 34] INTERNET DRAFT October 2002 o ID Type (1 octet) - Specifies the type of Identification being used. o RESERVED - MUST be sent as zero; MUST be ignored. o Identification Data (variable length) - Value, as indicated by the Identification Type. The length of the Identification Data is computed from the size in the ID payload header. The payload type for the Identification Payload is five (5). The following table lists the assigned values for the Identification Type field, followed by a description of the Identification Data which follows: ID Type Value ------- ----- RESERVED 0 ID_IPV4_ADDR 1 A single four (4) octet IPv4 address. ID_FQDN 2 A fully-qualified domain name string. An example of a ID_FQDN is, "lounge.org". The string MUST not contain any terminators (e.g. NULL, CR, etc.). ID_RFC822_ADDR 3 A fully-qualified RFC822 email address string, An example of a ID_RFC822_ADDR is, "lizard@lounge.org". The string MUST not contain any terminators.Harkins Kaufman Kent Kivinen Perlman [Page 43] INTERNET DRAFT April 2002ID_IPV6_ADDR 5 A single sixteen (16) octet IPv6 address. ID_DER_ASN1_DN 9 The binary DER encoding of an ASN.1 X.500 Distinguished Name [X.501]. ID_DER_ASN1_GN 10 The binary DER encoding of an ASN.1 X.500 GeneralName [X.509]. IKEv2 [Page 35] INTERNET DRAFT October 2002 ID_KEY_ID 11 An opaque octet stream which may be used to pass vendor- specific information necessary to do certain proprietary forms of identification.7.65.6 Certificate Payload The Certificate Payload, denoted CERT in this memo, provides a means to transport certificates or other certificate-related information via IKE. Certificate payloads SHOULD be included in an exchange if certificates are available to the sender. The Certificate Payload is defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Cert Encoding ! ! +-+-+-+-+-+-+-+-+ ! ~ Certificate Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 9: Certificate Payload Format o Certificate Encoding (1 octet) - This field indicates the type of certificate or certificate-related information contained in the Certificate Data field.Harkins Kaufman Kent Kivinen Perlman [Page 44] INTERNET DRAFT April 2002Certificate Encoding Value -------------------- ----- NONE 0 PKCS #7 wrapped X.509 certificate 1 PGP Certificate 2 DNS Signed Key 3 X.509 Certificate - Signature 4 Kerberos Token 6 Certificate Revocation List (CRL) 7 Authority Revocation List (ARL) 8 SPKI Certificate 9 X.509 Certificate - Attribute 10 RESERVED 11 - 255 IKEv2 [Page 36] INTERNET DRAFT October 2002 o Certificate Data (variable length) - Actual encoding of certificate data. The type of certificate is indicated by the Certificate Encoding field. The payload type for the Certificate Payload is six (6).7.75.7 Certificate Request Payload The Certificate Request Payload, denoted CERTREQ in this memo, provides a means to request preferred certificates via IKE and can appear in the first, second, or third message of Phase 1. Certificate Request payloads SHOULD be included in an exchange whenever the peer may have multiple certificates, some of which might be trusted while others are not. If multiple root CA's are trusted, then multiple Certificate Request payloads SHOULD be transmitted. Empty (zero length) CA names MUST NOT be generated and SHOULD be ignored. The Certificate Request Payload is defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Cert Encoding ! ! +-+-+-+-+-+-+-+-+ ! ~ Certification Authority ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 10: Certificate Request Payload FormatHarkins Kaufman Kent Kivinen Perlman [Page 45] INTERNET DRAFT April 2002o Certificate Encoding (1 octet) - Contains an encoding of the type of certificate requested. Acceptable values are listed in section7.6.5.6. o Certification Authority (variable length) - Contains an encoding of an acceptable certification authority for the type of certificate requested. The payload type for the Certificate Request Payload is seven (7). The Certificate Request Payload is constructed by setting the "Cert Encoding" field to be the type of certificate being desired and the "Certification Authority" field to a proper encoding of a certification authority for the specified certificate. For example, IKEv2 [Page 37] INTERNET DRAFT October 2002 for an X.509 certificate this field would contain the Distinguished Name encoding of the Issuer Name of an X.509 certification authority acceptable to the sender of this payload. The Certificate Request Payload is processed by inspecting the "Cert Encoding" field to determine whether the processor has any certificates of this type. If so the "Certification Authority" field is inspected to determine if the processor has any certificates which can be validated up to the specified certification authority. This can be a chain of certificates. If a certificate exists which satisfies the criteria specified in the Certificate Request Payload it MUST be sent back to the certificate requestor; if a certificate chain exists which goes back to the certification authority specified in the request the entire chain SHOULD be sent back to the certificate requestor. If no certificates exist then no further processing is performed-- this is not an error condition of the protocol. There may be cases where there is a preferred CA, but an alternate might be acceptable (perhaps after prompting a human operator).7.85.8 Authentication Payload The Authentication Payload, denoted AUTH in this memo, contains data used for authentication purposes. The only authentication method defined in this memo is digital signatures and therefore the contents of this payload when used with this memo will be the output generated by a digital signature function.Harkins Kaufman Kent Kivinen Perlman [Page 46] INTERNET DRAFT April 2002The Authentication Payload is defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Authentication Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 11: Authentication Payload Format o Authentication Data (variable length) - Data that results from applying the digital signature function to the IKE state (see section 3). The payload type for the Authentication Payload is nine (9). IKEv2 [Page 38] INTERNET DRAFT October 2002 The Authentication Payload is constructed by computing a digital signature (or secret key MAC) overthe concatenationpart of one of the sender'sfirst IKE message and the other peer's nonce.messages (see section 4.15). The result is placed in the "Authentication Data" portion of the payload. The encoding depends on the type of key being used to authenticate (see section3.2).4.2). The payload length is the size of the generic header plus the size of the "Authentication Data" portion of the payload which depends on the specific authentication method being used. The Authentication Payload is processed by extracting the "Authentication Data" from the payload and verifying it according to the specific authentication method being used. If authentication fails a NOTIFY Error message of AUTHENTICATION-FAILED MUST be sent back to the peer and the connection closed.7.95.9 Nonce Payload The Nonce Payload, denoted Ni and Nr in this memo for the Initiator's and Responder's nonce respectively, contains random data used to guarantee liveness during an exchange and protect against replay attacks.Harkins Kaufman Kent Kivinen Perlman [Page 47] INTERNET DRAFT April 2002The Nonce Payload is defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Nonce Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 12: Nonce Payload Format o Nonce Data (variable length) - Contains the random data generated by the transmitting entity. The payload type for the Nonce Payload is ten (10). The Nonce Payload is constructed by computing a pseudo-random value and copying it into the "Nonce Data" field. The size of a Nonce MUST be between 8 and 256 octets inclusive.7.10Nonce values MUST NOT be reused. They MAY be as long as 256 octets to support there use in carrying state when defending against certain denial of service attacks (see Section 4.6). IKEv2 [Page 39] INTERNET DRAFT October 2002 5.10 Notify Payload The Notify Payload, denoted N in this document, is used to transmit informational data, such as error conditions and state transitions to an IKE peer. A Notify Payload may appear in a response message (usually specifying why a request was rejected), or in an Informational Exchange (to report an error not in an IKE request). The Notify Payload is defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Protocol-ID ! SPI Size ! Notify Message Type ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Security Parameter Index (SPI) ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Notification Data ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Harkins Kaufman Kent Kivinen Perlman [Page 48] INTERNET DRAFT April 2002Figure 13: Notification Payload Format o Protocol-Id (1 octet) - Specifies the protocol about which this notification is being sent. For phase 1 notifications, this field MUST be zero (0). For phase 2 notifications concerning IPsec SAs this field will contain an IPsec protocol (either ESP, AH, or IPcomp). For notifications for which no protocol ID is relevant, this field MUST be sent as zero and MUST be ignored. o SPI Size (1 octet) - Length in octets of the SPI as defined by the Protocol-Id or zero if no SPI is applicable. For phase 1 notification concerning the IKE-SA, the SPI Size MUST be zero. o Notify Message Type (2 octets) - Specifies the type of notification message. o SPI (variable length) - Security Parameter Index. o Notification Data (variable length) - Informational or error data transmitted in addition to the Notify Message Type. Values for this field are message specific, see below. IKEv2 [Page 40] INTERNET DRAFT October 2002 The payload type for the Notification Payload is eleven (11).7.10.15.10.1 Notify Message Types Notification information can be error messages specifying why an SA could not be established. It can also be status data that a process managing an SA database wishes to communicate with a peer process. For example, a secure front end or security gateway may use the Notify message to synchronize SA communication. The table below lists the Notification messages and their corresponding values. The number of different error statuses was greatly reduced from IKE V1 both for simplication and to avoid giving configuration information to probers. NOTIFY MESSAGES - ERROR TYPES Value ----------------------------- ----- UNSUPPORTED-CRITICAL-PAYLOAD 1 Sent if the payload has the "critical" bit set and the payload type is not recognised. Notification Data contains the one octet payload type. INVALID-COOKIE 4 Indicates an IKE message was received with an unrecognized destination cookie. This usually indicates that the recipient has rebooted and forgotten the existence of an IKE-SA.Harkins Kaufman Kent Kivinen Perlman [Page 49] INTERNET DRAFT April 2002INVALID-MAJOR-VERSION 5 Indicates the recipient cannot handle the version of IKE specified in the header. The closest version number that the recipient can support will be in the reply header.INVALID-EXCHANGE-TYPEINVALID-SYNTAX 7Notification Data containsIndicates theone octet Exchange Type. INVALID-FLAGS 8 Notification Data contains one octet withIKE message was received was invalid because some type, length, or value was out of range or because theunacceptable flag bits set. INVALID-MESSAGE-ID 9 Sent whenrequest was rejected for policy reasons. To avoid a denial of service attack using forged messages, this status may only be returned for and in anIKE MESSAGE-ID outsideencrypted packet if thenegotiated window is received. This NotifyMESSAGE-ID and cryptographic checksum were valid. To avoid leaking information to someone probing a node, this status MUSTNOTbe sent ina response;response to any error not covered by one of theinvalid requestother status codes. To aid debugging, more detailed error information SHOULD be written to a console or log. IKEv2 [Page 41] INTERNET DRAFT October 2002 INVALID-MESSAGE-ID 9 Sent when an IKE MESSAGE-ID outside the negotiated window is received. This Notify MUST NOT be sent in a response; the invalid request MUST NOT be acknowledged. Instead, inform the other side by initiating an Informational exchange with Notification data containing the four octet invalidMESSAGE- ID. INVALID-PROTOCOL-ID 10 Notification Data contains the one octet invalid protocol ID.MESSAGE-ID. INVALID-SPI 11 MAY be sent in an IKE Informational Exchange when a node receives an ESP or AH packet with an invalid SPI.address asThe Notification Data contains thesource address inSPI of the invalid packet. This usually indicates a node has rebooted and forgotten an SA.ThisIf this Informational Message is sent outside the context of anIKE- SA, and thereforeIKE-SA, it should only be used by the recipient as a "hint" that something might be wrong (because it could easily be forged).INVALID-TRANSFORM-ID 12 Notification Data contains the one octet invalid transform ID. ATTRIBUTES-NOT-SUPPORTED 13 The "Notification Data" for this type are the attribute or Harkins Kaufman Kent Kivinen Perlman [Page 50] INTERNET DRAFT April 2002 attributes that are not supported.NO-PROPOSAL-CHOSEN 14BAD-PROPOSAL-SYNTAX 15 PAYLOAD-MALFORMED 16 INVALID-KEY-INFORMATION 17 The KE field is the wrong length. INVALID-ID-INFORMATION 18 INVALID-CERT-ENCODING 19 The "Notification Data" for this type areNone of the"Cert Encoding" field fromproposed crypto suites was acceptable. SINGLE-PAIR-REQUIRED 34 This error indicates that aCertificate Payload or Certificate Request Payload. INVALID-CERTIFICATE 20 The "Notification Data" for this type arePhase 2 SA request is unacceptable because the"Certificate Data" field fromResponder is willing to accept traffic selectors specifying aCertificate Payload. INVALID-CERT-AUTHORITY 22single pair of addresses. The"Notification Data"Initiator is expected to respond by requesting an SA forthis type areonly the"Cert Encoding" field fromspecific traffic he is trying to forward. NO-ADDITIONAL-SAS 35 This error indicates that aCertificate Payload or Certificate Request Payload. AUTHENTICATION-FAILED 24 INVALID-SIGNATURE 25 UNSUPPORTED-EXCHANGE-TYPE 29 The "Notification Data" for this type are the Exchange Type field fromPhase 2 SA request is unacceptable because theIKE header. UNEQUAL-PAYLOAD-LENGTHS 30 The "Notification Data" forResponder is unwilling to accept any more Child-SAs on thistype are the entire messageIKE-SA. Some minimal implementations may only accept a single Child-SA setup inwhichtheunequal lengths were observed. UNSUPPORTED-NOTIFY-TYPE 31 The "Notification Data" for this type is the two octet Harkins Kaufman Kent Kivinen Perlman [Page 51] INTERNET DRAFT April 2002 Notify Type that was not supported. IKE-SA-INIT-REJECT 32 This notification is sent in an IKE-SA-RESPONSE to request that the Initiator retry the request with the supplied cookie (and optionally the supplied Diffie-Hellman group). This is not really an error, but is processed like one in that it indicates that the connection request was rejected. The Notification Data, if present, contains the Transform Substructure describing the preferred Diffie-Hellman group. SINGLE-PAIR-REQUIRED 34 This error indicates that a Phase 2 SA request is unacceptable because the Responder requires a separate SA for each source / destination address pair. The Initiator is expected to respond by requestingcontext of anSA for only the specific traffic he is tryinginitial IKE exchange and reject any subsequent attempts toforward.add more. RESERVED TO IANA - Errors3536 - 8191 Private Use - Errors 8192 - 16383 NOTIFY MESSAGES - STATUS TYPES Value IKEv2 [Page 42] INTERNET DRAFT October 2002 ------------------------------ ----- RESERVED 16384 - 24577 INITIAL-CONTACT 24578 This notification asserts that this IKE-SA is the only IKE- SA currently active between the authenticated identities. It MAY be sent when an IKE-SA is established after a crash, and the recipient MAY use this information to delete any other IKE-SAs it has to the same authenticated identity without waiting for a timeout if those IKE-SAs reside at the IP address from which this notification arrived. This notification MUST NOT be sent by an entity that may be replicated (e.g. a roaming user's credentials where the user is allowed to connect to the corporate firewall from two remote systems at the same time). SET-WINDOW-SIZE 24579 This notification asserts that the sending endpoint is capable of keeping state for multiple outstanding Phase 2 exchanges, permitting the recipient to send multiple Phase 2 requests before getting a response to the first. The data associated with a SET-WINDOW-SIZE notification MUST be 4 octets long an contain the big endian represention of the number of messages the sender promises to keep. ADDITIONAL-TS-POSSIBLE 24580 This notification asserts that the sending endpoint narrowed the proposed traffic selectors but that other traffic selectors would also have been acceptable, though only in a separate SA. There is no data associated with this notify type. It may only be sent as an additional payload in a message including accepted TSs. RESERVED2457824581 - 40959 Private Use - STATUS 40960 - 65535Harkins Kaufman Kent Kivinen Perlman [Page 52] INTERNET DRAFT April 2002 7.115.11 Delete Payload The Delete Payload, denoted D in this memo, contains a protocol- specific security association identifier that the sender has removed from its security association database and is, therefore, no longer valid. Figure 14 shows the format of the Delete Payload. It is IKEv2 [Page 43] INTERNET DRAFT October 2002 possible to send multiple SPIs in a Delete payload, however, each SPI MUST be for the same protocol. Mixing of Protocol Identifiers MUST NOT be performed with the Delete payload. It is permitted, however, to include multiple Delete payloads in a single Informational Exchange where each Delete payload lists SPIs for a different protocol. Deletion of the IKE-SA is indicated by a Protocol-Id of 0 (IKE) but no SPIs. Deletion of a Child-SA, such as ESP or AH, will contain the Protocol-Id of that protocol (e.g. ESP, AH) and the SPI is the receiving entity's SPI(s). NOTE: What's the deal with IPcomp SAs. This mechanism is probably not appropriate for deleting them!! The Delete Payload is defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Protocol-Id ! SPI Size ! # of SPIs ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Security Parameter Index(es) (SPI) ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 14: Delete Payload Format o Protocol-Id (1 octet) - Must be zero for an IKE-SA, 50 for ESP, 51 for AH, and 108 for IPcomp. o SPI Size (1 octet) - Length in octets of the SPI as defined by the Protocol-Id. Zero for IKE (SPI is in message header), four for AH and ESP, two for IPcomp. o # of SPIs (2 octets) - The number of SPIs contained in the Delete payload. The size of each SPI is defined by the SPI Size field. o Security Parameter Index(es) (variable length) - Identifies theHarkins Kaufman Kent Kivinen Perlman [Page 53] INTERNET DRAFT April 2002specific security association(s) to delete. The length of this field is determined by the SPI Size and # of SPIs fields. The payload type for the Delete Payload is twelve (12).7.12IKEv2 [Page 44] INTERNET DRAFT October 2002 5.12 Vendor ID Payload The Vendor ID Payload contains a vendor defined constant. The constant is used by vendors to identify and recognize remote instances of their implementations. This mechanism allows a vendor to experiment with new features while maintaining backwards compatibility. The Vendor ID payload is not an announcement from the sender that it will send private payload types but rather an announcement of the sort of private payloads it is willing to accept. The implementation sending the Vendor ID MUST not make any assumptions about private payloads that it may send unless a Vendor ID of like stature is received as well. Multiple Vendor ID payloads MAY be sent. An implementation is NOT REQUIRED to send any Vendor ID payload at all. A Vendor ID payload may be sent as part of any message. Reception of a familiar Vendor ID payload allows an implementation to make use of Private USE numbers described throughout this memo-- private payloads, private exchanges, private notifications, etc. Unfamiliar VendorID'sIDs MUST be ignored. Writers of Internet-Drafts who wish to extend this protocol MUST define a Vendor ID payload to announce the ability to implement the extension in the Internet-Draft. It is expected that Internet-Drafts which gain acceptance and are standardized will be given "magic numbers" out of the Future Use range by IANA and the requirement to use a Vendor ID will go away.Harkins Kaufman Kent Kivinen Perlman [Page 54] INTERNET DRAFT April 2002The Vendor ID Payload fields are defined as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Vendor ID (VID) ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 15: Vendor ID Payload Format o Vendor ID (variable length) - It is the responsibility of the person choosing the Vendor ID to assure its uniqueness in spite of the absence of any central registry for IDs. Good practice is to include a company name, a person name or some such. If you want to show off, you might include IKEv2 [Page 45] INTERNET DRAFT October 2002 the latitude and longitude and time where you were when you chose the ID and some random input. A message digest of a long unique string is preferable to the long unique string itself. The payload type for the Vendor ID Payload is thirteen (13).7.135.13 Traffic Selector Payload The Traffic Selector Payload, denoted TS in this memo, allows peers to identify packet flows for processing by IPsec security services. The Traffic Selector Payload consists of the IKE generic header followed byselector information fieldsindividual traffic selectors as follows: 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Number of TSs ! RESERVED ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ <Traffic Selectors> ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 16: Traffic Selectors Payload FormatHarkins Kaufman Kent Kivinen Perlman [Page 55] INTERNET DRAFT April 2002o Number of TSs (1 octet) - Number of traffic selectors being provided. o RESERVED - This field MUST be sent as zero and MUST be ignored. o Traffic Selectors (variable length) - one or more individual trafficselector substructures.selectors. The length of the Traffic Selector payload includes the TS header and all the trafficselector substructures.selectors. The payload type for the Traffic Selector payload is fourteen (14).7.13.15.13.1 Traffic SelectorSubstructure1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! TS Type ! Protocol ID | Selector Length | IKEv2 [Page 46] INTERNET DRAFT October 2002 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Start-Port | End-Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Starting Address ~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! ~ Ending AddressSelector Data~ ! ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 17: Traffic SelectorSubstructureo TS Type (one octet) - Specifies the type of traffic selector. o Protocol ID (1 octet) - Value specifying an associated IP protocol ID (e.g. UDP/TCP). A value of zero means that the Protocol ID is not relevant to this traffic selector-- the SA can carry all protocols. o Selector Length - Specifies the length of this Traffic Selector Substructure including the header. o Start-Port (2 octets) - Value specifying the smallest port number allowed by this Traffic Selector. For protocols for which port is undefined, or if all ports are allowed by this Traffic Selector, this field MUST be zero. o End-Port (2 octets) - Value specifying the largest port number allowed by this Traffic Selector. For protocols for which port is undefined, or it all ports are allowed by this Traffic Selector, this field MUST be 65535.Harkins Kaufman Kent Kivinen Perlman [Page 56] INTERNET DRAFT April 2002o Starting Address - The smallest address included in this Traffic SelectorData(length determined by TS type). o Ending Address -a specification of one or more addressesThe largest address included in this Traffic Selectorwith format(length determined by TStype.type). The following table lists the assigned values for the Traffic Selector Type field and the corresponding Address Selector Data. TS Type Value ------- ----- RESERVED 0TS_IPV4_ADDR 1 A four (4) octet IPv4 address TS_IPV4_ADDR_SUBNET 4 An IPv4 subnet represented by a pair of four (4) octet values. The first value is an IPv4 address. The second is an IPv4 network mask. Note that ones (1s) in the network mask indicate that the corresponding bit in the address is fixed, while zeros (0s) indicate a "wildcard" bit. TS_IPV6_ADDR 5 A sixteen (16) octet IPv6 address TS_IPV6_ADDR_SUBNET 6 An IPv6 subnet represented by a pair sixteen (16) octet values. The first value is an IPv6 address. The second is an IPv6 network mask. Note that ones (1s) in the network mask indicate that the corresponding bit in the address is fixed, while zeros (0s) indicate a "wildcard" bit.TS_IPV4_ADDR_RANGE 7 IKEv2 [Page 47] INTERNET DRAFT October 2002 A range of IPv4 addresses, represented by two four (4) octet values. The first value is the beginning IPv4 address (inclusive) and the second value is the ending IPv4 address (inclusive). All addresses falling between the two specified addresses are considered to be within the list. TS_IPV6_ADDR_RANGE 8 A range of IPv6 addresses, represented by two sixteen (16) octet values. The first value is the beginning IPv6 address (inclusive) and the second value is the ending IPv6 addressHarkins Kaufman Kent Kivinen Perlman [Page 57] INTERNET DRAFT April 2002(inclusive). All addresses falling between the two specified addresses are considered to be within the list.7.14 Other Payload Types5.14 Encrypted Payloadtype values 15-127 are reserved to IANA for future assignmentThe Encrypted Payload, denoted SK{...} inIKEv2 (see section 10). Payload type values 128-255 are for private use among mutually consenting parties. 8 Diffie-Hellman Groups There are 5 groups different Diffie-Hellman groups defined for usethis memo, contains other payloads inIKE. These groups were generated by Richard Schroeppel atencrypted form. The Encrpted Payload, if present in a message, must be theUniversity of Arizona. Properties of these primes are describedlast payload in[Orm96].the message. Often, it is the only payload in the message. Thestrength supplied by group one may not be sufficientalgorithms for encryption and integrity protection are negotiated during IKE-SA setup, and themandatory-to-implementkeys are computed as specified in sections 4.14 and 4.17. The encryptionalgorithmandis here for historic reasons. 8.1 Group 1 - 768 Bit MODPintegrity protection algorithms are modelled after the ESP algorithms described in RFCs 2104, 2406, 2451. This document completely specifies the cryptographic processing of IKEimplementations MAY supportdata, but those documents should be consulted for design rationale. We assume aMODP groupblock cipher withthe following primea fixed block size andgenerator. This groupan integrity check algorithm that computes a fixed length checksum over a variable size message. The mandatory to implement algorithms are AES-128-CBC and HMAC-SHA1. The Payload Type for an Encrypted payload isassigned id 1 (one).fifteen (15). Theprime is: 2^768 -Encrypted Payload consists of the IKE generic header followed by individual fields as follows: 1 2^704 -3 0 1+ 2^64 * { [2^638 pi] + 149686 } Its hexadecimal value is: FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF The generator is 2. 8.2 Group2- 1024 Bit MODP IKE implementations SHOULD support a MODP group with the following prime and generator. This group is assigned id3 4 5 6 7 8 9 0 1 2(two). Harkins Kaufman Kent Kivinen Perlman3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Next Payload !C! RESERVED ! Payload Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Initialization Vector ! ! (length is block size for encryption algorithm) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Encrypted IKE Payloads ! + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! Padding (0-255 octets) ! IKEv2 [Page58]48] INTERNET DRAFTAprilOctober 2002The prime is 2^1024 - 2^960+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ ! ! Pad Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~ Integrity Checksum Data ~ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 9: Encrypted Payload Format o Next Payload -1 + 2^64 * { [2^894 pi] + 129093 }. Its hexadecimal value is: FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 FFFFFFFF FFFFFFFFThegeneratorpayload type of the first embedded payload. Since the Encrypted payload must be last in a message, there is2. 8.3 Group 3 - 155 Bit EC2N IKE implementations MAY supportno need to specify aEC2N group withpayload type for a payload beyond it. o Payload Length - Includes thefollowing characteristics. This group is assigned id 3 (three). The curve is based onlengths of theGalois Field GF[2^155]. The field sizeIV, Padding, and Authentication data. o Initialization Vector - A randomly chosen value whose length is155. The irreducible polynomial forequal to thefield is: u^155 + u^62 + 1. The equation forblock length of theelliptic curve is: y^2 + xy = x^3 + ax^2 + b. Field Size: 155 Group Prime/Irreducible Polynomial: 0x0800000000000000000000004000000000000001 Group Generator One: 0x7b Group Curve A: 0x0 Group Curve B: 0x07338f Group Order: 0x0800000000000000000057db5698537193aef944 The data in the KE payload when usingunderlying encryption algorithm. Recipients MUST accept any value. Senders SHOULD either pick thisgroup is thevaluex frompseudo-randomly and independently for each message or use thesolution (x,y),final ciphertext block of thepoint onprevious message sent. Senders MUST NOT use thecurvesame value for each message, use a sequence of values with low hamming distance (e.g. a sequence number), or use ciphertext from a received message. o IKE Payloads are as specified earlier in this section. This field is encrypted with the negotiated cipher. o Padding may contain any value chosen bytakingtherandomly chosen secret Kasender, andcomputing Ka*P, where * ismust have a length that makes therepetitioncombination of thegroup additionPayloads, the Padding, anddouble operations, P isthecurve point with x coordinate equalPad Length togenerator 1 andbe a multiple of they coordinate determined fromencryption block size. This field is encrypted with thedefining equation.negotiated cipher. o Pad Length is the length of the Padding field. Theequationsender SHOULD set the Pad Length to the minimum value that makes the combination ofcurve is implicitly known bytheGroup Type andPayloads, theAPadding, andB coefficients. There are two possible values forthey coordinate; either one can be used successfully (the two parties need not agree onPad Length a multiple of theselection). Harkins Kaufman Kent Kivinen Perlman [Page 59] INTERNET DRAFT April 2002 8.4 Group 4 - 185 Bit EC2N IKE implementations MAY support a EC2N group withblock size, but thefollowing characteristics.recipient MUST accept any length that results in proper alignment. Thisgroup is assigned id 4 (four). The curvefield isbased onencrypted with theGalois Field GF[2^185]. The field sizenegotiated cipher. o Integrity Checksum Data is185. The irreducible polynomial forthefield is: u^185 + u^69 + 1. The equation forcryptographic checksum of theelliptic curve is: y^2 + xy = x^3 + ax^2 + b. Field Size: 185 Group Prime/Irreducible Polynomial: 0x020000000000000000000000000000200000000000000001 Group Generator One: 0x18 Group Curve A: 0x0 Group Curve B: 0x1ee9 Group Order: 0x01ffffffffffffffffffffffdbf2f889b73e484175f94ebc The data inentire message starting with theKE payload when using this group willFixed IKE Header through the Pad Length. The checksum MUST beidenticalcomputed over the encrypted message. 5.15 Other Payload Types IKEv2 [Page 49] INTERNET DRAFT October 2002 Payload type values 16-127 are reserved to IANA for future assignment in IKE. Payload type values 128-255 are for private use among mutually consenting parties. 6 Conformance Requirements In order to assure thatas when using Oakley Group 3 (three). 8.5 Group 5 - 1536 Bit MODP IKEall implementations of IKEv2 can interoperate, there are MUST support requirements in addition to those listed elsewhere. Of course, IKEv2 is aMODP group with the following primesecurity protocol, andgenerator. This group is assigned id 5 (five). The prime is 2^1536 - 2^1472 - 1 + 2^64 * {[2^1406 pi] + 741804}. Its hexadecimal valueone of its major functions isFFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8 FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D 670C354E 4ABC9804 F1746C08 CA237327 FFFFFFFF FFFFFFFF The generatorpreventing the bad guys from interoperating with one's systems. So a particular implementation may be configured with any of a number of restrictions concerning algorithms and trusted authorities that will prevent universal interoperability. For an implementation to be called conforming to this specification, it MUST be possible to configure it to accept the following: X.509 certificates containing and signed by RSA keys of size 512, 768, 1024, and 2048 bits. (It SHOULD accept RSA keys of any multiple of 8 bits in size from 512 bits to 4092 bits, and MAY accept RSA keys of any size). If there is2. 9a limit on the size of an X.509 certificate, it MUST be at least 8K. If there is a limit on the length of a certificate chain, it MUST be at least 10. X.509 certificates containing and signed by DSS keys of size 512, 768, 1024, and 2048 bits. (It MAY accept DSS keys of any size). An implementation MUST be capable of accepting a shared key for authentication of any size from 1 - 255 bytes. An implementation MUST be capable of accepting IKE messages with sizes up to 16K bytes and SHOULD be capable of accepting IKE messages up to 64K bytes. An implementation MUST be capable of establishing an IKE-SA and a single CHILD-SA in the initial four message exchange. An implementation MAY reject subsequent requests to establish a CHILD- SA. An implementation MUST respond to valid phase 2 messages, but MAY otherwise ignore all such messages other than DELETE. There is no requirement that an implementation be capable of initiating phase 2 exchanges. The above paragraph allows for a minimal implementation to only do the initial 4 message IKE exchange and respond to phase 2 pings and still interoperate with any compliant implementation. In support of this, and implementation that tries to rekey the IKE-SA by means of a CREATE_CHILD_SA exchange MUST be prepared to tear down the IKE-SA and establish a new one if the rekeying operation fails. IKEv2 [Page 50] INTERNET DRAFT October 2002 7 Security Considerations Repeated re-keying using Phase 2 without PFS can consume the entropy of the Diffie-Hellman shared secret. Implementers should take note of this fact and set a limit on Phase 2 Exchanges between exponentiations. This memo does not prescribe such a limit.Harkins Kaufman Kent Kivinen Perlman [Page 60] INTERNET DRAFT April 2002The strength of a key derived from a Diffie-Hellman exchange using any of the groups defined here depends on the inherent strength of the group, the size of the exponent used, and the entropy provided by the random number generator used. Due to these inputs it is difficult to determine the strength of a key for any of the defined groups. Diffie-Hellman group number two when used with a strong random number generator and an exponent no less than 160 bits is sufficient to use for 3DES. Groups three through five provide greater security. Group one is for historic purposes only and does not provide sufficient strength to the required cipher (although it is sufficient for use with DES, which is also for historic use only). Implementations should make note of these conservative estimates when establishing policy and negotiating security parameters. Note that these limitations are on the Diffie-Hellman groups themselves. There is nothing in IKE which prohibits using stronger groups nor is there anything which will dilute the strength obtained from stronger groups. In fact, the extensible framework of IKE encourages the definition of more groups; use of elliptical curve groupswillmay greatly increase strength using much smaller numbers. It is assumed that the Diffie-Hellman exponents in this exchange are erased from memory after use. In particular, these exponents MUST NOT be derived from long-lived secrets like the seed to a pseudo-random generator that is not erased after use. The security of this protocol is critically dependent on the randomness of the Diffie-Hellman exponents, which should be generated by a strong random or properly seeded pseudo-random source (see RFC1715). While the protocol was designed to be secure even if the Nonces and other values specified as random are not strongly random, they should similarly be generated from a strong random source as part of a conservative design.108 IANA Considerations This document contains many "magic numbers" to be maintained by the IANA. This section explains the criteria to be used by the IANA to assign additional numbers in each of these lists.10.1 Transform Types and Attribute Values 10.1.1 Attributes8.1.2 Encryption Algorithm Transformattributes are uses to modify or complete the specification of a particular transform. Requests for new transform attributes MUST be accompanied by an RFC which defines the transform which it modifies or completes and the method in which it does so. Harkins Kaufman Kent Kivinen PerlmanType IKEv2 [Page61]51] INTERNET DRAFTAprilOctober 200210.1.2 Encryption Algorithm Transform TypeValues of the Encryption Algorithm define an encryption algorithm to use when called for in this document. Requests for assignment of new encryption algorithm values must be accompanied by a reference to an RFC that describes how to use this algorithm with ESP.10.1.3 Pseudo-random function Transform Type Values for the pseudo-random function define which pseudo-random function is used in IKE for key generation and expansion. Requests for assignment of a new pseudo-random function MUST be accompanied by a reference to an RFC describing this function. 10.1.48.1.4 Authentication Method Transform Type The only Authentication method defined in the memo is for digital signatures. Other methods of authentication are possible and MUST be accompanied by an RFC which defines the following: - the cryptographic method of authentication. - content of the Authentication Data in the Authentication Payload. - new payloads, their construction and processing, if needed. - additions of payloads to any messages, if needed.10.1.58.1.5 Diffie-Hellman Groups Values of the Diffie-Hellman Group Transform types define a group in which a Diffie-Hellman key exchange can be completed. Requests for assignment of a new Diffie-Hellman group type MUST be accompanied by a reference to an RFC which fully defines the group.10.28.2 Exchange Types This memo defines three exchange types for use with IKEv2. Requests for assignment of new exchange types MUST be accompanied by an RFC which defines the following: - the purpose of and need for the new exchange. - the payloads (mandatory and optional) that accompany messages in the exchange. - the phase of the exchange. - requirements the new exchange has on existing exchanges which have assigned numbers.Harkins Kaufman Kent Kivinen Perlman [Page 62] INTERNET DRAFT April 2002 10.38.3 Payload Types Payloads are defined in this memo to convey information between peers. New payloads may be required when defining a new authentication method or exchange. Requests for new payload types MUST be accompanied by an RFC which defines the physical layout of the payload and the fields it contains. All payloads MUST use the same generic header defined in Figure 2.119 AcknowledgementsWe would like to thank the many membersIKEv2 [Page 52] INTERNET DRAFT October 2002 This document is a collaborative effort of the entire IPsecworking group that provided helpful and constructive suggestions on improving IKE. Special thanks goWG. If there were no limit tothosethe number ofyou who've implemented it! This protocol is builtauthors that could appear on an RFC, theshoulders of many designers who came before. While theyfollowing, in alphabetical order, would havenot necessarily reviewed or endorsed this version and should not be blamedbeen listed: Bill Aiello, Steve Bellovin, Sara Bitan, Matt Blaze, Ran Canetti, Dan Harkins, Paul Hoffman, J. Ioannidis, Steve Kent, Angelos Keromytis, Tero Kivinen, Hugo Krawczyk, Andrew Krywaniuk, Radia Perlman, O. Reingold. Many other people contributed to the design. Hugh Daniel suggested the feature of having the initiator, in message 3, specify a name forany defects, they deserve much ofthecredit for its design. We would like to acknowledge Oakley, SKEMEresponder, andtheir authors, Hilarie Orman (Oakley), Hugo Krawczyk (SKEME). Withoutgave thehard workfeature the cute name "You Tarzan, Me Jane". David Faucher and Valery Smyzlov helped refine the design ofDoug Maughan, Mark Schertler, Mark Schneider, Jeff Turner, Dave Carrel, and Derrell Piper, this memo would not exist. Their contributions totheIPsec WG have been considerable and critical. 12traffic selector negotiation. 10 References[CAST] Adams, C., "The CAST-128 Encryption Algorithm", RFC 2144, May 1997. [BLOW] Schneier, B., "The Blowfish Encryption Algorithm", Dr. Dobb's Journal, v. 19, n. 4, April 1994.[Bra96] Bradner, S., "The Internet Standards Process -- Revision 3", BCP 9, RFC 2026, October 1996. [Bra97] Bradner, S., "Key Words for use in RFCs to indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [Ble98] Bleichenbacher, D., "Chosen Ciphertext Attacks against Protocols Based on RSA Encryption Standard PKCS#1", Advances in Cryptology Eurocrypt '98, Springer-Verlag, 1998. [BR94] Bellare, M., and Rogaway P., "Optimal Asymmetric Encryption", Advances in Cryptology Eurocrypt '94, Springer-Verlag, 1994. [DES] ANSI X3.106, "American National Standard for InformationHarkins Kaufman Kent Kivinen Perlman [Page 63] INTERNET DRAFT April 2002Systems-Data Link Encryption", American National Standards Institute, 1983. [DH] Diffie, W., and Hellman M., "New Directions in Cryptography", IEEE Transactions on Information Theory, V. IT-22, n. 6, June 1977. [DSS] NIST, "Digital Signature Standard", FIPS 186, National Institute of Standards and Technology, U.S. Department of Commerce, May, 1994. [HC98] Harkins, D., Carrel, D., "The Internet Key Exchange (IKE)", RFC 2409, November 1998. [IDEA] Lai, X., "On the Design and Security of Block Ciphers," ETH Series in Information Processing, v. 1, Konstanz: Hartung- Gorre Verlag, 1992 [Ker01] Keronytis, A., Sommerfeld, B., "The 'Suggested ID' Extension IKEv2 [Page 53] INTERNET DRAFT October 2002 for IKE", draft-keronytis-ike-id-00.txt, 2001 [KBC96] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- Hashing for Message Authentication", RFC 2104, February 1997. [SKEME] Krawczyk, H., "SKEME: A Versatile Secure Key Exchange Mechanism for Internet", from IEEE Proceedings of the 1996 Symposium on Network and Distributed Systems Security. [MD5] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321, April 1992. [MSST98] Maughhan, D., Schertler, M., Schneider, M., andJ.Turner, J. "Internet Security Association and Key Management Protocol (ISAKMP)", RFC 2408, November 1998. [Orm96] Orman, H., "The Oakley Key Determination Protocol", RFC 2412, November 1998. [PFKEY] McDonald, D., Metz, C., and Phan, B., "PFKEY Key Management API, Version 2", RFC2367, July 1998. [PKCS1] Kaliski, B., and J. Staddon, "PKCS #1: RSA Cryptography Specifications Version 2", September 1998. [PK01] Perlman, R., and Kaufman, C., "Analysis of the IPsec key exchange Standard", WET-ICE Security Conference, MIT, 2001, http://sec.femto.org/wetice-2001/papers/radia-paper.pdf. [Pip98] Piper, D., "The Internet IP Security Domain OfHarkins Kaufman Kent Kivinen Perlman [Page 64] INTERNET DRAFT April 2002Interpretation for ISAKMP", RFC 2407, November 1998.[RC5] Rivest, R., "The RC5 Encryption Algorithm", Dr. Dobb's Journal, v. 20, n. 1, January 1995.[RSA] Rivest, R., Shamir, A., and Adleman, L., "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems", Communications of theACM, v. 21, n. 2, February 1978. [Sch96] Schneier, B., "Applied Cryptography, Protocols, Algorithms, and Source Code in C", 2nd edition. [SHA] NIST, "Secure Hash Standard", FIPS 180-1, National Institute of Standards and Technology, U.S. Department of Commerce, May 1994. [TIGER] Anderson, R.,ACM, v. 21, n. 2, February 1978. [SHA] NIST, "Secure Hash Standard", FIPS 180-1, National Institute of Standards and Technology, U.S. Department of Commerce, May 1994. IKEv2 [Page 54] INTERNET DRAFT October 2002 Appendix B: Diffie-Hellman Groups There are 5 groups different Diffie-Hellman groups defined for use in IKE. These groups were generated by Richard Schroeppel at the University of Arizona. Properties of these primes are described in [Orm96]. The strength supplied by group one may not be sufficient for the mandatory-to-implement encryption algorithm and is here for historic reasons. B.1 Group 1 - 768 Bit MODP IKE implementations MAY support a MODP group with the following prime and generator. This group is assigned id 1 (one). The prime is: 2^768 - 2 ^704 - 1 + 2^64 * { [2^638 pi] + 149686 } Its hexadecimal value is: FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF The generator is 2. B.2 Group 2 - 1024 Bit MODP IKE implementations SHOULD support a MODP group with the following prime andBiham, E., "Fast Software Encryption", Springer LNCS v. 1039, 1996. Harkins Kaufman Kent Kivinen Perlmangenerator. This group is assigned id 2 (two). IKEv2 [Page65]55] INTERNET DRAFTAprilOctober 2002Appendix A Attribute Assigned Numbers Certain transforms negotiated in an SA payload can have associated attributes. Attribute types can be either Basic (B) or Variable- length (V). Encoding of these attributesThe prime isdefined as Type/Value (Basic) and Type/Length/Value (Variable). See section 7.3.3. Attributes described as basic MUST NOT be encoded as variable. Variable length attributes MUST NOT be encoded as basic even if their2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }. Its hexadecimal valuecan fit into two octets. NOTE: Thisis: FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 FFFFFFFF FFFFFFFF The generator is 2. B.3 Group 3 - 155 Bit EC2N IKE implementations MAY support achange from IKEv1, where increased flexibility may have simplifiedEC2N group with thecomposer of messages but certainly complicatedfollowing characteristics. This group is assigned id 3 (three). The curve is based on theparser. Attribute Classes class value type -------------------------------------------------------------- RESERVED 0-5Galois Field GF[2^155]. The field size is 155. The irreducible polynomial for the field is: u^155 + u^62 + 1. The equation for the elliptic curve is: y^2 + xy = x^3 + ax^2 + b. Field Size: 155 Group Prime/IrreduciblePolynomial 6 V Group Generator One 7 VPolynomial: 0x0800000000000000000000004000000000000001 Group GeneratorTwo 8 VOne: 0x7b Group CurveA 9 VA: 0x0 Group CurveB 10 V RESERVED 11-13 Key Length 14 B Field Size 15 B Group Order 16 V Block Size 17 B values 0-5, 11-13, and 18-16383 are reserved to IANA. Values 16384-32767 are for private use among mutually consenting parties. -B: 0x07338f GroupPrime/Irreducible PolynomialOrder: 0x0800000000000000000057db5698537193aef944 Theprime number of a MODP Diffie-Hellmandata in the KE payload when using this grouporis the value x from the solution (x,y), the point on theirreducible polynomial of an ellipticcurvewhen specifying a private Diffie- Hellman group. - Generator One, Generator Two The X-chosen by taking the randomly chosen secret Ka andY-coordinatecomputing Ka*P, where * is the repetition ofa point on an elliptic curve. WhentheY-coordinate (generator two)group addition and double operations, P isnot given it can be computed withtheX-coordinatecurve point with x coordinate equal to generator 1 and thedefinitiony coordinate determined from the defining equation. The equation of curve is implicitly known by thecurve. - Curve A, CurveGroup Type and the A and BHarkins Kaufman Kent Kivinen Perlmancoefficients. There are two possible values for the y coordinate; either one can be used successfully (the two parties need not agree on the selection). IKEv2 [Page66]56] INTERNET DRAFTAprilOctober 2002Coefficients from the definition of an elliptic curve: y^2 + xy = x^3 + (curve A)x^2 + (curve B)B.4 Group 4 -Key Length When using an Encryption Algorithm that has185 Bit EC2N IKE implementations MAY support avariable length key, this attribute specifiesEC2N group with thekey length in bits. (MUST use network byte order).following characteristics. Thisattribute MUST NOT be used when the specified Encryption Algorithm uses a fixed length key. -group is assigned id 4 (four). The curve is based on the Galois FieldSizeGF[2^185]. The fieldsize, in bits, of a Diffie-Hellman group. - Group Ordersize is 185. Thegroup order of anirreducible polynomial for the field is: u^185 + u^69 + 1. The equation for the elliptic curvegroup. Noteis: y^2 + xy = x^3 + ax^2 + b. Field Size: 185 Group Prime/Irreducible Polynomial: 0x020000000000000000000000000000200000000000000001 Group Generator One: 0x18 Group Curve A: 0x0 Group Curve B: 0x1ee9 Group Order: 0x01ffffffffffffffffffffffdbf2f889b73e484175f94ebc The data in thelength ofKE payload when using thisattribute depends on the field size.group will be identical to that as when using Oakley Group 3 (three). B.5 Group 5 -Block Size The number of bits per block of1536 Bit MODP IKE implementations MUST support acipherMODP group witha variable block length. Harkins Kaufman Kent Kivinen Perlmanthe following prime and generator. This group is assigned id 5 (five). The prime is 2^1536 - 2^1472 - 1 + 2^64 * {[2^1406 pi] + 741804}. Its hexadecimal value is FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE45B3D C2007CB8 A163BF05 98DA4836 1C55D39A 69163FA8 FD24CF5F 83655D23 DCA3AD96 1C62F356 208552BB 9ED52907 7096966D 670C354E 4ABC9804 F1746C08 CA237327 FFFFFFFF FFFFFFFF The generator is 2. IKEv2 [Page67]57] INTERNET DRAFTAprilOctober 2002Appendix B: Cryptographic Protection of IKE Data With the exception of the IKE-SA-INIT-REQUEST, IKE-SA-INIT-RESPONSE, and Informational Exchange error notifications when no IKE-SA exists, all IKE messages are encrypted and integrity protected. The algorithms for encryption and integrity protection are negotiated during IKE-SA setup, andChange History H.1 Changes from IKEv2-00 to IKEv2-01 February 2002 1) Changed Appendix B to specify thekeys are computed as specified in sections 3 and 4.2. Theencryption andintegrity protection algorithms are modelled after the ESP algorithms described in RFCs 2104, 2406, 2451. This appendix completely specifies the cryptographicauthentication processingoffor IKEdata, but those documents should be consultedrather than referencing ESP. Simplified the format by removing idiosyncracies not needed fordesign rationale. This appendix assumes a block cipher with a fixed block size and an integrity check algorithm that computes a fixed length checksum overIKE. 2) Added option for authentication via avariable size message. The mandatory to implement algorithms are AES-128 and HMAC-SHA1. Harkins Kaufman Kent Kivinen Perlman [Page 68] INTERNET DRAFT April 2002 The formatshared secret key. 3) Specified different keys in the two directions ofanIKEmessage is shownmessages. Removed requirement of different cookies inFigure 18. 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Fixed IKE Header - 28 octets ! ! (including cookies, message ID, Length) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! Initialization Vector ! ! (length is block size for encryption algorithm) ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! IKE Payloads ! + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ! ! Padding (0-255 octets) ! +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ ! ! Pad Length ! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ~ Authentication Data ~ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 18: IKE message with cryptographic protection o Initialization Vector - A randomly chosen value whose length is equalthe two directions since now no longer required. 4) Change the quantities signed by the two ends in AUTH fields to assure theblock lengthtwo parties sign different quantities. 5) Changed reference to AES to AES_128. 6) Removed requirement that Diffie-Hellman be repeated when rekeying IKE SA. 7) Fixed typos. 8) Clarified requirements around use of port 500 at theunderlying encryption algorithm. Recipients MUST accept any value. Senders SHOULD either pick this value pseudo-randomly and independentlyremote end in support of NAT. 9) Clarified required ordering foreach message or usepayloads. 10) Suggested mechanisms for avoiding DoS attacks. 11) Removed claims in some places that thefinal ciphertext block offirst phase 2 piggybacked on phase 1 was optional. H.2 Changes from IKEv2-01 to IKEv2-02 April 2002 1) Moved thepreviousInitiator CERTREQ payload from messagesent. Senders MUST NOT use the same value for each message, use a sequence of values with low hamming distance (e.g.1 to message 3. 2) Added asequence number), or use ciphertext fromsecond optional ID payload in message 3 for the Initiator to name areceived message. o IKE Payloadsdesired Responder to support the case where multiple named identities areasserved by a single IP address. 3) Deleted the optimization whereby the Diffie-Hellman group did not need to be specified inSection 7. This field is encrypted withphase 2 if it was thenegotiated cipher. o Padding may contain any value chosen bysame as in phase 1 (it complicated thesender, and must havedesign with no meaningful benefit). 4) Added alength that makessection on thecombinationimplications of reusing Diffie-Hellman expontentials IKEv2 [Page 58] INTERNET DRAFT October 2002 5) Changed thePayloads, the Padding,specification of sequence numbers to being at 0 in both directions. 6) Many editorial changes and corrections, thePad Length to bemost significant being amultipleglobal replace ofthe encryption block size. This field is encrypted"byte" with "octet". H.3 Changes from IKEv2-02 to IKEv2-03 October 2002 1) Reorganized thenegotiated cipher. o Pad Length is the length of the Padding field. The sender SHOULD set the Pad Lengthdocument moving introductory material to theminimum value that makesfront. 2) Simplified thecombinationspecification of Traffic Selectors to allow only IPv4 and IPv6 address ranges, as was done in thePayloads,JFK spec. 3) Fixed thePadding, andproblem brought up by David Faucher with thePad Length a multiple offix suggested by Valery Smyslov. If Bob needs to narrow theblock size,selector range, but has more than one matching narrower range, then if Alice's first selector is a single address pair, Bob chooses therecipient MUST accept any lengthrange thatresults in proper alignment. This field is encryptedencompasses that. 4) To harmonize with thenegotiated cipher. o Authentication Data isJFK spec, changed thecryptographic checksum ofexchange so that theHarkins Kaufman Kent Kivinen Perlman [Page 69] INTERNET DRAFT April 2002 entire message starting withinitial exchange can be completed in four messages even if theFixed IKE Header throughresponder must invoke an anti-clogging defense and thePad Length. The checksum MUST be computed overinitiator incorrectly anticipates the responder's choice of Diffie-Hellman group. This required changing the syntax of encryptedmessage. Authors' Addresses Dan Harkins dharkins@trpz.com Trapeze Networksmessages to allow messages that are partially encrypted. 5) Replaced the hierarchical SA payload with a simplified version that only negotiates suites of cryptographic algorithms. Separated out negotiation of window size. Removed specifications of large numbers of rarely used algorithms. 6) Changed the formulas for key derivation as proposed by Hugo Krawczyk. 7) Added Comformance Requirements section. Author's Address Charlie Kaufmanckaufman@iris.comcharlie_kaufman@notesdev.ibm.com IBMSteve Kent kent@bbn.com BBN Technologies Tero Kivinen kivinen@ssh.com SSH Communications Security Radia Perlman radia.perlman@sun.com Sun Microsystems Harkins Kaufman Kent Kivinen PerlmanIKEv2 [Page70]59] ----