idnits 2.17.1 draft-ietf-lwig-ikev2-minimal-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (October 17, 2013) is 3838 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Missing Reference: 'CERTREQ' is mentioned on line 267, but not defined == Missing Reference: 'IPSECARCH' is mentioned on line 520, but not defined == Missing Reference: 'MD5' is mentioned on line 983, but not defined == Missing Reference: 'SHA' is mentioned on line 984, but not defined == Missing Reference: 'ADDGROUP' is mentioned on line 1005, but not defined == Missing Reference: 'IDNA' is mentioned on line 1143, but not defined == Missing Reference: 'EAI' is mentioned on line 1148, but not defined == Missing Reference: 'PKCS1' is mentioned on line 1261, but not defined == Missing Reference: 'DSS' is mentioned on line 1269, but not defined ** Obsolete normative reference: RFC 5996 (Obsoleted by RFC 7296) Summary: 1 error (**), 0 flaws (~~), 11 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Light-Weight Implementation Guidance T. Kivinen 3 (lwig) INSIDE Secure 4 Internet-Draft October 17, 2013 5 Intended status: Informational 6 Expires: April 20, 2014 8 Minimal IKEv2 9 draft-ietf-lwig-ikev2-minimal-01.txt 11 Abstract 13 This document describes minimal version of the Internet Key Exchange 14 version 2 (IKEv2) protocol. IKEv2 is a component of IPsec used for 15 performing mutual authentication and establishing and maintaining 16 Security Associations (SAs). IKEv2 includes several optional 17 features, which are not needed in minimal implementations. This 18 document describes what is required from the minimal implementation, 19 and also describes various optimizations which can be done. The 20 protocol described here is compliant with full IKEv2 with exception 21 that this document describes mainly shared secret authentication 22 (IKEv2 requires support for certificate authentication in addition to 23 shared secret authentication). 25 This document does not update or modify RFC 5996, but provides more 26 compact description of the minimal version of the protocol. If this 27 document and RFC 5996 conflicts then RFC 5996 is the authoritative 28 description. 30 Status of this Memo 32 This Internet-Draft is submitted in full conformance with the 33 provisions of BCP 78 and BCP 79. 35 Internet-Drafts are working documents of the Internet Engineering 36 Task Force (IETF). Note that other groups may also distribute 37 working documents as Internet-Drafts. The list of current Internet- 38 Drafts is at http://datatracker.ietf.org/drafts/current/. 40 Internet-Drafts are draft documents valid for a maximum of six months 41 and may be updated, replaced, or obsoleted by other documents at any 42 time. It is inappropriate to use Internet-Drafts as reference 43 material or to cite them other than as "work in progress." 45 This Internet-Draft will expire on April 20, 2014. 47 Copyright Notice 48 Copyright (c) 2013 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (http://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 This document may contain material from IETF Documents or IETF 62 Contributions published or made publicly available before November 63 10, 2008. The person(s) controlling the copyright in some of this 64 material may not have granted the IETF Trust the right to allow 65 modifications of such material outside the IETF Standards Process. 66 Without obtaining an adequate license from the person(s) controlling 67 the copyright in such materials, this document may not be modified 68 outside the IETF Standards Process, and derivative works of it may 69 not be created outside the IETF Standards Process, except to format 70 it for publication as an RFC or to translate it into languages other 71 than English. 73 Table of Contents 75 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 76 1.1. Use Cases . . . . . . . . . . . . . . . . . . . . . . . . 4 77 2. Exchanges . . . . . . . . . . . . . . . . . . . . . . . . . . 6 78 2.1. Initial Exchange . . . . . . . . . . . . . . . . . . . . . 6 79 2.2. Other Exchanges . . . . . . . . . . . . . . . . . . . . . 11 80 2.3. Generating Keying Material . . . . . . . . . . . . . . . . 12 81 3. Conformance Requirements . . . . . . . . . . . . . . . . . . . 14 82 4. Security Considerations . . . . . . . . . . . . . . . . . . . 15 83 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 84 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 17 85 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 18 86 7.1. Normative References . . . . . . . . . . . . . . . . . . . 18 87 7.2. Informative References . . . . . . . . . . . . . . . . . . 18 88 Appendix A. Header and Payload Formats . . . . . . . . . . . . . 19 89 A.1. The IKE Header . . . . . . . . . . . . . . . . . . . . . . 19 90 A.2. Generic Payload Header . . . . . . . . . . . . . . . . . . 21 91 A.3. Security Association Payload . . . . . . . . . . . . . . . 22 92 A.3.1. Proposal Substructure . . . . . . . . . . . . . . . . 24 93 A.3.2. Transform Substructure . . . . . . . . . . . . . . . . 25 94 A.3.3. Valid Transform Types by Protocol . . . . . . . . . . 27 95 A.3.4. Transform Attributes . . . . . . . . . . . . . . . . . 28 96 A.4. Key Exchange Payload . . . . . . . . . . . . . . . . . . . 28 97 A.5. Identification Payloads . . . . . . . . . . . . . . . . . 29 98 A.6. Certificate Payload . . . . . . . . . . . . . . . . . . . 30 99 A.7. Certificate Request Payload . . . . . . . . . . . . . . . 31 100 A.8. Authentication Payload . . . . . . . . . . . . . . . . . . 32 101 A.9. Nonce Payload . . . . . . . . . . . . . . . . . . . . . . 33 102 A.10. Notify Payload . . . . . . . . . . . . . . . . . . . . . . 33 103 A.10.1. Notify Message Types . . . . . . . . . . . . . . . . . 34 104 A.11. Traffic Selector Payload . . . . . . . . . . . . . . . . . 35 105 A.11.1. Traffic Selector . . . . . . . . . . . . . . . . . . . 37 106 A.12. Encrypted Payload . . . . . . . . . . . . . . . . . . . . 38 107 Appendix B. Useful Optional Features . . . . . . . . . . . . . . 41 108 B.1. IKE SA Delete Notification . . . . . . . . . . . . . . . . 41 109 B.2. Raw Public Keys . . . . . . . . . . . . . . . . . . . . . 42 110 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 44 112 1. Introduction 114 This document tells what minimal IKEv2 implementation could look 115 like. Minimal IKEv2 implementation only supports initiator end of 116 the protocol. It only supports the initial IKE_SA_INIT and IKE_AUTH 117 exchanges and does not initiate any other exchanges. It also replies 118 with empty (or error) message to all incoming requests. 120 This means that most of the optional features of IKEv2 are left out: 121 NAT Traversal, IKE SA rekey, Child SA Rekey, Multiple Child SAs, 122 Deleting Child / IKE SAs, Configuration payloads, EAP authentication, 123 COOKIEs etc. 125 Some optimizations can be done because of limited set of supported 126 features, and this text should not be considered for generic IKEv2 127 implementations (for example Message IDs can be done as specified as 128 implementation is only sending out IKE_SA_INIT and IKE_AUTH request, 129 and do not ever send any other request). 131 This document should be stand-alone, meaning everything needed to 132 implement IKEv2 is copied here except the description of the 133 cryptographic algorithms. The IKEv2 specification has lots of 134 background information and rationale which has been omitted from this 135 document. 137 Numerous additional numeric values from IANA registries have been 138 omitted from this document, only those which are of interest for 139 minimal implementation are listed in this document. 141 The main body of this document describes how to use the shared secret 142 authentication in the IKEv2, as it is easiest to implement. In some 143 cases that is not enough and the Appendix B.2 describes how to use 144 Raw Public keys instead of shared secret authentication. 146 For more information check the full IKEv2 specification in RFC 5996 147 [RFC5996] and [IKEV2IANA]. 149 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 150 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 151 document are to be interpreted as described in [RFC2119]. 153 1.1. Use Cases 155 One use case for this kind of minimal implementation is in small 156 devices doing machine to machine communication. In such environments 157 the node initiating connections is usually very small and the other 158 end of the communication channel is some kind of larger device. 160 An example of the small initiating node could be an remote garage 161 door opener device. I.e. device having buttons which open and close 162 garage door, and which connects to the home area network server over 163 wireless link. 165 Another example of the such device is some kind of sensor device, for 166 example room temperature sensor, which sends periodic temperature 167 data to some centralized node. 169 Those devices are usually sleeping long times, and only wakes up 170 because of user interaction or periodically. The data transfer is 171 always initiated from the sleeping node and after they send packets 172 there might be ACKs or other packets coming back before they go back 173 to sleep. If some data needs to be transferred from server node to 174 the small device, it can be implemented by polling, i.e. small node 175 periodically polls for the server to see if it for example have some 176 configuration changes or similar. 178 2. Exchanges 180 2.1. Initial Exchange 182 All IKEv2 communications consist of pairs of messages: a request and 183 a response. The pair is called an "exchange", and is sometimes 184 called a "request/response pair". Every request requires a response. 186 For every pair of IKEv2 messages, the initiator is responsible for 187 retransmission in the event of a timeout. The responder MUST never 188 retransmit a response unless it receives a retransmission of the 189 request. 191 IKEv2 is a reliable protocol: the initiator MUST retransmit a request 192 until it either receives a corresponding response or deems the IKE SA 193 to have failed. A retransmission from the initiator MUST be bitwise 194 identical to the original request. Retransmission times MUST 195 increase exponentially. 197 IKEv2 is run over UDP port 500. All IKEv2 implementations MUST be 198 able to send, receive, and process IKEv2 messages that are up to 1280 199 octets long. An implementation MUST accept incoming requests even if 200 the source port is not 500, and MUST respond to the address and port 201 from which the request was received. 203 The minimal implementation of IKEv2 only uses first two exchanges 204 called IKE_SA_INIT and IKE_AUTH. Those are used to create the IKE SA 205 and the first child SA. In addition to those messages minimal IKEv2 206 implementation need to understand CREATE_CHILD_SA request so it can 207 reply with CREATE_CHILD_SA error response saying NO_ADDITIONAL_SAS to 208 it, and understand INFORMATIONAL request so much, it can reply with 209 empty INFORMATIONAL response to it. There is no requirement to be 210 able to respond to any other requests. 212 All messages following the IKE_SA_INIT exchange are cryptographically 213 protected using the cryptographic algorithms and keys negotiated in 214 the IKE_SA_INIT exchange. 216 Every IKEv2 message contains a Message ID as part of its fixed 217 header. This Message ID is used to match up requests and responses, 218 and to identify retransmissions of messages. 220 Minimal implementation need only support of being initiator, so it 221 does not ever need to send any other request as one IKE_SA_INIT, and 222 one IKE_AUTH message. As those messages have fixed Message IDs (0 223 and 1) it does not need to keep track of its own Message IDs for 224 outgoing requests after that. 226 Minimal implementations can also optimize Message ID handling of the 227 incoming requests, as they do not need to protect incoming requests 228 against replays. This is possible because minimal implementation 229 will only return error or empty notifications replies to incoming 230 requests. This means that any of those incoming requests do not have 231 any effect on the minimal implementation, thus processing them again 232 does not cause any harm. Because of this the minimal implementation 233 can always answer to request coming in, with the same Message ID than 234 what the request had and then forget the request/response pair 235 immediately. This means there is no need to keep any kind of track 236 of Message IDs of the incoming requests. 238 In the following descriptions, the payloads contained in the message 239 are indicated by names as listed below. 241 Notation Payload 242 ----------------------------------------- 243 AUTH Authentication 244 CERTREQ Certificate Request 245 D Delete 246 HDR IKE header (not a payload) 247 IDi Identification - Initiator 248 IDr Identification - Responder 249 KE Key Exchange 250 Ni, Nr Nonce 251 N Notify 252 SA Security Association 253 SK Encrypted and Authenticated 254 TSi Traffic Selector - Initiator 255 TSr Traffic Selector - Responder 257 The initial exchanges are as follows: 259 Initiator Responder 260 ------------------------------------------------------------------- 261 HDR(SPIi=xxx, SPIr=0, IKE_SA_INIT, 262 Flags: Initiator, Message ID=0), 263 SAi1, KEi, Ni --> 265 <-- HDR(SPIi=xxx, SPIr=yyy, IKE_SA_INIT, 266 Flags: Response, Message ID=0), 267 SAr1, KEr, Nr, [CERTREQ] 269 HDR contains the Security Parameter Indexes (SPIs), version numbers, 270 and flags of various sorts. Each endpoint chooses one of the two 271 SPIs and MUST choose them so as to be unique identifiers of an IKE 272 SA. An SPI value of zero is special: it indicates that the remote 273 SPI value is not yet known by the sender. 275 Incoming IKEv2 packets are mapped to an IKE SA only using the 276 packet's SPI, not using (for example) the source IP address of the 277 packet. 279 The SAi1 payload states the cryptographic algorithms the initiator 280 supports for the IKE SA. The KEi and KEr payload contain Diffie- 281 Hellman values and Ni and Nr are the nonces. The SAr1 contains 282 chosen cryptographic suite from initiator's offered choices. Minimal 283 implementation using shared secrets will ignore the CERTREQ payload. 285 Minimal implementation will most likely support exactly one set of 286 cryptographic algorithms, meaning the SAi1 payload will be static. 287 It needs to check that the SAr1 received matches the proposal it 288 sent. 290 At this point in the negotiation, each party can generate SKEYSEED, 291 from which all keys are derived for that IKE SA. 293 SKEYSEED = prf(Ni | Nr, g^ir) 295 {SK_d | SK_ai | SK_ar | SK_ei | SK_er | SK_pi | SK_pr } 296 = prf+ (SKEYSEED, Ni | Nr | SPIi | SPIr ) 298 prf+ (K,S) = T1 | T2 | T3 | T4 | ... 300 where: 301 T1 = prf (K, S | 0x01) 302 T2 = prf (K, T1 | S | 0x02) 303 T3 = prf (K, T2 | S | 0x03) 304 T4 = prf (K, T3 | S | 0x04) 305 ... 307 (indicating that the quantities SK_d, SK_ai, SK_ar, SK_ei, SK_er, 308 SK_pi, and SK_pr are taken in order from the generated bits of the 309 prf+). g^ir is the shared secret from the ephemeral Diffie-Hellman 310 exchange. g^ir is represented as a string of octets in big endian 311 order padded with zeros if necessary to make it the length of the 312 modulus. Ni and Nr are the nonces, stripped of any headers. 314 The SK_d is used for deriving new keys for the Child SAs. The SK_ai 315 and SK_ar are used as a key to the integrity protection algorithm for 316 authenticating the component messages of subsequent exchanges. The 317 SK_ei and SK_er are used for encrypting (and of course decrypting) 318 all subsequent exchanges. The SK_pi and SK_pr are used when 319 generating an AUTH payload. The lengths of SK_d, SK_pi, and SK_pr 320 MUST be the preferred key length of the PRF agreed upon. 322 A separate SK_e and SK_a is computed for each direction. The keys 323 used to protect messages from the original initiator are SK_ai and 324 SK_ei. The keys used to protect messages in the other direction are 325 SK_ar and SK_er. The notation SK { ... } indicates that these 326 payloads are encrypted and integrity protected using that direction's 327 SK_e and SK_a. 329 Initiator Responder 330 ------------------------------------------------------------------- 331 HDR(SPIi=xxx, SPIr=yyy, IKE_AUTH, 332 Flags: Initiator, Message ID=1), 333 SK {IDi, AUTH, SAi2, TSi, TSr, 334 N(INITIAL_CONTACT)} --> 336 <-- HDR(SPIi=xxx, SPIr=yyy, IKE_AUTH, Flags: 337 Response, Message ID=1), 338 SK {IDr, AUTH, SAr2, TSi, TSr} 340 The initiator asserts its identity with the IDi payload, proves 341 knowledge of the secret corresponding to IDi and integrity protects 342 the contents of the first message using the AUTH payload. The 343 responder asserts its identity with the IDr payload, authenticates 344 its identity and protects the integrity of the second message with 345 the AUTH payload. 347 As minimal implementation usually has only one host where it 348 connects, and that means it has only one shared secret. This means 349 it does not need to care about IDr payload that much. If the other 350 end sends AUTH payload which initiator can verify using the shared 351 secret it has, then it knows the other end is the peer it was 352 configured to talk to. 354 In the IKE_AUTH initiator sends SA offer(s) in the SAi2 payload, and 355 the proposed Traffic Selectors for the proposed Child SA in the TSi 356 and TSr payloads. The responder replies with the accepted offer in 357 an SAr2 payload, and selected Traffic Selectors. The selected 358 Traffic Selectors may be a subset of what the initiator proposed. 360 In the minimal implementation both SA payloads and TS payloads are 361 going to be mostly static. The SA payload will have the SPI value 362 used in the ESP, but the algorithms are most likely going to be the 363 one and only supported set. The TS payloads on the initiator end 364 will most likely say from any to any, i.e. full wildcard ranges, or 365 from the local IP to the remote IP. In the wildcard case the server 366 quite often narrow the range down to the one IP address pair. Using 367 single IP address pair as a traffic selectors when sending IKE_AUTH 368 will simplify processing as then server will either accept that pair 369 or return error. If wildcard ranges are used, there is possibility 370 that server narrows the range to some other range than what was 371 intended. 373 The IKE_AUTH (and IKE_SA_INIT) responses may contain multiple status 374 notification payloads which can be ignored by minimal implementation. 375 There can also be Vendor ID, Certificate, Certificate Request or 376 Configuration payloads, but any payload unknown to minimal 377 implementation can simply be skipped over (response messages cannot 378 have critical unsupported payloads). 380 The exchange above includes N(INITIAL_CONTACT) notification in the 381 request as that is quite commonly sent by the minimal implementation. 382 It indicates to the other end that the initiator does not have any 383 other IKE SAs between them, and if there is any left from previous 384 runs they can be deleted. As minimal implementation does not delete 385 IKE SAs by sending IKE SA delete, this will help server to clean up 386 leftover state. 388 When using shared secret authentication, the peers are authenticated 389 by having each calculating a MAC over a block of data: 391 For the initiator: 392 AUTH = prf( prf(Shared Secret, "Key Pad for IKEv2"), 393 ) 394 For the responder: 395 AUTH = prf( prf(Shared Secret, "Key Pad for IKEv2"), 396 ) 398 The string "Key Pad for IKEv2" is 17 ASCII characters without null 399 termination. The implementation can precalculate the inner prf and 400 only store the output of it. This is possible because minimal IKEv2 401 implementation usually only supports one PRF. 403 The initiator signs the first message (IKE_SA_INIT request), starting 404 with the first octet of the first SPI in the header and ending with 405 the last octet of the last payload in that first message. Appended 406 to this (for purposes of computing the signature) are the responder's 407 nonce Nr, and the value prf(SK_pi, IDi'). 409 For the responder, the octets to be signed start with the first octet 410 of the first SPI in the header of the second message (IKE_SA_INIT 411 response) and end with the last octet of the last payload in that 412 second message. Appended to this are the initiator's nonce Ni, and 413 the value prf(SK_pr, IDr'). 415 In these calculations, IDi' and IDr' are the entire ID payloads 416 excluding the fixed header and the Ni, and Nr are only the value, not 417 the payload containing it. Note that neither the nonce Ni/Nr nor the 418 value prf(SK_pr, IDr')/prf(SK_pi, IDi') are transmitted. 420 The initiator's signed octets can be described as: 422 InitiatorSignedOctets = RealMessage1 | NonceRData | MACedIDForI 423 GenIKEHDR = [ four octets 0 if using port 4500 ] | RealIKEHDR 424 RealIKEHDR = SPIi | SPIr | . . . | Length 425 RealMessage1 = RealIKEHDR | RestOfMessage1 426 NonceRPayload = PayloadHeader | NonceRData 427 InitiatorIDPayload = PayloadHeader | RestOfInitIDPayload 428 RestOfInitIDPayload = IDType | RESERVED | InitIDData 429 MACedIDForI = prf(SK_pi, RestOfInitIDPayload) 431 The responder's signed octets can be described as: 433 ResponderSignedOctets = RealMessage2 | NonceIData | MACedIDForR 434 GenIKEHDR = [ four octets 0 if using port 4500 ] | RealIKEHDR 435 RealIKEHDR = SPIi | SPIr | . . . | Length 436 RealMessage2 = RealIKEHDR | RestOfMessage2 437 NonceIPayload = PayloadHeader | NonceIData 438 ResponderIDPayload = PayloadHeader | RestOfRespIDPayload 439 RestOfRespIDPayload = IDType | RESERVED | RespIDData 440 MACedIDForR = prf(SK_pr, RestOfRespIDPayload) 442 Note that all of the payloads inside the RestOfMessageX are included 443 under the signature, including any payload types not listed in this 444 document. 446 The initiator might also get unauthenticated response back having 447 notification payload with error code inside. As that error code will 448 be unauthenticated and may be faked, there is no need to do anything 449 for those. Minimal implementation can simply ignore those errors, 450 and retransmit its request until it times out and if that happens 451 then the IKE SA (and Child SA) creation failed. 453 Responder might also reply with IKE_AUTH response packet which do not 454 contain payloads needed to set up Child SA (SAr2, TSi and TSr), but 455 contains AUTH payload and an error. As minimal implementation 456 probably do not support multiple SAs nor sending the CREATE_CHILD_SA 457 exchanges the IKE SA is useless for initiator. It can delete the IKE 458 SA and start over from the beginning (which might fail again if this 459 is configuration error, or it might succeed if this was temporal 460 failure). 462 2.2. Other Exchanges 464 Minimal implementation MUST be able to reply to INFORMATIONAL request 465 by sending empty response back: 467 Initiator Responder 468 ------------------------------------------------------------------- 469 <-- HDR(SPIi=xxx, SPIr=yyy, INFORMATIONAL, 470 Flags: none, Message ID=m), 471 SK {...} 473 HDR(SPIi=xxx, SPIr=yyy, INFORMATIONAL, 474 Flags: Initiator | Response, 475 Message ID=m), 476 SK {} --> 478 Minimal implementation also MUST be able to reply to incoming 479 CREATE_CHILD_SA requests. Typical implementation will reject the 480 CREATE_CHILD_SA exchanges by sending NO_ADDITIONAL_SAS error notify 481 back: 483 Initiator Responder 484 ------------------------------------------------------------------- 485 <-- HDR(SPIi=xxx, SPIy=yyy, CREATE_CHILD_SA, 486 Flags: none, Message ID=m), 487 SK {...} 489 HDR(SPIi=xxx, SPIr=yyy, CREATE_CHILD_SA, 490 Flags: Initiator | Response, Message ID=m), 491 SK {N(NO_ADDITIONAL_SAS)} --> 493 Note, that INFORMATIONAL and CREATE_CHILD_SA requests might contain 494 unsupported critical payloads, in which case complient implementation 495 MUST ignore the request, and send response message back having the 496 UNSUPPORTED_CRITICAL_PAYLOAD notification. That notification payload 497 data contains one-octet payload type of the unsupported critical 498 payload. 500 2.3. Generating Keying Material 502 Keying material for Child SA created by the IKE_AUTH exchange is 503 generated as follows: 505 KEYMAT = prf+(SK_d, Ni | Nr) 507 Where Ni and Nr are the nonces from the IKE_SA_INIT exchange. 509 A single CHILD_SA negotiation may result in multiple Security 510 Associations. ESP and AH SAs exist in pairs (one in each direction), 511 so two SAs are created in a single Child SA negotiation for them. 512 The keying material for each Child SA MUST be taken from the expanded 513 KEYMAT using the following rules: 515 o All keys for SAs carrying data from the initiator to the responder 516 are taken before SAs going from the responder to the initiator. 518 o If an IPsec protocol requires multiple keys, the order in which 519 they are taken from the SA's keying material needs to be described 520 in the protocol's specification. For ESP and AH, [IPSECARCH] 521 defines the order, namely: the encryption key (if any) MUST be 522 taken from the first bits and the integrity key (if any) MUST be 523 taken from the remaining bits. 525 Each cryptographic algorithm takes a fixed number of bits of keying 526 material specified as part of the algorithm, or negotiated in SA 527 payloads. 529 3. Conformance Requirements 531 For an implementation to be called conforming to RFC 5996 532 specification, it MUST be possible to configure it to accept the 533 following: 535 o Public Key Infrastructure using X.509 (PKIX) Certificates 536 containing and signed by RSA keys of size 1024 or 2048 bits, where 537 the ID passed is any of ID_KEY_ID, ID_FQDN, ID_RFC822_ADDR, or 538 ID_DER_ASN1_DN. 540 o Shared key authentication where the ID passed is any of ID_KEY_ID, 541 ID_FQDN, or ID_RFC822_ADDR. 543 o Authentication where the responder is authenticated using PKIX 544 Certificates and the initiator is authenticated using shared key 545 authentication. 547 This document only supports the second bullet, it does not support 548 PKIX certificates at all. As full RFC5996 responders must also 549 support that shared key authentication, this allows minimal 550 implementation to be able to interoperate with all RFC 5996 compliant 551 implementations. 553 PKIX certificates are left out from the minimal implementation as 554 those would add quite a lot of complexity to the implementation. The 555 actual code changes needed in the IKEv2 protocol are small, but the 556 certificate validation code would be more complex than the whole 557 minimal IKEv2 implementation itself. If public key based 558 authentication is needed for scalability reasons, then raw public 559 keys would probably be the best compromize (see Appendix B.2). 561 4. Security Considerations 563 As this implements same protocol as RFC 5996 this means all security 564 considerations from it also apply to this document. 566 5. IANA Considerations 568 There is no new IANA considerations in this document. 570 6. Acknowledgements 572 Most of the contents of this document is copied from the RFC 5996. 574 7. References 576 7.1. Normative References 578 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 579 Requirement Levels", BCP 14, RFC 2119, March 1997. 581 [RFC5996] Kaufman, C., Hoffman, P., Nir, Y., and P. Eronen, 582 "Internet Key Exchange Protocol Version 2 (IKEv2)", 583 RFC 5996, September 2010. 585 7.2. Informative References 587 [I-D.ietf-ipsecme-oob-pubkey] 588 Kivinen, T., Wouters, P., and H. Tschofenig, "More Raw 589 Public Keys for IKEv2", draft-ietf-ipsecme-oob-pubkey-00 590 (work in progress), April 2013. 592 [IKEV2IANA] 593 "Internet Key Exchange Version 2 (IKEv2) Parameters", 594 . 596 [MODES] National Institute of Standards and Technology, U.S. 597 Department of Commerce, "Recommendation for Block Cipher 598 Modes of Operation", SP 800-38A, 2001. 600 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 601 Housley, R., and W. Polk, "Internet X.509 Public Key 602 Infrastructure Certificate and Certificate Revocation List 603 (CRL) Profile", RFC 5280, May 2008. 605 Appendix A. Header and Payload Formats 607 This appendix describes actual packet payload formats. This is 608 required to make the document self contained. The descriptions are 609 mostly copied from the RFC5996 and more information can be found from 610 there. 612 Various payload contains RESERVED fields and those MUST be sent as 613 zero and MUST be ignored on receipt. 615 All multi-octet fields representing integers are laid out in big 616 endian order (also known as "most significant byte first", or 617 "network byte order"). 619 A.1. The IKE Header 621 Each IKEv2 message begins with the IKE header, denoted HDR in this 622 document. Following the header are one or more IKE payloads each 623 identified by a "Next Payload" field in the preceding payload. 624 Payloads are identified in the order in which they appear in an IKE 625 message by looking in the "Next Payload" field in the IKE header, and 626 subsequently according to the "Next Payload" field in the IKE payload 627 itself until a "Next Payload" field of zero indicates that no 628 payloads follow. If a payload of type "Encrypted" is found, that 629 payload is decrypted and its contents parsed as additional payloads. 630 An Encrypted payload MUST be the last payload in a packet and an 631 Encrypted payload MUST NOT contain another Encrypted payload. 633 The format of the IKE header is shown in Figure 1. 635 1 2 3 636 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 637 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 638 | IKE SA Initiator's SPI | 639 | | 640 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 641 | IKE SA Responder's SPI | 642 | | 643 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 644 | Next Payload | MjVer | MnVer | Exchange Type | Flags | 645 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 646 | Message ID | 647 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 648 | Length | 649 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 651 Figure 1: IKE Header Format 653 o Initiator's SPI (8 octets) - A value chosen by the initiator to 654 identify a unique IKE Security Association. This value MUST NOT 655 be zero. 657 o Responder's SPI (8 octets) - A value chosen by the responder to 658 identify a unique IKE Security Association. This value MUST be 659 zero in the first message of an IKE initial exchange. 661 o Next Payload (1 octet) - Indicates the type of payload that 662 immediately follows the header. The format and value of each 663 payload are defined below. 665 o Major Version (4 bits) - Indicates the major version of the IKE 666 protocol in use. Implementations based on this version of IKE 667 MUST set the major version to 2 and MUST drop the messages with a 668 higher major version number. 670 o Minor Version (4 bits) - Indicates the minor version of the IKE 671 protocol in use. Implementations based on this version of IKE 672 MUST set the minor version to 0. They MUST ignore the minor 673 version number of received messages. 675 o Exchange Type (1 octet) - Indicates the type of exchange being 676 used. This constrains the payloads sent in each message in an 677 exchange. 679 Exchange Type Value 680 ---------------------------------- 681 IKE_SA_INIT 34 682 IKE_AUTH 35 683 CREATE_CHILD_SA 36 684 INFORMATIONAL 37 686 o Flags (1 octet) - Indicates specific options that are set for the 687 message. Presence of options is indicated by the appropriate bit 688 in the flags field being set. The bits are as follows: 690 +-+-+-+-+-+-+-+-+ 691 |X|X|R|V|I|X|X|X| 692 +-+-+-+-+-+-+-+-+ 694 In the description below, a bit being 'set' means its value is 695 '1', while 'cleared' means its value is '0'. 'X' bits MUST be 696 cleared when sending and MUST be ignored on receipt. 698 * R (Response) - This bit indicates that this message is a 699 response to a message containing the same Message ID. This bit 700 MUST be cleared in all request messages and MUST be set in all 701 responses. An IKEv2 endpoint MUST NOT generate a response to a 702 message that is marked as being a response. 704 * V (Version) - This bit indicates that the transmitter is 705 capable of speaking a higher major version number of the 706 protocol than the one indicated in the major version number 707 field. Implementations of IKEv2 MUST clear this bit when 708 sending and MUST ignore it in incoming messages. 710 * I (Initiator) - This bit MUST be set in messages sent by the 711 original initiator of the IKE SA and MUST be cleared in 712 messages sent by the original responder. It is used by the 713 recipient to determine which eight octets of the SPI were 714 generated by the recipient. This bit changes to reflect who 715 initiated the last rekey of the IKE SA. 717 o Message ID (4 octets, unsigned integer) - Message identifier used 718 to control retransmission of lost packets and matching of requests 719 and responses. It is essential to the security of the protocol 720 because it is used to prevent message replay attacks. 722 o Length (4 octets, unsigned integer) - Length of the total message 723 (header + payloads) in octets. 725 A.2. Generic Payload Header 727 Each IKE payload begins with a generic payload header, shown in 728 Figure 2. Figures for each payload below will include the generic 729 payload header, but for brevity, the description of each field will 730 be omitted. 732 1 2 3 733 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 734 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 735 | Next Payload |C| RESERVED | Payload Length | 736 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 738 Figure 2: Generic Payload Header 740 The Generic Payload Header fields are defined as follows: 742 o Next Payload (1 octet) - Identifier for the payload type of the 743 next payload in the message. If the current payload is the last 744 in the message, then this field will be 0. This field provides a 745 "chaining" capability whereby additional payloads can be added to 746 a message by appending each one to the end of the message and 747 setting the "Next Payload" field of the preceding payload to 748 indicate the new payload's type. An Encrypted payload, which must 749 always be the last payload of a message, is an exception. It 750 contains data structures in the format of additional payloads. In 751 the header of an Encrypted payload, the Next Payload field is set 752 to the payload type of the first contained payload (instead of 0); 753 conversely, the Next Payload field of the last contained payload 754 is set to zero). The payload type values needed for minimal 755 implementations are listed here. 757 Next Payload Type Notation Value 758 -------------------------------------------------- 759 No Next Payload 0 760 Security Association SA 33 761 Key Exchange KE 34 762 Identification - Initiator IDi 35 763 Identification - Responder IDr 36 764 Certificate CERT 37 765 Certificate Request CERTREQ 38 766 Authentication AUTH 39 767 Nonce Ni, Nr 40 768 Notify N 41 769 Delete D 42 770 Traffic Selector - Initiator TSi 44 771 Traffic Selector - Responder TSr 45 772 Encrypted and Authenticated SK 46 774 o Critical (1 bit) - MUST be set to zero if the sender wants the 775 recipient to skip this payload if it does not understand the 776 payload type code in the Next Payload field of the previous 777 payload. MUST be set to one if the sender wants the recipient to 778 reject this entire message if it does not understand the payload 779 type. MUST be ignored by the recipient if the recipient 780 understands the payload type code. MUST be set to zero for 781 payload types defined in this document. Note that the critical 782 bit applies to the current payload rather than the "next" payload 783 whose type code appears in the first octet. 785 o Payload Length (2 octets, unsigned integer) - Length in octets of 786 the current payload, including the generic payload header. 788 A.3. Security Association Payload 790 The Security Association payload, denoted SA in this document, is 791 used to negotiate attributes of a Security Association. 793 An SA payload consists of one or more proposals. Each proposal 794 includes one protocol. Each protocol contains one or more transforms 795 -- each specifying a cryptographic algorithm. Each transform 796 contains zero or more attributes (attributes are needed only if the 797 Transform ID does not completely specify the cryptographic algorithm, 798 currently only attribute is key length attribute for variable length 799 ciphers, meaning there is exactly zero or one attribute). 801 The responder MUST choose a single suite, which may be any subset of 802 the SA proposal following the rules below. 804 Each proposal contains one protocol. If a proposal is accepted, the 805 SA response MUST contain the same protocol. Each IPsec protocol 806 proposal contains one or more transforms. Each transform contains a 807 Transform Type. The accepted cryptographic suite MUST contain 808 exactly one transform of each type included in the proposal. For 809 example: if an ESP proposal includes transforms ENCR_3DES, ENCR_AES 810 w/keysize 128, ENCR_AES w/keysize 256, AUTH_HMAC_MD5, and 811 AUTH_HMAC_SHA, the accepted suite MUST contain one of the ENCR_ 812 transforms and one of the AUTH_ transforms. Thus, six combinations 813 are acceptable. 815 Minimal implementation can create very simple SA proposal, i.e. 816 include one proposal, which contains exactly one transform for each 817 transform type. It is important to only include one Diffie-Hellman 818 group in proposal, so there is no need to do INVALID_KE_PAYLOAD 819 processing in responses. 821 When parsing an SA, an implementation MUST check that the total 822 Payload Length is consistent with the payload's internal lengths and 823 counts. Proposals, Transforms, and Attributes each have their own 824 variable-length encodings. They are nested such that the Payload 825 Length of an SA includes the combined contents of the SA, Proposal, 826 Transform, and Attribute information. The length of a Proposal 827 includes the lengths of all Transforms and Attributes it contains. 828 The length of a Transform includes the lengths of all Attributes it 829 contains. 831 Each Proposal/Protocol structure is followed by one or more transform 832 structures. The number of different transforms is generally 833 determined by the Protocol. AH generally has two transforms: 834 Extended Sequence Numbers (ESNs) and an integrity check algorithm. 835 ESP generally has three: ESN, an encryption algorithm, and an 836 integrity check algorithm. IKEv2 generally has four transforms: a 837 Diffie-Hellman group, an integrity check algorithm, a PRF algorithm, 838 and an encryption algorithm. For each Protocol, the set of 839 permissible transforms is assigned Transform ID numbers, which appear 840 in the header of each transform. 842 If there are multiple transforms with the same Transform Type, the 843 proposal is an OR of those transforms. If there are multiple 844 transforms with different Transform Types, the proposal is an AND of 845 the different groups. 847 A given transform MAY have one or more Attributes. Attributes are 848 necessary when the transform can be used in more than one way, as 849 when an encryption algorithm has a variable key size. The transform 850 would specify the algorithm and the attribute would specify the key 851 size. To propose alternate values for an attribute (for example, 852 multiple key sizes for the AES encryption algorithm), an 853 implementation MUST include multiple transforms with the same 854 Transform Type each with a single Attribute. 856 1 2 3 857 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 858 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 859 | Next Payload |C| RESERVED | Payload Length | 860 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 861 | | 862 ~ ~ 863 | | 864 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 866 Figure 3: Security Association Payload 868 o Proposals (variable) - One or more proposal substructures. 870 A.3.1. Proposal Substructure 872 1 2 3 873 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 874 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 875 | 0 (last) or 2 | RESERVED | Proposal Length | 876 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 877 | Proposal Num | Protocol ID | SPI Size |Num Transforms| 878 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 879 ~ SPI (variable) ~ 880 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 881 | | 882 ~ ~ 883 | | 884 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 886 Figure 4: Proposal Substructure 888 o 0 (last) or 2 (more) (1 octet) - Specifies whether this is the 889 last Proposal Substructure in the SA. 891 o Proposal Length (2 octets, unsigned integer) - Length of this 892 proposal, including all transforms and attributes that follow. 894 o Proposal Num (1 octet) - When a proposal is made, the first 895 proposal in an SA payload MUST be 1, and subsequent proposals MUST 896 be one more than the previous proposal. When a proposal is 897 accepted, the proposal number in the SA payload MUST match the 898 number on the proposal sent that was accepted. 900 o Protocol ID (1 octet) - Specifies the IPsec protocol identifier 901 for the current negotiation. 903 Protocol Protocol ID 904 ----------------------------------- 905 IKE 1 906 AH 2 907 ESP 3 909 o SPI Size (1 octet) - For an initial IKE SA negotiation, this field 910 MUST be zero; the SPI is obtained from the outer header. During 911 subsequent negotiations, it is equal to the size, in octets, of 912 the SPI of the corresponding protocol (8 for IKE, 4 for ESP and 913 AH). 915 o Num Transforms (1 octet) - Specifies the number of transforms in 916 this proposal. 918 o SPI (variable) - The sending entity's SPI. When the SPI Size 919 field is zero, this field is not present in the Security 920 Association payload. 922 o Transforms (variable) - One or more transform substructures. 924 A.3.2. Transform Substructure 926 1 2 3 927 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 928 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 929 | 0 (last) or 3 | RESERVED | Transform Length | 930 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 931 |Transform Type | RESERVED | Transform ID | 932 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 933 | | 934 ~ Transform Attributes ~ 935 | | 936 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 938 Figure 5: Transform Substructure 940 o 0 (last) or 3 (more) (1 octet) - Specifies whether this is the 941 last Transform Substructure in the Proposal. 943 o Transform Length - The length (in octets) of the Transform 944 Substructure including Header and Attributes. 946 o Transform Type (1 octet) - The type of transform being specified 947 in this transform. Different protocols support different 948 Transform Types. For some protocols, some of the transforms may 949 be optional. If a transform is optional and the initiator wishes 950 to propose that the transform be omitted, no transform of the 951 given type is included in the proposal. If the initiator wishes 952 to make use of the transform optional to the responder, it 953 includes a transform substructure with Transform ID = 0 as one of 954 the options. 956 o Transform ID (2 octets) - The specific instance of the Transform 957 Type being proposed. 959 The relevant Transform Type values are listed below. 961 Description Trans. Used In 962 Type 963 ------------------------------------------------------------------ 964 Encryption Algorithm (ENCR) 1 IKE and ESP 965 Pseudorandom Function (PRF) 2 IKE 966 Integrity Algorithm (INTEG) 3 IKE, AH, optional in ESP 967 Diffie-Hellman group (D-H) 4 IKE, optional in AH & ESP 968 Extended Sequence Numbers (ESN) 5 AH and ESP 970 For Transform Type 1 (Encryption Algorithm), the relevant Transform 971 IDs are listed below. 973 Name Number Defined In 974 --------------------------------------------------- 975 ENCR_3DES 3 (RFC2451) 976 ENCR_AES_CBC 12 (RFC3602) 978 For Transform Type 2 (Pseudorandom Function), the relevant Transform 979 IDs are listed below. 981 Name Number Defined In 982 ------------------------------------------------------ 983 PRF_HMAC_MD5 1 (RFC2104), [MD5] 984 PRF_HMAC_SHA1 2 (RFC2104), [SHA] 986 For Transform Type 3 (Integrity Algorithm), relevant Transform IDs 987 are listed below. 989 Name Number Defined In 990 ---------------------------------------- 991 NONE 0 992 AUTH_HMAC_MD5_96 1 (RFC2403) 993 AUTH_HMAC_SHA1_96 2 (RFC2404) 994 AUTH_AES_XCBC_96 5 (RFC3566) 996 For Transform Type 4 (Diffie-Hellman group), relevant Transform IDs 997 are listed below. 999 Name Number Defined In 1000 ---------------------------------------- 1001 NONE 0 1002 768-bit MODP 1 Appendix B 1003 1024-bit MODP 2 Appendix B 1004 1536-bit MODP 5 [ADDGROUP] 1005 2048-bit MODP 14 [ADDGROUP] 1007 For Transform Type 5 (Extended Sequence Numbers), relevant Transform 1008 IDs are listed below. 1010 Name Number 1011 -------------------------------------------- 1012 No Extended Sequence Numbers 0 1013 Extended Sequence Numbers 1 1015 Note that an initiator who supports ESNs will usually include two ESN 1016 transforms, with values "0" and "1", in its proposals. A proposal 1017 containing a single ESN transform with value "1" means that using 1018 normal (non-extended) sequence numbers is not acceptable. 1020 A.3.3. Valid Transform Types by Protocol 1022 The number and type of transforms that accompany an SA payload are 1023 dependent on the protocol in the SA itself. An SA payload proposing 1024 the establishment of an SA has the following mandatory and optional 1025 Transform Types. A compliant implementation MUST understand all 1026 mandatory and optional types for each protocol it supports (though it 1027 need not accept proposals with unacceptable suites). A proposal MAY 1028 omit the optional types if the only value for them it will accept is 1029 NONE. 1031 Protocol Mandatory Types Optional Types 1032 --------------------------------------------------- 1033 IKE ENCR, PRF, INTEG, D-H 1034 ESP ENCR, ESN INTEG, D-H 1035 AH INTEG, ESN D-H 1037 A.3.4. Transform Attributes 1039 Transform type 1 (Encryption Algorithm) transforms might include one 1040 transform attribute: Key Length. 1042 1 2 3 1043 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 1044 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1045 |1| Attribute Type | Attribute Value | 1046 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1047 Figure 6: Data Attributes 1049 o Attribute Type (15 bits) - Unique identifier for each type of 1050 attribute (see below). 1052 o Attribute Value - Value of the attribute associated with the 1053 attribute type. 1055 Attribute Type Value 1056 ---------------------------- 1057 Key Length (in bits) 14 1059 The Key Length attribute specifies the key length in bits (MUST use 1060 network byte order) for certain transforms as follows: 1062 o The Key Length attribute MUST NOT be used with transforms that use 1063 a fixed-length key. 1065 o Some transforms specify that the Key Length attribute MUST be 1066 always included. For example ENCR_AES_CBC. 1068 A.4. Key Exchange Payload 1070 1 2 3 1071 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 1072 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1073 | Next Payload |C| RESERVED | Payload Length | 1074 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1075 | Diffie-Hellman Group Num | RESERVED | 1076 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1077 | | 1078 ~ Key Exchange Data ~ 1079 | | 1080 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1082 Figure 7: Key Exchange Payload Format 1084 A Key Exchange payload is constructed by copying one's Diffie-Hellman 1085 public value into the "Key Exchange Data" portion of the payload. 1086 The length of the Diffie-Hellman public value for modular 1087 exponentiation group (MODP) groups MUST be equal to the length of the 1088 prime modulus over which the exponentiation was performed, prepending 1089 zero bits to the value if necessary. 1091 The Diffie-Hellman Group Num identifies the Diffie-Hellman group in 1092 which the Key Exchange Data was computed. This Diffie-Hellman Group 1093 Num MUST match a Diffie-Hellman group specified in a proposal in the 1094 SA payload that is sent in the same message 1096 A.5. Identification Payloads 1098 The Identification payloads, denoted IDi and IDr in this document, 1099 allow peers to assert an identity to one another. When using the 1100 ID_IPV4_ADDR/ID_IPV6_ADDR identity types in IDi/IDr payloads, IKEv2 1101 does not require this address to match the address in the IP header 1102 of IKEv2 packets, or anything in the TSi/TSr payloads. The contents 1103 of IDi/IDr are used purely to fetch the policy and authentication 1104 data related to the other party. In minimal implementation it might 1105 be easiest to always use KEY_ID type. This allows the ID payload to 1106 be static. Using IP address has problems in environments where IP 1107 addresses are dynamically allocated. 1109 1 2 3 1110 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 1111 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1112 | Next Payload |C| RESERVED | Payload Length | 1113 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1114 | ID Type | RESERVED | 1115 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1116 | | 1117 ~ Identification Data ~ 1118 | | 1119 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1121 Figure 8: Identification Payload Format 1123 o ID Type (1 octet) - Specifies the type of Identification being 1124 used. 1126 o Identification Data (variable length) - Value, as indicated by the 1127 Identification Type. The length of the Identification Data is 1128 computed from the size in the ID payload header. 1130 The following table lists the assigned semantics for the 1131 Identification Type field. 1133 ID Type Value 1134 ------------------------------------------------------------------- 1135 ID_IPV4_ADDR 1 1136 A single four (4) octet IPv4 address. 1138 ID_FQDN 2 1139 A fully-qualified domain name string. An example of an ID_FQDN 1140 is "example.com". The string MUST NOT contain any terminators 1141 (e.g., NULL, CR, etc.). All characters in the ID_FQDN are ASCII; 1142 for an "internationalized domain name", the syntax is as defined 1143 in [IDNA], for example "xn--tmonesimerkki-bfbb.example.net". 1145 ID_RFC822_ADDR 3 1146 A fully-qualified RFC 822 email address string. An example of a 1147 ID_RFC822_ADDR is "jsmith@example.com". The string MUST NOT 1148 contain any terminators. Because of [EAI], implementations would 1149 be wise to treat this field as UTF-8 encoded text, not as 1150 pure ASCII. 1152 ID_IPV6_ADDR 5 1153 A single sixteen (16) octet IPv6 address. 1155 ID_KEY_ID 11 1156 An opaque octet stream that may be used to pass vendor- 1157 specific information necessary to do certain proprietary 1158 types of identification. Minimal implementation might use 1159 this type to send out serial number or similar device 1160 specific unique static identification data for the device. 1162 A.6. Certificate Payload 1164 1 2 3 1165 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 1166 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1167 | Next Payload |C| RESERVED | Payload Length | 1168 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1169 | Cert Encoding | | 1170 +-+-+-+-+-+-+-+-+ | 1171 ~ Certificate Data ~ 1172 | | 1173 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1175 Figure 9: Certificate Payload Format 1177 o Certificate Encoding (1 octet) - This field indicates the type of 1178 certificate or certificate-related information contained in the 1179 Certificate Data field. 1181 Certificate Encoding Value 1182 ---------------------------------------------------- 1183 X.509 Certificate - Signature 4 1184 Raw Public Key TBD 1186 o Certificate Data (variable length) - Actual encoding of 1187 certificate data. The type of certificate is indicated by the 1188 Certificate Encoding field. 1190 The syntax of the types above are: 1192 o "X.509 Certificate - Signature" contains a DER-encoded X.509 1193 certificate whose public key is used to validate the sender's AUTH 1194 payload. Note that with this encoding, if a chain of certificates 1195 needs to be sent, multiple CERT payloads are used, only the first 1196 of which holds the public key used to validate the sender's AUTH 1197 payload. 1199 o "Raw Public Key" contains a raw public key. In essence the 1200 Certificate Payload contains the SubjectPublicKeyInfo part of the 1201 PKIX certificate (See Section 4.1.2.7 of [RFC5280]). This is 1202 quite simple ASN.1 object which contains mostly static parts 1203 before the actual public key values. See 1204 [I-D.ietf-ipsecme-oob-pubkey] for more information. 1206 A.7. Certificate Request Payload 1208 1 2 3 1209 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 1210 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1211 | Next Payload |C| RESERVED | Payload Length | 1212 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1213 | Cert Encoding | | 1214 +-+-+-+-+-+-+-+-+ | 1215 ~ Certification Authority ~ 1216 | | 1217 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1219 Figure 10: Certificate Request Payload Format 1221 o Certificate Encoding (1 octet) - Contains an encoding of the type 1222 or format of certificate requested. 1224 o Certification Authority (variable length) - Contains an encoding 1225 of an acceptable certification authority for the type of 1226 certificate requested. 1228 The Certificate Encoding field has the same values as those defined 1229 certificate payload. The Certification Authority field contains an 1230 indicator of trusted authorities for this certificate type. The 1231 Certification Authority value is a concatenated list of SHA-1 hashes 1232 of the public keys of trusted Certification Authorities (CAs). Each 1233 is encoded as the SHA-1 hash of the Subject Public Key Info element 1234 (see Section 4.1.2.7 of [RFC5280]) from each Trust Anchor 1235 certificate. The 20-octet hashes are concatenated and included with 1236 no other formatting. 1238 A.8. Authentication Payload 1240 1 2 3 1241 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 1242 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1243 | Next Payload |C| RESERVED | Payload Length | 1244 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1245 | Auth Method | RESERVED | 1246 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1247 | | 1248 ~ Authentication Data ~ 1249 | | 1250 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1252 Figure 11: Authentication Payload Format 1254 o Auth Method (1 octet) - Specifies the method of authentication 1255 used. 1257 Mechanism Value 1258 ----------------------------------------------------------------- 1259 RSA Digital Signature 1 1260 Using an RSA private key with RSASSA-PKCS1-v1_5 signature 1261 scheme specified in [PKCS1], see [RFC5996] Section 2.15 for 1262 details. 1264 Shared Key Message Integrity Code 2 1265 Computed as specified earlier using the shared key associated 1266 with the identity in the ID payload and the negotiated PRF. 1268 DSS Digital Signature 3 1269 Using a DSS private key (see [DSS]) over a SHA-1 hash, see 1270 [RFC5996] Section 2.15 for details. 1272 o Authentication Data (variable length) - see Section 2.1. 1274 A.9. Nonce Payload 1276 1 2 3 1277 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 1278 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1279 | Next Payload |C| RESERVED | Payload Length | 1280 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1281 | | 1282 ~ Nonce Data ~ 1283 | | 1284 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1286 Figure 12: Nonce Payload Format 1288 o Nonce Data (variable length) - Contains the random data generated 1289 by the transmitting entity. 1291 The size of the Nonce Data MUST be between 16 and 256 octets, 1292 inclusive. Nonce values MUST NOT be reused. 1294 A.10. Notify Payload 1296 The Notify payload, denoted N in this document, is used to transmit 1297 informational data, such as error conditions and state transitions, 1298 to an IKE peer. A Notify payload may appear in a response message 1299 (usually specifying why a request was rejected), in an INFORMATIONAL 1300 Exchange (to report an error not in an IKE request), or in any other 1301 message to indicate sender capabilities or to modify the meaning of 1302 the request. 1304 1 2 3 1305 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 1306 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1307 | Next Payload |C| RESERVED | Payload Length | 1308 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1309 | Protocol ID | SPI Size | Notify Message Type | 1310 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1311 | | 1312 ~ Security Parameter Index (SPI) ~ 1313 | | 1314 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1315 | | 1316 ~ Notification Data ~ 1317 | | 1318 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1320 Figure 13: Notify Payload Format 1322 o Protocol ID (1 octet) - If this notification concerns an existing 1323 SA whose SPI is given in the SPI field, this field indicates the 1324 type of that SA. If the SPI field is empty, this field MUST be 1325 sent as zero and MUST be ignored on receipt. 1327 o SPI Size (1 octet) - Length in octets of the SPI as defined by the 1328 IPsec protocol ID or zero if no SPI is applicable. For a 1329 notification concerning the IKE SA, the SPI Size MUST be zero and 1330 the field must be empty. 1332 o Notify Message Type (2 octets) - Specifies the type of 1333 notification message. 1335 o SPI (variable length) - Security Parameter Index. 1337 o Notification Data (variable length) - Status or error data 1338 transmitted in addition to the Notify Message Type. Values for 1339 this field are type specific. 1341 A.10.1. Notify Message Types 1343 Notification information can be error messages specifying why an SA 1344 could not be established. It can also be status data that a process 1345 managing an SA database wishes to communicate with a peer process. 1347 Types in the range 0 - 16383 are intended for reporting errors. An 1348 implementation receiving a Notify payload with one of these types 1349 that it does not recognize in a response MUST assume that the 1350 corresponding request has failed entirely. Unrecognized error types 1351 in a request and status types in a request or response MUST be 1352 ignored, and they should be logged. 1354 Notify payloads with status types MAY be added to any message and 1355 MUST be ignored if not recognized. They are intended to indicate 1356 capabilities, and as part of SA negotiation, are used to negotiate 1357 non-cryptographic parameters. 1359 NOTIFY messages: error types Value 1360 ------------------------------------------------------------------- 1361 UNSUPPORTED_CRITICAL_PAYLOAD 1 1362 Indicates that the one-octet payload type included in the 1363 Notification Data field is unknown. 1365 INVALID_SYNTAX 7 1366 Indicates the IKE message that was received was invalid because 1367 some type, length, or value was out of range or because the 1368 request was rejected for policy reasons. To avoid a DoS 1369 attack using forged messages, this status may only be 1370 returned for and in an encrypted packet if the Message ID and 1371 cryptographic checksum were valid. To avoid leaking information 1372 to someone probing a node, this status MUST be sent in response 1373 to any error not covered by one of the other status types. 1374 To aid debugging, more detailed error information should be 1375 written to a console or log. 1377 NO_PROPOSAL_CHOSEN 14 1378 None of the proposed crypto suites was acceptable. This can be 1379 sent in any case where the offered proposals are not acceptable 1380 for the responder. 1382 NO_ADDITIONAL_SAS 35 1383 Specifies that the node is unwilling to accept any more Child 1384 SAs. 1386 NOTIFY messages: status types Value 1387 ------------------------------------------------------------------- 1388 INITIAL_CONTACT 16384 1389 Asserts that this IKE SA is the only IKE SA currently active 1390 between the authenticated identities. 1392 A.11. Traffic Selector Payload 1394 Traffic Selector (TS) payloads allow endpoints to communicate some of 1395 the information from their SPD to their peers. TS payloads specify 1396 the selection criteria for packets that will be forwarded over the 1397 newly set up SA. 1399 1 2 3 1400 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 1401 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1402 | Next Payload |C| RESERVED | Payload Length | 1403 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1404 | Number of TSs | RESERVED | 1405 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1406 | | 1407 ~ ~ 1408 | | 1409 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1411 Figure 14: Traffic Selectors Payload Format 1413 o Number of TSs (1 octet) - Number of Traffic Selectors being 1414 provided. 1416 o Traffic Selectors (variable length) - One or more individual 1417 Traffic Selectors. 1419 The length of the Traffic Selector payload includes the TS header and 1420 all the Traffic Selectors. 1422 There is no requirement that TSi and TSr contain the same number of 1423 individual Traffic Selectors. Thus, they are interpreted as follows: 1424 a packet matches a given TSi/TSr if it matches at least one of the 1425 individual selectors in TSi, and at least one of the individual 1426 selectors in TSr. 1428 Two TS payloads appear in each of the messages in the exchange that 1429 creates a Child SA pair. Each TS payload contains one or more 1430 Traffic Selectors. Each Traffic Selector consists of an address 1431 range (IPv4 or IPv6), a port range, and an IP protocol ID. 1433 The first of the two TS payloads is known as TSi (Traffic Selector- 1434 initiator). The second is known as TSr (Traffic Selector-responder). 1435 TSi specifies the source address of traffic forwarded from (or the 1436 destination address of traffic forwarded to) the initiator of the 1437 Child SA pair. TSr specifies the destination address of the traffic 1438 forwarded to (or the source address of the traffic forwarded from) 1439 the responder of the Child SA pair. 1441 IKEv2 allows the responder to choose a subset of the traffic proposed 1442 by the initiator. 1444 When the responder chooses a subset of the traffic proposed by the 1445 initiator, it narrows the Traffic Selectors to some subset of the 1446 initiator's proposal (provided the set does not become the null set). 1448 If the type of Traffic Selector proposed is unknown, the responder 1449 ignores that Traffic Selector, so that the unknown type is not 1450 returned in the narrowed set. 1452 To enable the responder to choose the appropriate range, if the 1453 initiator has requested the SA due to a data packet, the initiator 1454 SHOULD include as the first Traffic Selector in each of TSi and TSr a 1455 very specific Traffic Selector including the addresses in the packet 1456 triggering the request. If the initiator creates the Child SA pair 1457 not in response to an arriving packet, but rather, say, upon startup, 1458 then there may be no specific addresses the initiator prefers for the 1459 initial tunnel over any other. In that case, the first values in TSi 1460 and TSr can be ranges rather than specific values. 1462 As minimal implementations might only support one SA, the traffic 1463 selectors will usually be from initiator's IP address to responders 1464 IP address (i.e. no port or protocol selectors and only one range). 1466 A.11.1. Traffic Selector 1468 1 2 3 1469 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 1470 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1471 | TS Type |IP Protocol ID | Selector Length | 1472 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1473 | Start Port | End Port | 1474 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1475 | | 1476 ~ Starting Address ~ 1477 | | 1478 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1479 | | 1480 ~ Ending Address ~ 1481 | | 1482 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1484 Figure 15: Traffic Selector 1486 o TS Type (one octet) - Specifies the type of Traffic Selector. 1488 o IP protocol ID (1 octet) - Value specifying an associated IP 1489 protocol ID (such as UDP, TCP, and ICMP). A value of zero means 1490 that the protocol ID is not relevant to this Traffic Selector -- 1491 the SA can carry all protocols. 1493 o Selector Length - Specifies the length of this Traffic Selector 1494 substructure including the header. 1496 o Start Port (2 octets, unsigned integer) - Value specifying the 1497 smallest port number allowed by this Traffic Selector. For 1498 protocols for which port is undefined (including protocol 0), or 1499 if all ports are allowed, this field MUST be zero. 1501 o End Port (2 octets, unsigned integer) - Value specifying the 1502 largest port number allowed by this Traffic Selector. For 1503 protocols for which port is undefined (including protocol 0), or 1504 if all ports are allowed, this field MUST be 65535. 1506 o Starting Address - The smallest address included in this Traffic 1507 Selector (length determined by TS Type). 1509 o Ending Address - The largest address included in this Traffic 1510 Selector (length determined by TS Type). 1512 The following table lists values for the Traffic Selector Type field 1513 and the corresponding Address Selector Data. 1515 TS Type Value 1516 ------------------------------------------------------------------- 1517 TS_IPV4_ADDR_RANGE 7 1519 A range of IPv4 addresses, represented by two four-octet 1520 values. The first value is the beginning IPv4 address 1521 (inclusive) and the second value is the ending IPv4 address 1522 (inclusive). All addresses falling between the two specified 1523 addresses are considered to be within the list. 1525 TS_IPV6_ADDR_RANGE 8 1527 A range of IPv6 addresses, represented by two sixteen-octet 1528 values. The first value is the beginning IPv6 address 1529 (inclusive) and the second value is the ending IPv6 address 1530 (inclusive). All addresses falling between the two specified 1531 addresses are considered to be within the list. 1533 A.12. Encrypted Payload 1535 The Encrypted payload, denoted SK{...} in this document, contains 1536 other payloads in encrypted form. 1538 1 2 3 1539 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 1540 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1541 | Next Payload |C| RESERVED | Payload Length | 1542 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1543 | Initialization Vector | 1544 | (length is block size for encryption algorithm) | 1545 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1546 ~ Encrypted IKE Payloads ~ 1547 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1548 | | Padding (0-255 octets) | 1549 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ 1550 | | Pad Length | 1551 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1552 ~ Integrity Checksum Data ~ 1553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1555 Figure 16: Encrypted Payload Format 1557 o Next Payload - The payload type of the first embedded payload. 1558 Note that this is an exception in the standard header format, 1559 since the Encrypted payload is the last payload in the message and 1560 therefore the Next Payload field would normally be zero. But 1561 because the content of this payload is embedded payloads and there 1562 was no natural place to put the type of the first one, that type 1563 is placed here. 1565 o Payload Length - Includes the lengths of the header, 1566 initialization vector (IV), Encrypted IKE payloads, Padding, Pad 1567 Length, and Integrity Checksum Data. 1569 o Initialization Vector - For CBC mode ciphers, the length of the 1570 initialization vector (IV) is equal to the block length of the 1571 underlying encryption algorithm. Senders MUST select a new 1572 unpredictable IV for every message; recipients MUST accept any 1573 value. The reader is encouraged to consult [MODES] for advice on 1574 IV generation. In particular, using the final ciphertext block of 1575 the previous message is not considered unpredictable. For modes 1576 other than CBC, the IV format and processing is specified in the 1577 document specifying the encryption algorithm and mode. 1579 o IKE payloads are as specified earlier in this section. This field 1580 is encrypted with the negotiated cipher. 1582 o Padding MAY contain any value chosen by the sender, and MUST have 1583 a length that makes the combination of the payloads, the Padding, 1584 and the Pad Length to be a multiple of the encryption block size. 1585 This field is encrypted with the negotiated cipher. 1587 o Pad Length is the length of the Padding field. The sender SHOULD 1588 set the Pad Length to the minimum value that makes the combination 1589 of the payloads, the Padding, and the Pad Length a multiple of the 1590 block size, but the recipient MUST accept any length that results 1591 in proper alignment. This field is encrypted with the negotiated 1592 cipher. 1594 o Integrity Checksum Data is the cryptographic checksum of the 1595 entire message starting with the Fixed IKE header through the Pad 1596 Length. The checksum MUST be computed over the encrypted message. 1597 Its length is determined by the integrity algorithm negotiated. 1599 Appendix B. Useful Optional Features 1601 There are some optional features of IKEv2, which might be useful for 1602 minimal implementations in some scenarios. Such features include Raw 1603 public keys authentication, and sending IKE SA delete notification. 1605 B.1. IKE SA Delete Notification 1607 In some scenarios the minimal implementation device creates IKE SA, 1608 sends one or few packets, perhaps gets some packets back, and then 1609 device goes back to sleep forgetting the IKE SA. In such scenarios 1610 it would be nice for the minimal implementation to send the IKE SA 1611 delete notification to tell the other end that the IKE SA is going 1612 away, so it can free the resources. 1614 Deleting the IKE SA can be done using by sending one packet with 1615 fixed Message ID, and with only one payload inside the encrypted 1616 payload. The other end will send back an empty response: 1618 Initiator Responder 1619 ------------------------------------------------------------------- 1620 HDR(SPIi=xxx, SPIr=yyy, INFORMATIONAL, 1621 Flags: Initiator, Message ID=2), 1622 SK {D} --> 1624 <-- HDR(SPIi=xxx, SPIr=yyy, INFORMATIONAL, 1625 Flags: Response, Message ID=2), 1626 SK {} 1628 The delete payload format is: 1630 1 2 3 1631 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 1632 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1633 | Next Payload |C| RESERVED | Payload Length | 1634 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1635 | Protocol ID | SPI Size | Num of SPIs | 1636 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1637 | | 1638 ~ Security Parameter Index(es) (SPI) ~ 1639 | | 1640 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1642 Figure 17: Delete Payload Format 1644 o Protocol ID (1 octet) - Must be 1 for an IKE SA. 1646 o SPI Size (1 octet) - Length in octets of the SPI as defined by the 1647 protocol ID. It MUST be zero for IKE (SPI is in message header). 1649 o Num of SPIs (2 octets, unsigned integer) - The number of SPIs 1650 contained in the Delete payload. This MUST be zero for IKE. 1652 o Security Parameter Index(es) (variable length) - Identifies the 1653 specific Security Association(s) to delete. The length of this 1654 field is determined by the SPI Size and Num of SPIs fields. This 1655 field is empty for the IKE SA delete. 1657 B.2. Raw Public Keys 1659 In some scenarios the shared secret authentication is not safe 1660 enough, as anybody who knows the secret can impersonate himself of 1661 being the server. If the shared secret is printed on the side of the 1662 device, then anybody who gets physical access to the device can read 1663 it. In such environments public key authentication allows stronger 1664 authentication with minimal operational overhead. Certificate 1665 support is quite complex, and minimal implementations do not usually 1666 have need for them. Using Raw Public Keys is much simpler, and it 1667 allows similar scalability than certificates. The fingerprint of the 1668 Raw Public Key can still be distributed by for example printing it on 1669 the side of the device allowing similar setup than using shared 1670 secret. 1672 Raw Public Keys can also be used in leap of faith or baby duck style 1673 initial setup, where the device imprints itself to the first device 1674 it sees when it first time boots up. After that initial connection 1675 it stores the fingerprint of the Raw Public Key of the server to its 1676 own configuration and verifies that it never changes (unless reset to 1677 factory setting or similar command is issued). 1679 This changes the initial IKE_AUTH payloads as follows: 1681 Initiator Responder 1682 ------------------------------------------------------------------- 1683 HDR(SPIi=xxx, SPIr=yyy, IKE_AUTH, 1684 Flags: Initiator, Message ID=1), 1685 SK {IDi, CERT, AUTH, SAi2, TSi, TSr, 1686 N(INITIAL_CONTACT)} --> 1688 <-- HDR(SPIi=xxx, SPIr=yyy, IKE_AUTH, Flags: 1689 Response, Message ID=1), 1690 SK {IDr, CERT, AUTH, SAr2, TSi, TSr} 1692 The CERT payloads contains the Raw Public Keys used the sign the hash 1693 of the InitiatorSignedOctects/ResponderSignedOctects when generating 1694 AUTH payload. Minimal implementations should use SHA-1 as the hash 1695 function as that is the SHOULD support algorithm specified in the 1696 RFC5996, so it is the most likely one that is supported by all 1697 devices. 1699 Note, that the More Raw Public Keys for IKEv2 1700 ([I-D.ietf-ipsecme-oob-pubkey]) document obsoletes the old Raw RSA 1701 Key methods, and adds new format to allow any types of Raw Public 1702 Keys to IKEv2. This document only specifies how to use the new 1703 format. 1705 Author's Address 1707 Tero Kivinen 1708 INSIDE Secure 1709 Eerikinkatu 28 1710 HELSINKI FI-00180 1711 FI 1713 Email: kivinen@iki.fi