File: rfc8031.html

package info (click to toggle)
doc-rfc 20230121-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 1,609,944 kB
file content (445 lines) | stat: -rw-r--r-- 19,921 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<pre>Internet Engineering Task Force (IETF)                            Y. Nir
Request for Comments: 8031                                   Check Point
Category: Standards Track                                   S. Josefsson
ISSN: 2070-1721                                                      SJD
                                                           December 2016


                    <span class="h1">Curve25519 and Curve448 for the</span>
     <span class="h1">Internet Key Exchange Protocol Version 2 (IKEv2) Key Agreement</span>

Abstract

   This document describes the use of Curve25519 and Curve448 for
   ephemeral key exchange in the Internet Key Exchange Protocol Version
   2 (IKEv2).

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in <a href="./rfc7841#section-2">Section&nbsp;2 of RFC 7841</a>.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   <a href="http://www.rfc-editor.org/info/rfc8031">http://www.rfc-editor.org/info/rfc8031</a>.

Copyright Notice

   Copyright (c) 2016 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.







<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


Table of Contents

   <a href="#section-1">1</a>.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   <a href="#page-2">2</a>
     <a href="#section-1.1">1.1</a>.  Conventions Used in This Document . . . . . . . . . . . .   <a href="#page-2">2</a>
   <a href="#section-2">2</a>.  Curve25519 and Curve448 . . . . . . . . . . . . . . . . . . .   <a href="#page-3">3</a>
   <a href="#section-3">3</a>.  Use and Negotiation in IKEv2  . . . . . . . . . . . . . . . .   <a href="#page-3">3</a>
     <a href="#section-3.1">3.1</a>.  Key Exchange Payload  . . . . . . . . . . . . . . . . . .   <a href="#page-4">4</a>
     <a href="#section-3.2">3.2</a>.  Recipient Tests . . . . . . . . . . . . . . . . . . . . .   <a href="#page-4">4</a>
   <a href="#section-4">4</a>.  Security Considerations . . . . . . . . . . . . . . . . . . .   <a href="#page-4">4</a>
   <a href="#section-5">5</a>.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   <a href="#page-5">5</a>
   <a href="#section-6">6</a>.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   <a href="#page-5">5</a>
     <a href="#section-6.1">6.1</a>.  Normative References  . . . . . . . . . . . . . . . . . .   <a href="#page-5">5</a>
     <a href="#section-6.2">6.2</a>.  Informative References  . . . . . . . . . . . . . . . . .   <a href="#page-6">6</a>
   <a href="#appendix-A">Appendix A</a>.  Numerical Example for Curve25519 . . . . . . . . . .   <a href="#page-7">7</a>
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .   <a href="#page-8">8</a>
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   <a href="#page-8">8</a>

<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>.  Introduction</span>

   The "Elliptic Curves for Security" document [<a href="./rfc7748" title="&quot;Elliptic Curves for Security&quot;">RFC7748</a>] describes two
   elliptic curves, Curve25519 and Curve448, as well as the X25519 and
   X448 functions for performing key agreement using Diffie-Hellman
   operations with these curves.  The curves and functions are designed
   for both performance and security.

   Elliptic curve Diffie-Hellman [<a href="./rfc5903" title="&quot;Elliptic Curve Groups modulo a Prime (ECP Groups) for IKE and IKEv2&quot;">RFC5903</a>] has been specified for the
   Internet Key Exchange Protocol Version 2 (IKEv2) [<a href="./rfc7296" title="&quot;Internet Key Exchange Protocol Version 2 (IKEv2)&quot;">RFC7296</a>] for almost
   ten years.  <a href="./rfc5903">RFC 5903</a> and its predecessor specified the so-called NIST
   curves.  The state of the art has advanced since then.  More modern
   curves allow faster implementations while making it much easier to
   write constant-time implementations that are resilient to time-based
   side-channel attacks.  This document defines two such curves for use
   in IKEv2.  See [<a href="#ref-Curve25519">Curve25519</a>] for details about the speed and security
   of the Curve25519 function.

