idnits 2.17.1 draft-irtf-cfrg-spake2-25.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 : ---------------------------------------------------------------------------- ** There are 12 instances of too long lines in the document, the longest one being 5 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (December 2021) is 863 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Missing Reference: '-1' is mentioned on line 608, but not defined -- Looks like a reference, but probably isn't: '0' on line 610 == Unused Reference: 'TDH' is defined on line 534, but no explicit reference was found in the text == Outdated reference: A later version (-16) exists of draft-irtf-cfrg-hash-to-curve-05 == Outdated reference: A later version (-14) exists of draft-irtf-cfrg-opaque-06 Summary: 1 error (**), 0 flaws (~~), 5 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Research Task Force W. Ladd 3 Internet-Draft Sealance 4 Intended status: Informational B. Kaduk, Ed. 5 Expires: 4 July 2022 Akamai 6 December 2021 8 SPAKE2, a PAKE 9 draft-irtf-cfrg-spake2-25 11 Abstract 13 This document describes SPAKE2 which is a protocol for two parties 14 that share a password to derive a strong shared key without 15 disclosing the password. This method is compatible with any group, 16 is computationally efficient, and SPAKE2 has a security proof. This 17 document predated the CFRG PAKE competition and it was not selected, 18 however, given existing use of variants in Kerberos and other 19 applications it was felt publication was beneficial. Applications 20 that need a symmetric PAKE and where hashing onto an elliptic curve 21 at execution time is not possible can use SPAKE2. This document is a 22 product of the Crypto Forum Research Group (CFRG) in the IRTF. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at https://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on 4 June 2022. 41 Copyright Notice 43 Copyright (c) 2021 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 48 license-info) in effect on the date of publication of this document. 49 Please review these documents carefully, as they describe your rights 50 and restrictions with respect to this document. 52 Table of Contents 54 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 55 2. Requirements Notation . . . . . . . . . . . . . . . . . . . . 3 56 3. Definition of SPAKE2 . . . . . . . . . . . . . . . . . . . . 3 57 4. Key Schedule and Key Confirmation . . . . . . . . . . . . . . 6 58 5. Per-User M and N and M=N . . . . . . . . . . . . . . . . . . 7 59 6. Ciphersuites . . . . . . . . . . . . . . . . . . . . . . . . 7 60 7. Security Considerations . . . . . . . . . . . . . . . . . . . 10 61 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 62 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 11 63 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 64 10.1. Normative References . . . . . . . . . . . . . . . . . . 11 65 10.2. Informative References . . . . . . . . . . . . . . . . . 12 66 Appendix A. Algorithm used for Point Generation . . . . . . . . 13 67 Appendix B. Test Vectors . . . . . . . . . . . . . . . . . . . . 14 68 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 17 70 1. Introduction 72 This document describes SPAKE2, a means for two parties that share a 73 password to derive a strong shared key without disclosing the 74 password. This password-based key exchange protocol is compatible 75 with any group (requiring only a scheme to map a random input of 76 fixed length per group to a random group element), is computationally 77 efficient, and has a security proof. Predetermined parameters for a 78 selection of commonly used groups are also provided for use by other 79 protocols. 81 SPAKE2 was not selected as the result of the CFRG PAKE selection 82 competition. However, given existing use of variants in Kerberos and 83 other applications it was felt publication was beneficial. This RFC 84 represents the individual opinion(s) of one or more members of the 85 Crypto Forum Research Group of the Internet Research Task Force 86 (IRTF). 88 Many of these applications predated methods to hash to elliptic 89 curves being available or predated the publication of the PAKEs that 90 were chosen as an outcome of the PAKE selection competition. In 91 cases where a symmetric PAKE is needed, and hashing onto an elliptic 92 curve at protocol execution time is not available, SPAKE2 is useful. 94 2. Requirements Notation 96 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 97 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 98 "OPTIONAL" in this document are to be interpreted as described in BCP 99 14 [RFC2119] [RFC8174] when, and only when, they appear in all 100 capitals, as shown here. 102 3. Definition of SPAKE2 104 3.1. Protocol Flow 106 SPAKE2 is a two round protocol, wherein the first round establishes a 107 shared secret between A and B, and the second round serves as key 108 confirmation. Prior to invocation, A and B are provisioned with 109 information such as the input password needed to run the protocol. 110 We assume that the roles of A and B are agreed upon by both sides: A 111 goes first and uses M, and B goes second and uses N. If this 112 assignment of roles is not possible a symmetric variant MUST be used 113 as described later Section 5. For instance A may be the client when 114 using TCP or TLS as an underlying protocol and B the server. Most 115 protocols have such a distinction. During the first round, A sends a 116 public value pA to B, and B responds with its own public value pB. 117 Both A and B then derive a shared secret used to produce encryption 118 and authentication keys. The latter are used during the second round 119 for key confirmation. (Section 4 details the key derivation and 120 confirmation steps.) In particular, A sends a key confirmation 121 message cA to B, and B responds with its own key confirmation message 122 cB. A MUST NOT consider the protocol complete until it receives and 123 verifies cB. Likewise, B MUST NOT consider the protocol complete 124 until it receives and verifies cA. 126 This sample flow is shown below. 128 A B 129 | (setup protocol) | 130 | | 131 (compute pA) | pA | 132 |----------------->| 133 | pB | (compute pB) 134 |<-----------------| 135 | | 136 | (derive secrets) | 137 | | 138 (compute cA) | cA | 139 |----------------->| 140 | cB | (compute cB) 141 | | (check cA) 142 |<-----------------| 143 (check cB) | | 145 3.2. Setup 147 Let G be a group in which the gap Diffie-Hellman (GDH) problem is 148 hard. Suppose G has order p*h where p is a large prime; h will be 149 called the cofactor. Let I be the unit element in G, e.g., the point 150 at infinity if G is an elliptic curve group. We denote the 151 operations in the group additively. We assume there is a 152 representation of elements of G as byte strings: common choices would 153 be SEC1 [SEC1] uncompressed or compressed for elliptic curve groups 154 or big endian integers of a fixed (per-group) length for prime field 155 DH. Applications MUST specify this encoding, typically by referring 156 to the document defining the group. We fix two elements M and N in 157 the prime-order subgroup of G as defined in the table in this 158 document for common groups, as well as a generator P of the (large) 159 prime-order subgroup of G. In the case of a composite order group we 160 will work in the quotient group. For common groups used in this 161 document, P is specified in the document defining the group, and so 162 we do not repeat it here. 164 For elliptic curves other than the ones in this document the methods 165 of [I-D.irtf-cfrg-hash-to-curve] SHOULD be used to generate M and N, 166 e.g. via M = hash_to_curve("M SPAKE2 seed OID x") and N = 167 hash_to_curve("N SPAKE2 seed OID x"), where x is an OID for the 168 curve. Applications MAY include a DST tag in this step, as specified 169 in [I-D.irtf-cfrg-hash-to-curve], though this is not required. 171 || denotes concatenation of byte strings. We also let len(S) denote 172 the length of a string in bytes, represented as an eight-byte little- 173 endian number. Finally, let nil represent an empty string, i.e., 174 len(nil) = 0. Text strings in double quotes are treated as their 175 ASCII encodings throughout this document. 177 KDF(ikm, salt, info, L) is a key-derivation function that takes as 178 input a salt, intermediate keying material (IKM), info string, and 179 derived key length L to derive a cryptographic key of length L. 180 MAC(key, message) is a Message Authentication Code algorithm that 181 takes a secret key and message as input to produce an output. Let 182 Hash be a hash function from arbitrary strings to bit strings of a 183 fixed length, at least 256 bits long. Common choices for Hash are 184 SHA256 or SHA512 [RFC6234]. Let MHF be a memory-hard hash function 185 designed to slow down brute-force attackers. Scrypt [RFC7914] is a 186 common example of this function. The output length of MHF matches 187 that of Hash. Parameter selection for MHF is out of scope for this 188 document. Section 6 specifies variants of KDF, MAC, and Hash 189 suitable for use with the protocols contained herein. 191 Let A and B be two parties. A and B may also have digital 192 representations of the parties' identities such as Media Access 193 Control addresses or other names (hostnames, usernames, etc). A and 194 B may share Additional Authenticated Data (AAD) of length at most 195 2^16 - 128 bits that is separate from their identities which they may 196 want to include in the protocol execution. One example of AAD is a 197 list of supported protocol versions if SPAKE2 were used in a higher- 198 level protocol which negotiates use of a particular PAKE. Including 199 this list would ensure that both parties agree upon the same set of 200 supported protocols and therefore prevent downgrade attacks. We also 201 assume A and B share an integer w; typically w = MHF(pw) mod p, for a 202 user-supplied password pw. Standards such as NIST.SP.800-56Ar3 203 suggest taking mod p of a hash value that is 64 bits longer than that 204 needed to represent p to remove statistical bias introduced by the 205 modulation. Protocols using this specification MUST define the 206 method used to compute w. In some cases, it may be necessary to 207 carry out various forms of normalization of the password before 208 hashing [RFC8265]. The hashing algorithm SHOULD be a MHF so as to 209 slow down brute-force attackers. 211 3.3. SPAKE2 213 To begin, A picks x randomly and uniformly from the integers in 214 [0,p), and calculates X=x*P and pA=w*M+X, then transmits pA to B. 216 B selects y randomly and uniformly from the integers in [0,p), and 217 calculates Y=y*P, pB=w*N+Y, then transmits pB to A. 219 Both A and B calculate a group element K. A calculates it as 220 h*x*(pB-w*N), while B calculates it as h*y*(pA-w*M). A knows pB 221 because it has received it, and likewise B knows pA. The 222 multiplication by h prevents small subgroup confinement attacks by 223 computing a unique value in the quotient group. 225 K is a shared value, though it MUST NOT be used or output as a shared 226 secret from the protocol. Both A and B must derive two additional 227 shared secrets from the protocol transcript, which includes K. This 228 prevents man-in-the-middle attackers from inserting themselves into 229 the exchange. The transcript TT is encoded as follows: 231 TT = len(A) || A 232 || len(B) || B 233 || len(pA) || pA 234 || len(pB) || pB 235 || len(K) || K 236 || len(w) || w 238 Here w is encoded as a big endian number padded to the length of p. 239 This representation prevents timing attacks that otherwise would 240 reveal the length of w. len(w) is thus a constant. We include it for 241 consistency. 243 If an identity is absent, it is encoded as a zero-length string. 244 This MUST only be done for applications in which identities are 245 implicit. Otherwise, the protocol risks unknown key share attacks, 246 where both sides of a connection disagree over who is authenticated. 248 Upon completion of this protocol, A and B compute shared secrets Ke, 249 KcA, and KcB as specified in Section 4. A MUST send B a key 250 confirmation message so both parties agree upon these shared secrets. 251 This confirmation message cA is computed as a MAC over the protocol 252 transcript TT using KcA, as follows: cA = MAC(KcA, TT). Similarly, B 253 MUST send A a confirmation message using a MAC computed equivalently 254 except with the use of KcB. Key confirmation verification requires 255 computing cB and checking for equality against that which was 256 received. 258 4. Key Schedule and Key Confirmation 260 The protocol transcript TT, as defined in Section 3.3, is unique and 261 secret to A and B. Both parties use TT to derive shared symmetric 262 secrets Ke and Ka as Ke || Ka = Hash(TT), with |Ke| = |Ka|. The 263 length of each key is equal to half of the digest output, e.g., 128 264 bits for SHA-256. Keys MUST be at least 128 bits in length. 266 Both endpoints use Ka to derive subsequent MAC keys for key 267 confirmation messages. Specifically, let KcA and KcB be the MAC keys 268 used by A and B, respectively. A and B compute them as KcA || KcB = 269 KDF(Ka, nil, "ConfirmationKeys" || AAD, L), where AAD is the 270 associated data each given to each endpoint, or nil if none was 271 provided. The length of each of KcA and KcB is equal to half of the 272 underlying hash output length, e.g., |KcA| = |KcB| = 128 bits for 273 HKDF(SHA256), with L=256 bits. 275 The resulting key schedule for this protocol, given transcript TT and 276 additional associated data AAD, is as follows. 278 TT -> Hash(TT) = Ke || Ka 279 AAD -> KDF(Ka, nil, "ConfirmationKeys" || AAD) = KcA || KcB 281 A and B output Ke as the shared secret from the protocol. Ka and its 282 derived keys are not used for anything except key confirmation. 284 5. Per-User M and N and M=N 286 To avoid concerns that an attacker needs to solve a single ECDH 287 instance to break the authentication of SPAKE2, it is possible to 288 vary M and N using [I-D.irtf-cfrg-hash-to-curve] as follows: 290 M = hash_to_curve(Hash("M SPAKE2" || len(A) || A || len(B) || B)) 291 N = hash_to_curve(Hash("N SPAKE2" || len(A) || A || len(B) || B)) 293 There is also a symmetric variant where M=N. For this variant we set 295 M = hash_to_curve(Hash("M AND N SPAKE2")) 297 This variant MUST be used when it is not possible to determine which 298 of A and B should use M or N, due to asymmetries in the protocol 299 flows or the desire to use only a single shared secret with nil 300 identities for authentication. The security of these variants is 301 examined in [MNVAR]. The variant with per-user M and N may not be 302 suitable for protocols that require the initial messages to be 303 generated by each party at the same time and do not know the exact 304 identity of the parties before the flow begins. 306 6. Ciphersuites 308 This section documents SPAKE2 ciphersuite configurations. A 309 ciphersuite indicates a group, cryptographic hash function, and pair 310 of KDF and MAC functions, e.g., SPAKE2-P256-SHA256-HKDF-HMAC. This 311 ciphersuite indicates a SPAKE2 protocol instance over P-256 that uses 312 SHA256 along with HKDF [RFC5869] and HMAC [RFC2104] for G, Hash, KDF, 313 and MAC functions, respectively. For Ed25519 the compressed encoding 314 is used [RFC8032], all others use the uncompressed SEC1 encoding. 316 +==============+==================+================+================+ 317 | G | Hash | KDF | MAC | 318 +==============+==================+================+================+ 319 | P-256 | SHA256 [RFC6234] | HKDF [RFC5869] | HMAC | 320 | | | | [RFC2104] | 321 +--------------+------------------+----------------+----------------+ 322 | P-256 | SHA512 [RFC6234] | HKDF [RFC5869] | HMAC | 323 | | | | [RFC2104] | 324 +--------------+------------------+----------------+----------------+ 325 | P-384 | SHA256 [RFC6234] | HKDF [RFC5869] | HMAC | 326 | | | | [RFC2104] | 327 +--------------+------------------+----------------+----------------+ 328 | P-384 | SHA512 [RFC6234] | HKDF [RFC5869] | HMAC | 329 | | | | [RFC2104] | 330 +--------------+------------------+----------------+----------------+ 331 | P-521 | SHA512 [RFC6234] | HKDF [RFC5869] | HMAC | 332 | | | | [RFC2104] | 333 +--------------+------------------+----------------+----------------+ 334 | edwards25519 | SHA256 [RFC6234] | HKDF [RFC5869] | HMAC | 335 | [RFC8032] | | | [RFC2104] | 336 +--------------+------------------+----------------+----------------+ 337 | edwards448 | SHA512 [RFC6234] | HKDF [RFC5869] | HMAC | 338 | [RFC8032] | | | [RFC2104] | 339 +--------------+------------------+----------------+----------------+ 340 | P-256 | SHA256 [RFC6234] | HKDF [RFC5869] | CMAC-AES-128 | 341 | | | | [RFC4493] | 342 +--------------+------------------+----------------+----------------+ 343 | P-256 | SHA512 [RFC6234] | HKDF [RFC5869] | CMAC-AES-128 | 344 | | | | [RFC4493] | 345 +--------------+------------------+----------------+----------------+ 347 Table 1: SPAKE2 Ciphersuites 349 The following points represent permissible point generation seeds for 350 the groups listed in the Table Table 1, using the algorithm presented 351 in Appendix A. These bytestrings are compressed points as in [SEC1] 352 for curves from [SEC1]. 354 For P256: 356 M = 357 02886e2f97ace46e55ba9dd7242579f2993b64e16ef3dcab95afd497333d8fa12f 358 seed: 1.2.840.10045.3.1.7 point generation seed (M) 360 N = 361 03d8bbd6c639c62937b04d997f38c3770719c629d7014d49a24b4f98baa1292b49 362 seed: 1.2.840.10045.3.1.7 point generation seed (N) 364 For P384: 366 M = 367 030ff0895ae5ebf6187080a82d82b42e2765e3b2f8749c7e05eba366434b363d3dc 368 36f15314739074d2eb8613fceec2853 369 seed: 1.3.132.0.34 point generation seed (M) 371 N = 372 02c72cf2e390853a1c1c4ad816a62fd15824f56078918f43f922ca21518f9c543bb 373 252c5490214cf9aa3f0baab4b665c10 374 seed: 1.3.132.0.34 point generation seed (N) 376 For P521: 378 M = 379 02003f06f38131b2ba2600791e82488e8d20ab889af753a41806c5db18d37d85608 380 cfae06b82e4a72cd744c719193562a653ea1f119eef9356907edc9b56979962d7aa 381 seed: 1.3.132.0.35 point generation seed (M) 383 N = 384 0200c7924b9ec017f3094562894336a53c50167ba8c5963876880542bc669e494b25 385 32d76c5b53dfb349fdf69154b9e0048c58a42e8ed04cef052a3bc349d95575cd25 386 seed: 1.3.132.0.35 point generation seed (N) 388 For edwards25519: 390 M = 391 d048032c6ea0b6d697ddc2e86bda85a33adac920f1bf18e1b0c6d166a5cecdaf 392 seed: edwards25519 point generation seed (M) 394 N = 395 d3bfb518f44f3430f29d0c92af503865a1ed3281dc69b35dd868ba85f886c4ab 396 seed: edwards25519 point generation seed (N) 398 For edwards448: 400 M = 401 b6221038a775ecd007a4e4dde39fd76ae91d3cf0cc92be8f0c2fa6d6b66f9a12 402 942f5a92646109152292464f3e63d354701c7848d9fc3b8880 403 seed: edwards448 point generation seed (M) 405 N = 406 6034c65b66e4cd7a49b0edec3e3c9ccc4588afd8cf324e29f0a84a072531c4db 407 f97ff9af195ed714a689251f08f8e06e2d1f24a0ffc0146600 408 seed: edwards448 point generation seed (N) 410 7. Security Considerations 412 A security proof of SPAKE2 for prime order groups is found in [REF], 413 reducing the security of SPAKE2 to the gap Diffie-Hellman assumption. 414 Note that the choice of M and N is critical for the security proof. 415 The generation methods specified in this document are designed to 416 eliminate concerns related to knowing discrete logs of M and N. 418 Elements received from a peer MUST be checked for group membership: 419 failure to properly deserialize and validate group elements can lead 420 to attacks. An endpoint MUST abort the protocol if any received 421 public value is not a member of G. 423 The choices of random numbers MUST BE uniform. Randomly generated 424 values, e.g., x and y, MUST NOT be reused; such reuse violates the 425 security assumptions of the protocol and results in significant 426 insecurity. It is RECOMMENDED to generate these uniform numbers 427 using rejection sampling. 429 Some implementations of elliptic curve multiplication may leak 430 information about the length of the scalar. These MUST NOT be used. 431 All operations on elliptic curve points must take time independent of 432 the inputs. Hashing of the transcript may take time depending only 433 on the length of the transcript, but not the contents. 435 SPAKE2 does not support augmentation. As a result, the server has to 436 store a password equivalent. This is considered a significant 437 drawback in some use cases. Applications that need augmented PAKEs 438 should use [I-D.irtf-cfrg-opaque]. 440 The HMAC keys in this document are shorter than recommended in 441 [RFC8032]. This is appropriate as the difficulty of the discrete 442 logarithm problem is comparable with the difficulty of brute forcing 443 the keys. 445 8. IANA Considerations 447 No IANA action is required. 449 9. Acknowledgments 451 Special thanks to Nathaniel McCallum and Greg Hudson for generation 452 of M and N, and Chris Wood for test vectors. Thanks to Mike Hamburg 453 for advice on how to deal with cofactors. Greg Hudson also suggested 454 the addition of warnings on the reuse of x and y. Thanks to Fedor 455 Brunner, Adam Langley, Liliya Akhmetzyanova, and the members of the 456 CFRG for comments and advice. Thanks to Scott Fluhrer and those 457 Crypto Panel experts involved in the PAKE selection process 458 (https://github.com/cfrg/pake-selection) who have provided valuable 459 comments. Chris Wood contributed substantial text and reformatting 460 to address the excellent review comments from Kenny Paterson. 462 10. References 464 10.1. Normative References 466 [I-D.irtf-cfrg-hash-to-curve] 467 Faz-Hernandez, A., Scott, S., Sullivan, N., Wahby, R., and 468 C. Wood, "Hashing to Elliptic Curves", Work in Progress, 469 Internet-Draft, draft-irtf-cfrg-hash-to-curve-05, 2 470 November 2019, . 473 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 474 Hashing for Message Authentication", RFC 2104, 475 DOI 10.17487/RFC2104, February 1997, 476 . 478 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 479 Requirement Levels", BCP 14, RFC 2119, 480 DOI 10.17487/RFC2119, March 1997, 481 . 483 [RFC4493] Song, JH., Poovendran, R., Lee, J., and T. Iwata, "The 484 AES-CMAC Algorithm", RFC 4493, DOI 10.17487/RFC4493, June 485 2006, . 487 [RFC5480] Turner, S., Brown, D., Yiu, K., Housley, R., and T. Polk, 488 "Elliptic Curve Cryptography Subject Public Key 489 Information", RFC 5480, DOI 10.17487/RFC5480, March 2009, 490 . 492 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 493 Key Derivation Function (HKDF)", RFC 5869, 494 DOI 10.17487/RFC5869, May 2010, 495 . 497 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 498 (SHA and SHA-based HMAC and HKDF)", RFC 6234, 499 DOI 10.17487/RFC6234, May 2011, 500 . 502 [RFC7914] Percival, C. and S. Josefsson, "The scrypt Password-Based 503 Key Derivation Function", RFC 7914, DOI 10.17487/RFC7914, 504 August 2016, . 506 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 507 Signature Algorithm (EdDSA)", RFC 8032, 508 DOI 10.17487/RFC8032, January 2017, 509 . 511 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 512 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 513 May 2017, . 515 10.2. Informative References 517 [SEC1] Standards for Efficient Cryptography Group, "SEC 1: 518 Elliptic Curve Cryptography", May 2009. 520 [MNVAR] Abdalla, M., Barbosa, M., Bradley, T., Jarecki, S., Katz, 521 J., and J. Xu, "Universally Composable Relaxed Password 522 Authentication", August 2020. Appears in Micciancio D., 523 Ristenpart T. (eds) Advances in Cryptology -CRYPTO 2020. 524 Crypto 2020. Lecture notes in Computer Science volume 525 12170. Springer. 527 [REF] Abdalla, M. and D. Pointcheval, "Simple Password-Based 528 Encrypted Key Exchange Protocols.", February 2005. 529 Appears in A. Menezes, editor. Topics in Cryptography- 530 CT-RSA 2005, Volume 3376 of Lecture Notes in Computer 531 Science, pages 191-208, San Francisco, CA, US. Springer- 532 Verlag, Berlin, Germany. 534 [TDH] Cash, D., Kiltz, E., and V. Shoup, "The Twin-Diffie 535 Hellman Problem and Applications", 2008. EUROCRYPT 2008. 536 Volume 4965 of Lecture notes in Computer Science, pages 537 127-145. Springer-Verlag, Berlin, Germany. 539 [RFC8265] Saint-Andre, P. and A. Melnikov, "Preparation, 540 Enforcement, and Comparison of Internationalized Strings 541 Representing Usernames and Passwords", RFC 8265, 542 DOI 10.17487/RFC8265, October 2017, 543 . 545 [I-D.irtf-cfrg-opaque] 546 Krawczyk, H., Bourdrez, D., Lewi, K., and C. A. Wood, "The 547 OPAQUE Asymmetric PAKE Protocol", Work in Progress, 548 Internet-Draft, draft-irtf-cfrg-opaque-06, 12 July 2021, 549 . 552 Appendix A. Algorithm used for Point Generation 554 This section describes the algorithm that was used to generate the 555 points M and N in the table in Section 6. 557 For each curve in the table below, we construct a string using the 558 curve OID from [RFC5480] (as an ASCII string) or its name, combined 559 with the needed constant, e.g., "1.3.132.0.35 point generation seed 560 (M)" for P-521. This string is turned into a series of blocks by 561 hashing with SHA256, and hashing that output again to generate the 562 next 32 bytes, and so on. This pattern is repeated for each group 563 and value, with the string modified appropriately. 565 A byte string of length equal to that of an encoded group element is 566 constructed by concatenating as many blocks as are required, starting 567 from the first block, and truncating to the desired length. The byte 568 string is then formatted as required for the group. In the case of 569 Weierstrass curves, we take the desired length as the length for 570 representing a compressed point (section 2.3.4 of [SEC1]), and use 571 the low-order bit of the first byte as the sign bit. In order to 572 obtain the correct format, the value of the first byte is set to 0x02 573 or 0x03 (clearing the first six bits and setting the seventh bit), 574 leaving the sign bit as it was in the byte string constructed by 575 concatenating hash blocks. For the [RFC8032] curves a different 576 procedure is used. For edwards448 the 57-byte input has the least- 577 significant 7 bits of the last byte set to zero, and for edwards25519 578 the 32-byte input is not modified. For both the [RFC8032] curves the 579 (modified) input is then interpreted as the representation of the 580 group element. If this interpretation yields a valid group element 581 with the correct order (p), the (modified) byte string is the output. 582 Otherwise, the initial hash block is discarded and a new byte string 583 constructed from the remaining hash blocks. The procedure of 584 constructing a byte string of the appropriate length, formatting it 585 as required for the curve, and checking if it is a valid point of the 586 correct order, is repeated until a valid element is found. 588 The following python snippet generates the above points, assuming an 589 elliptic curve implementation following the interface of 590 Edwards25519Point.stdbase() and Edwards448Point.stdbase() in 591 Appendix A of [RFC8032]: 593 def iterated_hash(seed, n): 594 h = seed 595 for i in range(n): 596 h = hashlib.sha256(h).digest() 597 return h 599 def bighash(seed, start, sz): 600 n = -(-sz // 32) 601 hashes = [iterated_hash(seed, i) for i in range(start, start + n)] 602 return b''.join(hashes)[:sz] 604 def canon_pointstr(ecname, s): 605 if ecname == 'edwards25519': 606 return s 607 elif ecname == 'edwards448': 608 return s[:-1] + bytes([s[-1] & 0x80]) 609 else: 610 return bytes([(s[0] & 1) | 2]) + s[1:] 612 def gen_point(seed, ecname, ec): 613 for i in range(1, 1000): 614 hval = bighash(seed, i, len(ec.encode())) 615 pointstr = canon_pointstr(ecname, hval) 616 try: 617 p = ec.decode(pointstr) 618 if p != ec.zero_elem() and p * p.l() == ec.zero_elem(): 619 return pointstr, i 620 except Exception: 621 pass 623 Appendix B. Test Vectors 625 This section contains test vectors for SPAKE2 using the P256-SHA256- 626 HKDF-HMAC ciphersuite. (Choice of MHF is omitted and values for w, 627 x, and y are provided directly.) All points are encoded using the 628 uncompressed format, i.e., with a 0x04 octet prefix, specified in 629 [SEC1] A and B identity strings are provided in the protocol 630 invocation. 632 B.1. SPAKE2 Test Vectors 633 spake2: A='server', B='client' 634 w = 0x2ee57912099d31560b3a44b1184b9b4866e904c49d12ac5042c97dca461b1a5f 635 x = 0x43dd0fd7215bdcb482879fca3220c6a968e66d70b1356cac18bb26c84a78d729 636 pA = 0x04a56fa807caaa53a4d28dbb9853b9815c61a411118a6fe516a8798434751470 637 f9010153ac33d0d5f2047ffdb1a3e42c9b4e6be662766e1eeb4116988ede5f912c 638 y = 0xdcb60106f276b02606d8ef0a328c02e4b629f84f89786af5befb0bc75b6e66be 639 pB = 0x0406557e482bd03097ad0cbaa5df82115460d951e3451962f1eaf4367a420676 640 d09857ccbc522686c83d1852abfa8ed6e4a1155cf8f1543ceca528afb591a1e0b7 641 K = 0x0412af7e89717850671913e6b469ace67bd90a4df8ce45c2af19010175e37eed 642 69f75897996d539356e2fa6a406d528501f907e04d97515fbe83db277b715d3325 643 TT = 0x06000000000000007365727665720600000000000000636c69656e744100000 644 00000000004a56fa807caaa53a4d28dbb9853b9815c61a411118a6fe516a8798434751 645 470f9010153ac33d0d5f2047ffdb1a3e42c9b4e6be662766e1eeb4116988ede5f912c4 646 1000000000000000406557e482bd03097ad0cbaa5df82115460d951e3451962f1eaf43 647 67a420676d09857ccbc522686c83d1852abfa8ed6e4a1155cf8f1543ceca528afb591a 648 1e0b741000000000000000412af7e89717850671913e6b469ace67bd90a4df8ce45c2a 649 f19010175e37eed69f75897996d539356e2fa6a406d528501f907e04d97515fbe83db2 650 77b715d332520000000000000002ee57912099d31560b3a44b1184b9b4866e904c49d1 651 2ac5042c97dca461b1a5f 652 Hash(TT) = 0x0e0672dc86f8e45565d338b0540abe6915bdf72e2b35b5c9e5663168e960a91b 653 Ke = 0x0e0672dc86f8e45565d338b0540abe69 654 Ka = 0x15bdf72e2b35b5c9e5663168e960a91b 655 KcA = 0x00c12546835755c86d8c0db7851ae86f 656 KcB = 0xa9fa3406c3b781b93d804485430ca27a 657 A conf = 0x58ad4aa88e0b60d5061eb6b5dd93e80d9c4f00d127c65b3b35b1b5281fee38f0 658 B conf = 0xd3e2e547f1ae04f2dbdbf0fc4b79f8ecff2dff314b5d32fe9fcef2fb26dc459b 660 spake2: A='', B='client' 661 w = 0x0548d8729f730589e579b0475a582c1608138ddf7054b73b5381c7e883e2efae 662 x = 0x403abbe3b1b4b9ba17e3032849759d723939a27a27b9d921c500edde18ed654b 663 pA = 0x04a897b769e681c62ac1c2357319a3d363f610839c4477720d24cbe32f5fd85f 664 44fb92ba966578c1b712be6962498834078262caa5b441ecfa9d4a9485720e918a 665 y = 0x903023b6598908936ea7c929bd761af6039577a9c3f9581064187c3049d87065 666 pB = 0x04e0f816fd1c35e22065d5556215c097e799390d16661c386e0ecc84593974a6 667 1b881a8c82327687d0501862970c64565560cb5671f696048050ca66ca5f8cc7fc 668 K = 0x048f83ec9f6e4f87cc6f9dc740bdc2769725f923364f01c84148c049a39a735e 669 bda82eac03e00112fd6a5710682767cff5361f7e819e53d8d3c3a2922e0d837aa6 670 TT = 0x00000000000000000600000000000000636c69656e74410000000000000004a 671 897b769e681c62ac1c2357319a3d363f610839c4477720d24cbe32f5fd85f44fb92ba9 672 66578c1b712be6962498834078262caa5b441ecfa9d4a9485720e918a4100000000000 673 00004e0f816fd1c35e22065d5556215c097e799390d16661c386e0ecc84593974a61b8 674 81a8c82327687d0501862970c64565560cb5671f696048050ca66ca5f8cc7fc4100000 675 000000000048f83ec9f6e4f87cc6f9dc740bdc2769725f923364f01c84148c049a39a7 676 35ebda82eac03e00112fd6a5710682767cff5361f7e819e53d8d3c3a2922e0d837aa62 677 0000000000000000548d8729f730589e579b0475a582c1608138ddf7054b73b5381c7e 678 883e2efae 679 Hash(TT) = 0x642f05c473c2cd79909f9a841e2f30a70bf89b18180af97353ba198789c2b963 680 Ke = 0x642f05c473c2cd79909f9a841e2f30a7 681 Ka = 0x0bf89b18180af97353ba198789c2b963 682 KcA = 0xc6be376fc7cd1301fd0a13adf3e7bffd 683 KcB = 0xb7243f4ae60440a49b3f8cab3c1fba07 684 A conf = 0x47d29e6666af1b7dd450d571233085d7a9866e4d49d2645e2df975489521232b 685 B conf = 0x3313c5cefc361d27fb16847a91c2a73b766ffa90a4839122a9b70a2f6bd1d6df 687 spake2: A='server', B='' 688 w = 0x626e0cdc7b14c9db3e52a0b1b3a768c98e37852d5db30febe0497b14eae8c254 689 x = 0x07adb3db6bc623d3399726bfdbfd3d15a58ea776ab8a308b00392621291f9633 690 pA = 0x04f88fb71c99bfffaea370966b7eb99cd4be0ff1a7d335caac4211c4afd855e2 691 e15a873b298503ad8ba1d9cbb9a392d2ba309b48bfd7879aefd0f2cea6009763b0 692 y = 0xb6a4fc8dbb629d4ba51d6f91ed1532cf87adec98f25dd153a75accafafedec16 693 pB = 0x040c269d6be017dccb15182ac6bfcd9e2a14de019dd587eaf4bdfd353f031101 694 e7cca177f8eb362a6e83e7d5e729c0732e1b528879c086f39ba0f31a9661bd34db 695 K = 0x0445ee233b8ecb51ebd6e7da3f307e88a1616bae2166121221fdc0dadb986afa 696 f3ec8a988dc9c626fa3b99f58a7ca7c9b844bb3e8dd9554aafc5b53813504c1cbe 697 TT = 0x06000000000000007365727665720000000000000000410000000000000004f 698 88fb71c99bfffaea370966b7eb99cd4be0ff1a7d335caac4211c4afd855e2e15a873b2 699 98503ad8ba1d9cbb9a392d2ba309b48bfd7879aefd0f2cea6009763b04100000000000 700 000040c269d6be017dccb15182ac6bfcd9e2a14de019dd587eaf4bdfd353f031101e7c 701 ca177f8eb362a6e83e7d5e729c0732e1b528879c086f39ba0f31a9661bd34db4100000 702 0000000000445ee233b8ecb51ebd6e7da3f307e88a1616bae2166121221fdc0dadb986 703 afaf3ec8a988dc9c626fa3b99f58a7ca7c9b844bb3e8dd9554aafc5b53813504c1cbe2 704 000000000000000626e0cdc7b14c9db3e52a0b1b3a768c98e37852d5db30febe0497b1 705 4eae8c254 706 Hash(TT) = 0x005184ff460da2ce59062c87733c299c3521297d736598fc0a1127600efa1afb 707 Ke = 0x005184ff460da2ce59062c87733c299c 708 Ka = 0x3521297d736598fc0a1127600efa1afb 709 KcA = 0xf3da53604f0aeecea5a33be7bddf6edf 710 KcB = 0x9e3f86848736f159bd92b6e107ec6799 711 A conf = 0xbc9f9bbe99f26d0b2260e6456e05a86196a3307ec6663a18bf6ac825736533b2 712 B conf = 0xc2370e1bf813b086dff0d834e74425a06e6390f48f5411900276dcccc5a297ec 714 spake2: A='', B='' 715 w = 0x7bf46c454b4c1b25799527d896508afd5fc62ef4ec59db1efb49113063d70cca 716 x = 0x8cef65df64bb2d0f83540c53632de911b5b24b3eab6cc74a97609fd659e95473 717 pA = 0x04a65b367a3f613cf9f0654b1b28a1e3a8a40387956c8ba6063e8658563890f4 718 6ca1ef6a676598889fc28de2950ab8120b79a5ef1ea4c9f44bc98f585634b46d66 719 y = 0xd7a66f64074a84652d8d623a92e20c9675c61cb5b4f6a0063e4648a2fdc02d53 720 pB = 0x04589f13218822710d98d8b2123a079041052d9941b9cf88c6617ddb2fcc0494 721 662eea8ba6b64692dc318250030c6af045cb738bc81ba35b043c3dcb46adf6f58d 722 K = 0x041a3c03d51b452537ca2a1fea6110353c6d5ed483c4f0f86f4492ca3f378d40 723 a994b4477f93c64d928edbbcd3e85a7c709b7ea73ee97986ce3d1438e135543772 724 TT = 0x00000000000000000000000000000000410000000000000004a65b367a3f613 725 cf9f0654b1b28a1e3a8a40387956c8ba6063e8658563890f46ca1ef6a676598889fc28 726 de2950ab8120b79a5ef1ea4c9f44bc98f585634b46d66410000000000000004589f132 727 18822710d98d8b2123a079041052d9941b9cf88c6617ddb2fcc0494662eea8ba6b6469 728 2dc318250030c6af045cb738bc81ba35b043c3dcb46adf6f58d4100000000000000041 729 a3c03d51b452537ca2a1fea6110353c6d5ed483c4f0f86f4492ca3f378d40a994b4477 730 f93c64d928edbbcd3e85a7c709b7ea73ee97986ce3d1438e1355437722000000000000 731 0007bf46c454b4c1b25799527d896508afd5fc62ef4ec59db1efb49113063d70cca 732 Hash(TT) = 0xfc6374762ba5cf11f4b2caa08b2cd1b9907ae0e26e8d6234318d91583cd74c86 733 Ke = 0xfc6374762ba5cf11f4b2caa08b2cd1b9 734 Ka = 0x907ae0e26e8d6234318d91583cd74c86 735 KcA = 0x5dbd2f477166b7fb6d61febbd77a5563 736 KcB = 0x7689b4654407a5faeffdc8f18359d8a3 737 A conf = 0xdfb4db8d48ae5a675963ea5e6c19d98d4ea028d8e898dad96ea19a80ade95dca 738 B conf = 0xd0f0609d1613138d354f7e95f19fb556bf52d751947241e8c7118df5ef0ae175 740 Authors' Addresses 742 Watson Ladd 743 Sealance 745 Email: watsonbladd@gmail.com 747 Benjamin Kaduk (editor) 748 Akamai Technologies 750 Email: kaduk@mit.edu