Internet Engineering Task Force (IETF) Y. Nir Request for Comments: 8031 Check Point Category: Standards Track S. Josefsson ISSN: 2070-1721 SJD December 2016
Internet Engineering Task Force (IETF) Y. Nir Request for Comments: 8031 Check Point Category: Standards Track S. Josefsson ISSN: 2070-1721 SJD December 2016
Curve25519 and Curve448 for the Internet Key Exchange Protocol Version 2 (IKEv2) Key Agreement
互联网密钥交换协议版本2(IKEv2)密钥协议的Curve25519和Curve448
Abstract
摘要
This document describes the use of Curve25519 and Curve448 for ephemeral key exchange in the Internet Key Exchange Protocol Version 2 (IKEv2).
本文档描述了在Internet密钥交换协议版本2(IKEv2)中使用Curve25519和Curve448进行临时密钥交换。
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 Section 2 of RFC 7841.
本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 7841第2节。
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc8031.
有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc8031.
Copyright Notice
版权公告
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
版权所有(c)2016 IETF信托基金和确定为文件作者的人员。版权所有。
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) 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.
本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。
Table of Contents
目录
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Conventions Used in This Document . . . . . . . . . . . . 2 2. Curve25519 and Curve448 . . . . . . . . . . . . . . . . . . . 3 3. Use and Negotiation in IKEv2 . . . . . . . . . . . . . . . . 3 3.1. Key Exchange Payload . . . . . . . . . . . . . . . . . . 4 3.2. Recipient Tests . . . . . . . . . . . . . . . . . . . . . 4 4. Security Considerations . . . . . . . . . . . . . . . . . . . 4 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 6.1. Normative References . . . . . . . . . . . . . . . . . . 5 6.2. Informative References . . . . . . . . . . . . . . . . . 6 Appendix A. Numerical Example for Curve25519 . . . . . . . . . . 7 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 8 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 8
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Conventions Used in This Document . . . . . . . . . . . . 2 2. Curve25519 and Curve448 . . . . . . . . . . . . . . . . . . . 3 3. Use and Negotiation in IKEv2 . . . . . . . . . . . . . . . . 3 3.1. Key Exchange Payload . . . . . . . . . . . . . . . . . . 4 3.2. Recipient Tests . . . . . . . . . . . . . . . . . . . . . 4 4. Security Considerations . . . . . . . . . . . . . . . . . . . 4 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 6.1. Normative References . . . . . . . . . . . . . . . . . . 5 6.2. Informative References . . . . . . . . . . . . . . . . . 6 Appendix A. Numerical Example for Curve25519 . . . . . . . . . . 7 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 8 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 8
The "Elliptic Curves for Security" document [RFC7748] 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.
“用于安全的椭圆曲线”文档[RFC7748]描述了两条椭圆曲线Curve25519和Curve448,以及用于使用这些曲线的Diffie-Hellman操作执行密钥协商的X25519和X448函数。曲线和函数是为性能和安全性而设计的。
Elliptic curve Diffie-Hellman [RFC5903] has been specified for the Internet Key Exchange Protocol Version 2 (IKEv2) [RFC7296] for almost ten years. RFC 5903 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 [Curve25519] for details about the speed and security of the Curve25519 function.
椭圆曲线Diffie-Hellman[RFC5903]已被指定用于Internet密钥交换协议版本2(IKEv2)[RFC7296]近十年。RFC 5903及其前身规定了所谓的NIST曲线。从那时起,技术水平不断提高。更现代的曲线允许更快的实现,同时更容易编写能够抵御基于时间的侧通道攻击的恒定时间实现。本文件定义了两条用于IKEv2的曲线。有关Curve25519函数的速度和安全性的详细信息,请参见[Curve25519]。
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 [RFC2119].
本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照[RFC2119]中所述进行解释。
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 [RFC7748]. 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 [RFC7748].
IKEv2中Curve25519和Curve448的实施应遵循本节所述的步骤。所有加密计算均使用[RFC7748]中定义的X25519和X448函数完成。所有相关参数(例如,基点)和编码(特别是修剪最低/最高有效位并使用小端编码)均符合[RFC7748]。
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:
使用Curve25519或Curve448执行短暂的Diffie-Hellman密钥交换,如下所示:各方随机一致地选择密钥d并计算相应的公钥。下面使用“X”表示X25519或X448,“G”表示相应的基点:
pub_mine = X(d, G)
pub_mine=X(d,G)
Parties exchange their public keys (see Section 3.1) and compute a shared secret:
各方交换其公钥(见第3.1节)并计算共享秘密:
SHARED_SECRET = X(d, pub_peer)
共享秘密=X(d,发布对等)
This shared secret is used directly as the value denoted g^ir in Section 2.14 of RFC 7296. It is 32 octets when Curve25519 is used and 56 octets when Curve448 is used.
该共享秘密直接用作RFC 7296第2.14节中表示为g^ir的值。使用Curve25519时为32个八位字节,使用Curve448时为56个八位字节。
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.
IKEv2中Curve25519和Curve448的使用通过IKE_SA_INIT或CREATE_CHILD_SA交换的安全关联(SA)负载中的转换类型4(Diffie Hellman组)进行协商。值31用于曲线25519定义的组,值32用于曲线448定义的组。
The diagram for the Key Exchange payload from Section 3.4 of RFC 7296 is copied below for convenience:
为方便起见,RFC 7296第3.4节中的密钥交换有效负载图复制如下:
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 ~ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
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 有效负载长度-对于Curve25519,公钥是32个八位字节,因此有效负载长度字段将是40。对于Curve448,公钥是56个八位字节,因此有效负载长度字段将是64。
o The Diffie-Hellman Group Num is 31 for Curve25519 or 32 for Curve448.
o Diffie-Hellman组编号对于Curve25119为31,对于Curve448为32。
o The Key Exchange Data is the 32 or 56 octets as described in Section 6 of [RFC7748].
o 密钥交换数据为[RFC7748]第6节所述的32或56个八位字节。
Receiving and handling of incompatible point formats MUST follow the considerations described in Section 5 of [RFC7748]. 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.
不兼容点格式的接收和处理必须遵循[RFC7748]第5节中所述的注意事项。特别是,接收实体必须为X25519(而不是X448)屏蔽最后字节中的最高有效位,并且实现必须接受非规范值。
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和Curve448旨在促进高性能恒定时间实现的生产。鼓励实现者使用函数的固定时间实现。这一点至关重要,特别是当实现出于性能原因选择在许多密钥交换中重用其临时密钥对时。
Curve25519 is intended for the ~128-bit security level, comparable to the 256-bit random ECP Groups (group 19) defined in RFC 5903, also known as NIST P-256 or secp256r1. Curve448 is intended for the ~224-bit security level.
Curve25519适用于~128位安全级别,与RFC 5903中定义的256位随机ECP组(组19)相当,也称为NIST P-256或secp256r1。Curve448用于~224位安全级别。
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.
虽然NIST曲线被宣传为可验证的随机选择,但没有解释用于生成曲线的种子。相比之下,用于拾取曲线25519和曲线448的过程完全记录在案,且足够严格,因此可以且已经完成独立验证。这被广泛视为一种安全优势,因为它可以防止生成方恶意操纵参数。
Another family of curves available in IKE that were generated in a fully verifiable way is the Brainpool curves [RFC6954]. 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.
IKE中可用的另一系列曲线是以完全可验证的方式生成的Brainpool曲线[RFC6954]。例如,brainpoolP256(第28组)预计将提供与Curve25519和NIST P-256相当的安全级别。然而,由于使用伪随机素数,其速度明显慢于NIST P-256,后者本身也慢于Curve25519。
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:
IANA为IKEv2“变换类型4-Diffie-Hellman组变换ID”中的名称“Curve25519”和“Curve448”指定了两个值,并将本文档列为参考。收件人测试字段也应指向此文档:
+--------+------------+-----------------------+-----------+ | Number | Name | Recipient Tests | Reference | +--------+------------+-----------------------+-----------+ | 31 | Curve25519 | RFC 8031, Section 3.2 | RFC 8031 | | 32 | Curve448 | RFC 8031, Section 3.2 | RFC 8031 | +--------+------------+-----------------------+-----------+
+--------+------------+-----------------------+-----------+ | Number | Name | Recipient Tests | Reference | +--------+------------+-----------------------+-----------+ | 31 | Curve25519 | RFC 8031, Section 3.2 | RFC 8031 | | 32 | Curve448 | RFC 8031, Section 3.2 | RFC 8031 | +--------+------------+-----------------------+-----------+
Table 1: New Transform Type 4 Values
表1:新的变换类型4值
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <http://www.rfc-editor.org/info/rfc2119>.
[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,DOI 10.17487/RFC2119,1997年3月<http://www.rfc-editor.org/info/rfc2119>.
[RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. Kivinen, "Internet Key Exchange Protocol Version 2 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 2014, <http://www.rfc-editor.org/info/rfc7296>.
[RFC7296]Kaufman,C.,Hoffman,P.,Nir,Y.,Eronen,P.,和T.Kivinen,“互联网密钥交换协议版本2(IKEv2)”,STD 79,RFC 7296,DOI 10.17487/RFC72962014年10月<http://www.rfc-editor.org/info/rfc7296>.
[RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves for Security", RFC 7748, DOI 10.17487/RFC7748, January 2016, <http://www.rfc-editor.org/info/rfc7748>.
[RFC7748]兰利,A.,汉堡,M.和S.特纳,“安全的椭圆曲线”,RFC 7748,DOI 10.17487/RFC7748,2016年1月<http://www.rfc-editor.org/info/rfc7748>.
[Curve25519] 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, <http://dx.doi.org/10.1007/11745853_14>.
[Curve25519]Bernstein,J.,“Curve25519:新的Diffie-Hellman速度记录”,公钥密码术-PKC 2006,计算机科学课堂讲稿(LNCS),第3958卷,第207-228页,DOI 10.1007/11745853_14,2006年2月<http://dx.doi.org/10.1007/11745853_14>.
[RFC5903] Fu, D. and J. Solinas, "Elliptic Curve Groups modulo a Prime (ECP Groups) for IKE and IKEv2", RFC 5903, DOI 10.17487/RFC5903, June 2010, <http://www.rfc-editor.org/info/rfc5903>.
[RFC5903]Fu,D.和J.Solinas,“IKE和IKEv2的椭圆曲线群模素数(ECP群)”,RFC 5903,DOI 10.17487/RFC5903,2010年6月<http://www.rfc-editor.org/info/rfc5903>.
[RFC6954] Merkle, J. and M. Lochter, "Using the Elliptic Curve Cryptography (ECC) Brainpool Curves for the Internet Key Exchange Protocol Version 2 (IKEv2)", RFC 6954, DOI 10.17487/RFC6954, July 2013, <http://www.rfc-editor.org/info/rfc6954>.
[RFC6954]Merkle,J.和M.Lochter,“互联网密钥交换协议版本2(IKEv2)使用椭圆曲线加密(ECC)脑池曲线”,RFC 6954,DOI 10.17487/RFC6954,2013年7月<http://www.rfc-editor.org/info/rfc6954>.
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:
假设发起方和响应方都通过生成32个随机八位组来生成私钥。在IKEv2及其扩展中,我们通常用后缀_i表示启动器值,用后缀_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
随机指数=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
随机=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 Section 5 of RFC 7748. This affects only the first and last octets of each value:
如RFC 7748第5节所述,需要通过取消某些位的设置来固定这些数字。这仅影响每个值的第一个和最后一个八位字节:
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
固定成本=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
固定=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:
实际私钥被认为是以little endian格式编码的:
d_i = 549D5F4A460900E6D9F63F53586AD1DD8CEAF925739B78B676B4558630B41F70
d_i = 549D5F4A460900E6D9F63F53586AD1DD8CEAF925739B78B676B4558630B41F70
d_r = 4856A039B8F178E9A1550722DCEF01559ECDBA30E0D0ADDD600D295352645408
d_r = 4856A039B8F178E9A1550722DCEF01559ECDBA30E0D0ADDD600D295352645408
The public keys are generated from this using the formula in Section 2:
使用第2节中的公式由此生成公钥:
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
发布号=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
发布=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 Section 3.1. The shared value is calculated as in Section 2:
这是第3.1节中描述的密钥交换有效载荷中密钥交换数据字段的值。共享值的计算方法见第2节:
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
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
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 RFC 7748 by Adam Langley, Mike Hamburg, and Sean Turner.
Curve25519由D.J.Bernstein设计,Curve448(“金发姑娘”)的参数由Mike Hamburg定义。Adam Langley、Mike Hamburg和Sean Turner在RFC 7748中记录了算法规范、导线格式和其他注意事项。
The example in Appendix A was calculated using the master version of OpenSSL, retrieved on August 4th, 2016.
附录A中的示例使用OpenSSL的主版本进行计算,该版本于2016年8月4日检索。
Authors' Addresses
作者地址
Yoav Nir Check Point Software Technologies Ltd. 5 Hasolelim st. Tel Aviv 6789735 Israel
以色列特拉维夫Hasolelim街5号Yoav Nir Check Point软件技术有限公司6789735
Email: ynir.ietf@gmail.com
Email: ynir.ietf@gmail.com
Simon Josefsson SJD AB
西蒙·约瑟夫森SJD AB
Email: simon@josefsson.org
Email: simon@josefsson.org