<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>.  Conventions Used in This Document</span>

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [<a href="./rfc2119" title="&quot;Key words for use in RFCs to Indicate Requirement Levels&quot;">RFC2119</a>].











<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>.  Curve25519 and Curve448</span>

   Implementations of Curve25519 and Curve448 in IKEv2 SHALL follow the
   steps described in this section.  All cryptographic computations are
   done using the X25519 and X448 functions defined in [<a href="./rfc7748" title="&quot;Elliptic Curves for Security&quot;">RFC7748</a>].  All
   related parameters (for example, the base point) and the encoding (in
   particular, pruning the least/most significant bits and using little-
   endian encoding) are compliant with [<a href="./rfc7748" title="&quot;Elliptic Curves for Security&quot;">RFC7748</a>].

   An ephemeral Diffie-Hellman key exchange using Curve25519 or Curve448
   is performed as follows: each party picks a secret key d uniformly at
   random and computes the corresponding public key.  "X" is used below
   to denote either X25519 or X448, and "G" is used to denote the
   corresponding base point:

      pub_mine = X(d, G)

   Parties exchange their public keys (see <a href="#section-3.1">Section 3.1</a>) and compute a
   shared secret:

         SHARED_SECRET = X(d, pub_peer)

   This shared secret is used directly as the value denoted g^ir in
   <a href="./rfc7296#section-2.14">Section&nbsp;2.14 of RFC 7296</a>.  It is 32 octets when Curve25519 is used
   and 56 octets when Curve448 is used.

<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>.  Use and Negotiation in IKEv2</span>

   The use of Curve25519 and Curve448 in IKEv2 is negotiated using a
   Transform Type 4 (Diffie-Hellman group) in the Security Association
   (SA) payload of either an IKE_SA_INIT or a CREATE_CHILD_SA exchange.
   The value 31 is used for the group defined by Curve25519 and the
   value 32 is used for the group defined by Curve448.


















<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>.  Key Exchange Payload</span>

   The diagram for the Key Exchange payload from <a href="./rfc7296#section-3.4">Section&nbsp;3.4 of RFC 7296</a>
   is copied below for convenience:

                           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        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   Diffie-Hellman Group Num    |           RESERVED            |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                                                               |
      ~                       Key Exchange Data                       ~
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   o  Payload Length - For Curve25519, the public key is 32 octets, so
      the Payload Length field will be 40.  For Curve448, the public key
      is 56 octets, so the Payload Length field will be 64.

   o  The Diffie-Hellman Group Num is 31 for Curve25519 or 32 for
      Curve448.

   o  The Key Exchange Data is the 32 or 56 octets as described in
      <a href="./rfc7748#section-6">Section&nbsp;6 of [RFC7748]</a>.

<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>.  Recipient Tests</span>

   Receiving and handling of incompatible point formats MUST follow the
   considerations described in <a href="./rfc7748#section-5">Section&nbsp;5 of [RFC7748]</a>.  In particular,
   receiving entities MUST mask the most-significant bit in the final
   byte for X25519 (but not X448), and implementations MUST accept non-
   canonical values.

<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>.  Security Considerations</span>

   Curve25519 and Curve448 are designed to facilitate the production of
   high-performance constant-time implementations.  Implementors are
   encouraged to use a constant-time implementation of the functions.
   This point is of crucial importance, especially if the implementation
   chooses to reuse its ephemeral key pair in many key exchanges for
   performance reasons.

   Curve25519 is intended for the ~128-bit security level, comparable to
   the 256-bit random ECP Groups (group 19) defined in <a href="./rfc5903">RFC 5903</a>, also
   known as NIST P-256 or secp256r1.  Curve448 is intended for the
   ~224-bit security level.



<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


   While the NIST curves are advertised as being chosen verifiably at
   random, there is no explanation for the seeds used to generate them.
   In contrast, the process used to pick Curve25519 and Curve448 is
   fully documented and rigid enough so that independent verification
   can and has been done.  This is widely seen as a security advantage
   because it prevents the generating party from maliciously
   manipulating the parameters.

   Another family of curves available in IKE that were generated in a
   fully verifiable way is the Brainpool curves [<a href="./rfc6954" title="&quot;Using the Elliptic Curve Cryptography (ECC) Brainpool Curves for the Internet Key Exchange Protocol Version 2 (IKEv2)&quot;">RFC6954</a>].  For example,
   brainpoolP256 (group 28) is expected to provide a level of security
   comparable to Curve25519 and NIST P-256.  However, due to the use of
   pseudorandom prime, it is significantly slower than NIST P-256, which
   is itself slower than Curve25519.

<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>.  IANA Considerations</span>

   IANA has assigned two values for the names "Curve25519" and
   "Curve448" in the IKEv2 "Transform Type 4 - Diffie-Hellman Group
   Transform IDs" and has listed this document as the reference.  The
   Recipient Tests field should also point to this document:

        +--------+------------+-----------------------+-----------+
        | Number |    Name    |    Recipient Tests    | Reference |
        +--------+------------+-----------------------+-----------+
        |   31   | Curve25519 | <a href="./rfc8031#section-3.2">RFC 8031, Section&nbsp;3.2</a> |  <a href="./rfc8031">RFC 8031</a> |
        |   32   |  Curve448  | <a href="./rfc8031#section-3.2">RFC 8031, Section&nbsp;3.2</a> |  <a href="./rfc8031">RFC 8031</a> |
        +--------+------------+-----------------------+-----------+

                   Table 1: New Transform Type 4 Values

<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>.  References</span>

<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>.  Normative References</span>

   [<a id="ref-RFC2119">RFC2119</a>]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
              DOI 10.17487/RFC2119, March 1997,
              &lt;<a href="http://www.rfc-editor.org/info/rfc2119">http://www.rfc-editor.org/info/rfc2119</a>&gt;.

   [<a id="ref-RFC7296">RFC7296</a>]  Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T.
              Kivinen, "Internet Key Exchange Protocol Version 2
              (IKEv2)", STD 79, <a href="./rfc7296">RFC 7296</a>, DOI 10.17487/RFC7296, October
              2014, &lt;<a href="http://www.rfc-editor.org/info/rfc7296">http://www.rfc-editor.org/info/rfc7296</a>&gt;.

   [<a id="ref-RFC7748">RFC7748</a>]  Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves
              for Security", <a href="./rfc7748">RFC 7748</a>, DOI 10.17487/RFC7748, January
              2016, &lt;<a href="http://www.rfc-editor.org/info/rfc7748">http://www.rfc-editor.org/info/rfc7748</a>&gt;.



<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>.  Informative References</span>

   [<a id="ref-Curve25519">Curve25519</a>]
              Bernstein, J., "Curve25519: New Diffie-Hellman Speed
              Records", Public Key Cryptography - PKC 2006, Lecture
              Notes in Computer Science (LNCS), Vol. 3958, pp. 207-228,
              DOI 10.1007/11745853_14, February 2006,
              &lt;<a href="http://dx.doi.org/10.1007/11745853_14">http://dx.doi.org/10.1007/11745853_14</a>&gt;.

   [<a id="ref-RFC5903">RFC5903</a>]  Fu, D. and J. Solinas, "Elliptic Curve Groups modulo a
              Prime (ECP Groups) for IKE and IKEv2", <a href="./rfc5903">RFC 5903</a>,
              DOI 10.17487/RFC5903, June 2010,
              &lt;<a href="http://www.rfc-editor.org/info/rfc5903">http://www.rfc-editor.org/info/rfc5903</a>&gt;.

   [<a id="ref-RFC6954">RFC6954</a>]  Merkle, J. and M. Lochter, "Using the Elliptic Curve
              Cryptography (ECC) Brainpool Curves for the Internet Key
              Exchange Protocol Version 2 (IKEv2)", <a href="./rfc6954">RFC 6954</a>,
              DOI 10.17487/RFC6954, July 2013,
              &lt;<a href="http://www.rfc-editor.org/info/rfc6954">http://www.rfc-editor.org/info/rfc6954</a>&gt;.
































<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>.  Numerical Example for Curve25519</span>

   Suppose we have both the initiator and the responder generating
   private keys by generating 32 random octets.  As usual in IKEv2 and
   its extension, we will denote Initiator values with the suffix _i and
   responder values with the suffix _r:

     random_i = 75 1f b4 30 86 55 b4 76 b6 78 9b 73 25 f9 ea 8c
                dd d1 6a 58 53 3f f6 d9 e6 00 09 46 4a 5f 9d 94

     random_r = 0a 54 64 52 53 29 0d 60 dd ad d0 e0 30 ba cd 9e
                55 01 ef dc 22 07 55 a1 e9 78 f1 b8 39 a0 56 88

   These numbers need to be fixed by unsetting some bits as described in
   <a href="./rfc7748#section-5">Section&nbsp;5 of RFC 7748</a>.  This affects only the first and last octets
   of each value:

     fixed_i =  70 1f b4 30 86 55 b4 76 b6 78 9b 73 25 f9 ea 8c
                dd d1 6a 58 53 3f f6 d9 e6 00 09 46 4a 5f 9d 54

     fixed_r =  08 54 64 52 53 29 0d 60 dd ad d0 e0 30 ba cd 9e
                55 01 ef dc 22 07 55 a1 e9 78 f1 b8 39 a0 56 48

   The actual private keys are considered to be encoded in little-endian
   format:

  d_i = 549D5F4A460900E6D9F63F53586AD1DD8CEAF925739B78B676B4558630B41F70

  d_r = 4856A039B8F178E9A1550722DCEF01559ECDBA30E0D0ADDD600D295352645408

   The public keys are generated from this using the formula in
   <a href="#section-2">Section 2</a>:

   pub_i = X25519(d_i, G) =
                48 d5 dd d4 06 12 57 ba 16 6f a3 f9 bb db 74 f1
                a4 e8 1c 08 93 84 fa 77 f7 90 70 9f 0d fb c7 66

   pub_r = X25519(d_r, G) =
                0b e7 c1 f5 aa d8 7d 7e 44 86 62 67 32 98 a4 43
                47 8b 85 97 45 17 9e af 56 4c 79 c0 ef 6e ee 25

   And this is the value of the Key Exchange Data field in the Key
   Exchange payload described in <a href="#section-3.1">Section 3.1</a>.  The shared value is
   calculated as in <a href="#section-2">Section 2</a>:

   SHARED_SECRET = X25519(d_i, pub_r) = X25519(d_r, pub_i) =
                c7 49 50 60 7a 12 32 7f-32 04 d9 4b 68 25 bf b0
                68 b7 f8 31 9a 9e 37 08-ed 3d 43 ce 81 30 c9 50



<span class="grey">Nir &amp; Josefsson              Standards Track                    [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc8031">RFC 8031</a>            Curve25519 and Curve448 for IKEv2      December 2016</span>


Acknowledgements

   Curve25519 was designed by D. J. Bernstein and the parameters for
   Curve448 ("Goldilocks") were defined by Mike Hamburg.  The
   specification of algorithms, wire format, and other considerations
   are documented in <a href="./rfc7748">RFC 7748</a> by Adam Langley, Mike Hamburg, and Sean
   Turner.

   The example in <a href="#appendix-A">Appendix A</a> was calculated using the master version of
   OpenSSL, retrieved on August 4th, 2016.

Authors' Addresses

   Yoav Nir
   Check Point Software Technologies Ltd.
   5 Hasolelim st.
   Tel Aviv  6789735
   Israel

   Email: ynir.ietf@gmail.com


   Simon Josefsson
   SJD AB

   Email: simon@josefsson.org

























Nir &amp; Josefsson              Standards Track                    [Page 8]
</pre>