idnits 2.17.1 draft-irtf-cfrg-vrf-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 : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: However, if the EC-VRF uses keys that could be generated adversarially, then the the Verfier MUST first perform the validation procedure ECVRF_validate_key(PK) (specified in Section 5.6) upon receipt of the public key PK as an octet string. If the validation procedure outputs "INVALID", then the public key MUST not be used. Otherwise, the procedure will output a valid public key y, and the EC-VRF with public key y satisfies the "full uniqueness" and "full collision resistance" properties. -- The document date (March 5, 2018) is 2215 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS-186-3' ** Downref: Normative reference to an Informational RFC: RFC 5114 ** Downref: Normative reference to an Informational RFC: RFC 6234 ** Downref: Normative reference to an Informational RFC: RFC 8017 ** Downref: Normative reference to an Informational RFC: RFC 8032 -- Possible downref: Non-RFC (?) normative reference: ref. 'SECG1' == Outdated reference: A later version (-08) exists of draft-vcelak-nsec5-06 Summary: 5 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CFRG S. Goldberg 3 Internet-Draft L. Reyzin 4 Intended status: Standards Track Boston University 5 Expires: September 6, 2018 D. Papadopoulos 6 Hong Kong University of Science and Techology 7 J. Vcelak 8 NS1 9 March 5, 2018 11 Verifiable Random Functions (VRFs) 12 draft-irtf-cfrg-vrf-01 14 Abstract 16 A Verifiable Random Function (VRF) is the public-key version of a 17 keyed cryptographic hash. Only the holder of the private key can 18 compute the hash, but anyone with public key can verify the 19 correctness of the hash. VRFs are useful for preventing enumeration 20 of hash-based data structures. This document specifies several VRF 21 constructions that are secure in the cryptographic random oracle 22 model. One VRF uses RSA and the other VRF uses Eliptic Curves (EC). 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 September 6, 2018. 41 Copyright Notice 43 Copyright (c) 2018 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 48 (https://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.1. Rationale . . . . . . . . . . . . . . . . . . . . . . . . 3 60 1.2. Requirements . . . . . . . . . . . . . . . . . . . . . . 3 61 1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 62 2. VRF Algorithms . . . . . . . . . . . . . . . . . . . . . . . 4 63 3. VRF Security Properties . . . . . . . . . . . . . . . . . . . 4 64 3.1. Full Uniqueness or Trusted Uniqueness . . . . . . . . . . 4 65 3.2. Full Collison Resistance or Trusted Collision Resistance 5 66 3.3. Full Pseudorandomness or Selective Pseudorandomness . . . 5 67 3.4. An additional pseudorandomness property . . . . . . . . . 6 68 4. RSA Full Domain Hash VRF (RSA-FDH-VRF) . . . . . . . . . . . 7 69 4.1. RSA-FDH-VRF Proving . . . . . . . . . . . . . . . . . . . 8 70 4.2. RSA-FDH-VRF Proof To Hash . . . . . . . . . . . . . . . . 8 71 4.3. RSA-FDH-VRF Verifying . . . . . . . . . . . . . . . . . . 9 72 5. Elliptic Curve VRF (EC-VRF) . . . . . . . . . . . . . . . . . 9 73 5.1. EC-VRF Proving . . . . . . . . . . . . . . . . . . . . . 11 74 5.2. EC-VRF Proof To Hash . . . . . . . . . . . . . . . . . . 11 75 5.3. EC-VRF Verifying . . . . . . . . . . . . . . . . . . . . 12 76 5.4. EC-VRF Auxiliary Functions . . . . . . . . . . . . . . . 13 77 5.4.1. EC-VRF Hash To Curve . . . . . . . . . . . . . . . . 13 78 5.4.2. EC-VRF Hash Points . . . . . . . . . . . . . . . . . 14 79 5.4.3. EC-VRF Decode Proof . . . . . . . . . . . . . . . . . 15 80 5.5. EC-VRF Ciphersuites . . . . . . . . . . . . . . . . . . . 15 81 5.6. When the EC-VRF Keys are Untrusted . . . . . . . . . . . 17 82 5.6.1. EC-VRF Validate Key . . . . . . . . . . . . . . . . . 17 83 6. Implementation Status . . . . . . . . . . . . . . . . . . . . 18 84 7. Security Considerations . . . . . . . . . . . . . . . . . . . 18 85 7.1. Key Generation . . . . . . . . . . . . . . . . . . . . . 18 86 7.1.1. Uniqueness and collision resistance with untrusted 87 keys . . . . . . . . . . . . . . . . . . . . . . . . 18 88 7.1.2. Pseudorandomness with untrusted keys . . . . . . . . 19 89 7.2. Selective vs Full Pseudorandomness . . . . . . . . . . . 19 90 7.3. Proper randomness for EC-VRF . . . . . . . . . . . . . . 20 91 7.4. Timing attacks . . . . . . . . . . . . . . . . . . . . . 20 92 8. Change Log . . . . . . . . . . . . . . . . . . . . . . . . . 20 93 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 20 94 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 95 10.1. Normative References . . . . . . . . . . . . . . . . . . 21 96 10.2. Informative References . . . . . . . . . . . . . . . . . 21 98 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 100 1. Introduction 102 1.1. Rationale 104 A Verifiable Random Function (VRF) [MRV99] is the public-key version 105 of a keyed cryptographic hash. Only the holder of the private VRF 106 key can compute the hash, but anyone with corresponding public key 107 can verify the correctness of the hash. 109 A key application of the VRF is to provide privacy against offline 110 enumeration (e.g. dictionary attacks) on data stored in a hash-based 111 data structure. In this application, a Prover holds the VRF secret 112 key and uses the VRF hashing to construct a hash-based data structure 113 on the input data. Due to the nature of the VRF, only the Prover can 114 answer queries about whether or not some data is stored in the data 115 structure. Anyone who knows the public VRF key can verify that the 116 Prover has answered the queries correctly. However no offline 117 inferences (i.e. inferences without querying the Prover) can be made 118 about the data stored in the data strucuture. 120 1.2. Requirements 122 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 123 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 124 document are to be interpreted as described in [RFC2119]. 126 1.3. Terminology 128 The following terminology is used through this document: 130 SK: The private key for the VRF. 132 PK: The public key for the VRF. 134 alpha: The input to be hashed by the VRF. 136 beta: The VRF hash output. 138 pi: The VRF proof. 140 Prover: The Prover holds the private VRF key SK and public VRF key 141 PK. 143 Verifier: The Verifier holds the public VRF key PK. 145 2. VRF Algorithms 147 A VRF comes with a key generation algorithm that generates a public 148 VRF key PK and private VRF key SK. 150 A VRF hashes an input alpha using the private VRF key SK to obtain a 151 VRF hash output beta 153 beta = VRF_hash(SK, alpha) 155 The VRF_hash algorithm is deterministic, in the sense that it always 156 produces the same output beta given a pair of inputs (SK, alpha). 157 The private key SK is also used to construct a proof pi that beta is 158 the correct hash output 160 pi = VRF_prove(SK, alpha) 162 The VRFs defined in this document allow anyone to deterministically 163 obtain the VRF hash output beta directly from the proof value pi as 165 beta = VRF_proof2hash(pi) 167 Notice that this means that 169 VRF_hash(SK, alpha) = VRF_proof2hash(VRF_prove(SK, alpha)) 171 The proof pi allows a Verifier holding the public key PK to verify 172 that beta is the correct VRF hash of input alpha under key PK. Thus, 173 the VRF also comes with an algorithm 175 VRF_verify(PK, alpha, pi) 177 that outputs VALID if beta=VRF_proof2hash(pi) is correct VRF hash of 178 alpha under key PK, and outputs INVALID otherwise. 180 3. VRF Security Properties 182 VRFs are designed to ensure the following security properties. 184 3.1. Full Uniqueness or Trusted Uniqueness 186 Uniqueness means that, for any fixed public VRF key and for any input 187 alpha, there is a unique VRF output beta that can be proved to be 188 valid. Uniqueness must hold even for an adversarial Prover that 189 knows the VRF secret key SK. 191 "Full uniqueness" states that a computationally-bounded adversary 192 cannot choose a VRF public key PK, a VRF input alpha, two different 193 VRF hash outputs beta1 and beta2, and two proofs pi1 and pi2 such 194 that VRF_verify(PK, alpha, pi1) and VRF_verify(PK, alpha, pi2) both 195 output VALID. 197 A slightly weaker security property called "trusted uniquness" 198 sufficies for many applications. Trusted uniqueness is the same as 199 full uniqueness, but it must hold only if the VRF keys PK and SK were 200 generated in a trustworthy manner. In otherwords, uniqueness might 201 not hold if keys were generated in an invalid manner or with bad 202 randomness. 204 3.2. Full Collison Resistance or Trusted Collision Resistance 206 Like any cryprographic hash function, VRFs need to be collision 207 resistant. Collison resistance must hold even for an adversarial 208 Prover that knows the VRF secret key SK. 210 More percisely, "full collision resistance" states that it should be 211 computationally infeasible for an adversary to find two distinct VRF 212 inputs alpha1 and alpha2 that have the same VRF hash beta, even if 213 that adversary knows the secret VRF key SK. 215 For most applications, a slightly weaker security property called 216 "trusted collision resistance" suffices. Trusted collision 217 resistance is the same as collision resistance, but it holds only if 218 PK and SK were generated in a trustworthy manner. 220 3.3. Full Pseudorandomness or Selective Pseudorandomness 222 Pseudorandomness ensures that when an adversarial Verifier sees a VRF 223 hash output beta without its corresponding VRF proof pi, then beta is 224 indistinguishable from a random value. 226 More percisely, suppose the public and private VRF keys (PK, SK) were 227 generated in a trustworthy manner. Pseudorandomness ensures that the 228 VRF hash output beta (without its corresponding VRF proof pi) on any 229 adversarially-chosen "target" VRF input alpha looks indistinguishable 230 from random for any computationally bounded adversary who does not 231 know the private VRF key SK. This holds even if the adversary also 232 gets to choose other VRF inputs alpha' and observe their 233 corresponding VRF hash outputs beta' and proofs pi'. 235 With "full pseudorandomness", the adversary is allowed to choose the 236 "target" VRF input alpha at any time, even after it observes VRF 237 outputs beta' and proofs pi' on a variety of chosen inputs alpha'. 239 "Selective pseudorandomness" is a weaker security property which 240 suffices in many applications. Here, the adversary must choose the 241 target VRF input alpha independently of the public VRF key PK, and 242 before it observes VRF outputs beta' and proofs pi' on inputs alpha' 243 of its choice. 245 It is important to remember that the VRF output beta does not look 246 random to the Prover, or to any other party that knows the private 247 VRF key SK! Such a party can easily distinguish beta from a random 248 value by comparing beta to the result of VRF_hash(SK, alpha). 250 Also, the VRF output beta does not look random to any party that 251 knows valid VRF proof pi corresponding to the VRF input alpha, even 252 if this party does not know the private VRF key SK. Such a party can 253 easily distinguish beta from a random value by checking whether 254 VRF_verify(PK, alpha, pi) returns "VALID" and beta = 255 VRF_proof2hash(pi). 257 Also, the VRF output beta may not look random if VRF key generation 258 was not done in a trustworthy fashion. (For example, if VRF keys 259 were generated with bad randomness.) 261 3.4. An additional pseudorandomness property 263 [TODO: The following property is not needed for applications that use 264 VRFs to prevent enumeration of hash-based data structures. However, 265 we noticed that some other applications of VRF rely on this property. 266 As we have not yet found a formal definition of this property in the 267 literature, we write it down here. ] 269 Pseudorandomness, as defined in Section 3.3, does not hold if the VRF 270 keys were generated adversarially. 272 There is, however, a different type of pseudorandomness that could 273 hold even if the VRF keys are generated adversarially, as long as the 274 VRF input alpha is unpredictable. Suppose the VRF keys are generated 275 by an adversary. Then, a VRF hash output beta should look 276 pseudorandom to the adversary as long as (1) its corresponding VRF 277 hash alpha is chosen randomly and independently of the VRF key, (2) 278 alpha is unknown to the adversary, (3) the corresponding proof pi is 279 unknown to the adversary, and (4) the VRF public key chosen by the 280 adversary is valid. 282 [TODO: It should be possible to get the EC-VRF to satisfy this 283 property, as long as verifiers run an VRF_validate_key() key function 284 upon receipt of VRF public keys. However, we need to work out 285 exactly what properties are needed from the VRF public keys in order 286 for this property to hold. Some additional checks might need to be 287 added to the ECVRF_validate_key() function. Need to work out what 288 are these checks.] 290 4. RSA Full Domain Hash VRF (RSA-FDH-VRF) 292 The RSA Full Domain Hash VRF (RSA-FDH-VRF) is a VRF that satisfies 293 the "trusted uniqueness", "trusted collision resistance", and "full 294 pseudorandomness" properties defined in Section 3. Its security 295 follows from the standard RSA assumption in the random oracle model. 296 Formal security proofs are in [nsec5ecc]. 298 The VRF computes the proof pi as a deterministic RSA signature on 299 input alpha using the RSA Full Domain Hash Algorithm [RFC8017] 300 parametrized with the selected hash algorithm. RSA signature 301 verification is used to verify the correctness of the proof. The VRF 302 hash output beta is simply obtained by hashing the proof pi with the 303 selected hash algorithm. 305 The key pair for RSA-FDH-VRF MUST be generated in a way that it 306 satisfies the conditions specified in Section 3 of [RFC8017]. 308 In this document, the notation from [RFC8017] is used. 310 Parameters used: 312 (n, e) - RSA public key 314 K - RSA private key 316 k - length in octets of the RSA modulus n 318 Fixed options: 320 Hash - cryptographic hash function 322 hLen - output length in octets of hash function Hash 324 Constraints on options: 326 Cryptographic security of Hash is at least as high as the 327 cryptographic security level of the RSA key 329 Primitives used: 331 I2OSP - Coversion of a nonnegative integer to an octet string as 332 defined in Section 4.1 of [RFC8017] 334 OS2IP - Coversion of an octet string to a nonnegative integer as 335 defined in Section 4.2 of [RFC8017] 336 RSASP1 - RSA signature primitive as defined in Section 5.2.1 of 337 [RFC8017] 339 RSAVP1 - RSA verification primitive as defined in Section 5.2.2 of 340 [RFC8017] 342 MGF1 - Mask Generation Function based on a hash function as 343 defined in Section B.2.1 of [RFC8017] 345 4.1. RSA-FDH-VRF Proving 347 RSAFDHVRF_prove(K, alpha) 349 Input: 351 K - RSA private key 353 alpha - VRF hash input, an octet string 355 Output: 357 pi - proof, an octet string of length k 359 Steps: 361 1. EM = MGF1(alpha, k - 1) 363 2. m = OS2IP(EM) 365 3. s = RSASP1(K, m) 367 4. pi = I2OSP(s, k) 369 5. Output pi 371 4.2. RSA-FDH-VRF Proof To Hash 373 RSAFDHVRF_proof2hash(pi) 375 Input: 377 pi - proof, an octet string of length k 379 Output: 381 beta - VRF hash output, an octet string of length hLen 383 Steps: 385 1. beta = Hash(pi) 387 2. Output beta 389 4.3. RSA-FDH-VRF Verifying 391 RSAFDHVRF_verify((n, e), alpha, pi) 393 Input: 395 (n, e) - RSA public key 397 alpha - VRF hash input, an octet string 399 pi - proof to be verified, an octet string of length n 401 Output: 403 "VALID" or "INVALID" 405 Steps: 407 1. s = OS2IP(pi) 409 2. m = RSAVP1((n, e), s) 411 3. EM = I2OSP(m, k - 1) 413 4. EM' = MGF1(alpha, k - 1) 415 5. If EM and EM' are equal, output "VALID"; else output "INVALID". 417 5. Elliptic Curve VRF (EC-VRF) 419 The Elliptic Curve Verifiable Random Function (EC-VRF) is a VRF that 420 satisfies the trusted uniqueness, trusted collision resistance, and 421 full pseudorandomness properties defined in Section 3. The security 422 of this VRF follows from the decisional Diffie-Hellman (DDH) 423 assumption in the random oracle model. Formal security proofs are in 424 [nsec5ecc]. 426 Fixed options: 428 F - finite field 430 2n - length, in octets, of a field element in F 432 E - elliptic curve (EC) defined over F 433 m - length, in octets, of an EC point encoded as an octet string 435 G - subgroup of E of large prime order 437 q - prime order of group G 439 cofactor - number of points on E divided by q 441 g - generator of group G 443 Hash - cryptographic hash function 445 hLen - output length in octets of Hash 447 Constraints on options: 449 Field elements in F have bit lengths divisible by 16 451 hLen is equal to 2n 453 Parameters used: 455 y = g^x - VRF public key, an EC point 457 x - VRF private key, an integer where 0 < x < q 459 Notation and primitives used: 461 p^k - when p is an EC point: point multiplication, i.e. k 462 repetitions of group operation on EC point p. when p is an 463 integer: exponentiation 465 || - octet string concatenation 467 I2OSP - nonnegative integer conversion to octet string as defined 468 in Section 4.1 of [RFC8017] 470 OS2IP - Coversion of an octet string to a nonnegative integer as 471 defined in Section 4.2 of [RFC8017] 473 EC2OSP - conversion of EC point to an m-octet string as specified 474 in Section 5.5 476 OS2ECP - conversion of an m-octet string to EC point as specified 477 in Section 5.5. OS2ECP returns INVALID if the octet string does 478 not convert to a valid EC point. 480 RS2ECP - conversion of a random 2n-octet string to an EC point as 481 specified in Section 5.5 483 5.1. EC-VRF Proving 485 Note: this function is made more efficient by taking in the public 486 VRF key y, as well as the private VRF key x. 488 ECVRF_prove(y, x, alpha) 490 Input: 492 y - public key, an EC point 494 x - private key, an integer 496 alpha - VRF input, an octet string 498 Output: 500 pi - VRF proof, octet string of length m+3n 502 Steps: 504 1. h = ECVRF_hash_to_curve(y, alpha) 506 2. gamma = h^x 508 3. choose a random integer nonce k from [0, q-1] 510 4. c = ECVRF_hash_points(g, h, y, gamma, g^k, h^k) 512 5. s = k - c*x mod q (where * denotes integer multiplication) 514 6. pi = EC2OSP(gamma) || I2OSP(c, n) || I2OSP(s, 2n) 516 7. Output pi 518 5.2. EC-VRF Proof To Hash 520 ECVRF_proof2hash(pi) 522 Input: 524 pi - VRF proof, octet string of length m+3n 526 Output: 528 "INVALID", or 530 beta - VRF hash output, octet string of length 2n 532 Steps: 534 1. D = ECVRF_decode_proof(pi) 536 2. If D is "INVALID", output "INVALID" and stop 538 3. (gamma, c, s) = D 540 4. beta = Hash(EC2OSP(gamma^cofactor)) 542 5. Output beta 544 5.3. EC-VRF Verifying 546 ECVRF_verify(y, pi, alpha) 548 Input: 550 y - public key, an EC point 552 pi - VRF proof, octet string of length 5n+1 554 alpha - VRF input, octet string 556 Output: 558 "VALID" or "INVALID" 560 Steps: 562 1. D = ECVRF_decode_proof(pi) 564 2. If D is "INVALID", output "INVALID" and stop 566 3. (gamma, c, s) = D 568 4. u = y^c * g^s (where * denotes EC point addition, i.e. a group 569 operation on two EC points) 571 5. h = ECVRF_hash_to_curve(y, alpha) 573 6. v = gamma^c * h^s (where * denotes EC point addition) 575 7. c' = ECVRF_hash_points(g, h, y, gamma, u, v) 576 8. If c and c' are equal, output "VALID"; else output "INVALID" 578 [TODO: We could hash alpha instead of gamma. Doing so costs more 579 because alpha is longer, but may help salvage some security if 580 ECVRF_hash_to_curve is broken and not collision-resistant. Need to 581 analyze exact security preserved and decide if the tradeoff is worth 582 it.] 584 5.4. EC-VRF Auxiliary Functions 586 [TODO: analyze whether domain separation for hash functions used here 587 matters and if so how to ensure we have it.] 589 5.4.1. EC-VRF Hash To Curve 591 The ECVRF_hash_to_curve algorithm takes in an octet string alpha and 592 converts it to h, an EC point in G. 594 5.4.1.1. ECVRF_hash_to_curve1 596 The following ECVRF_hash_to_curve1(y, alpha) algorithm implements 597 ECVRF_hash_to_curve in a simple and generic way that works for any 598 elliptic curve. 600 The running time of this algorithm depends on alpha. For the 601 ciphersuites specified in Section 5.5, this algorithm is expected to 602 find a valid curve point after approximately two attempts (i.e., when 603 ctr=1) on average. See also [Icart09]. 605 However, because the running time of algorithm depends on alpha, this 606 algorithm SHOULD be avoided in applications where it is important 607 that the VRF input alpha remain secret. 609 ECVRF_hash_to_curve1(y, alpha) 611 Input: 613 alpha - value to be hashed, an octet string 615 y - public key, an EC point 617 Output: 619 h - hashed value, a finite EC point in G 621 Steps: 623 1. ctr = 0 624 2. pk = EC2OSP(y) 626 3. h = "INVALID" 628 4. While h is "INVALID" or h is EC point at infinity: 630 A. CTR = I2OSP(ctr, 4) 632 B. ctr = ctr + 1 634 C. attempted_hash = Hash(pk || alpha || CTR) 636 D. h = RS2ECP(attempted_hash) 638 E. If h is not "INVALID" and cofactor > 1, set h = h^cofactor 640 5. Output h 642 5.4.1.2. ECVRF_hash_to_curve2 644 For applications where VRF input alpha must be kept secret, the 645 following ECVRF_hash_to_curve algorithm MAY be used to used as 646 generic way to hash an octet string onto any elliptic curve. 648 [TODO: We should look into specifying the generic deterministic time 649 hash_to_curve algorithm from [Icart09]. We should also consider 650 Shallue-Woestijne-Ulas algorithm from [BCIMRT10] as well as Elligator 651 (for Ed25519) and Elligator Squared for more general curves. Some of 652 these options are summarized in an upcoming draft [SW18].] 654 5.4.2. EC-VRF Hash Points 656 ECVRF_hash_points(p_1, p_2, ..., p_j) 658 Input: 660 p_i - EC point in G 662 Output: 664 h - hash value, integer between 0 and 2^(8n)-1 666 Steps: 668 1. P = empty octet string 670 2. for p_i in [p_1, p_2, ... p_j]: 671 P = P || EC2OSP(p_i) 673 3. h1 = Hash(P) 675 4. h2 = first n octets of h1 677 5. h = OS2IP(h2) 679 6. Output h 681 5.4.3. EC-VRF Decode Proof 683 ECVRF_decode_proof(pi) 685 Input: 687 pi - VRF proof, octet string (m+3n octets) 689 Output: 691 "INVALID", or 693 gamma - EC point 695 c - integer between 0 and 2^(8n)-1 697 s - integer between 0 and 2^(16n)-1 699 Steps: 701 1. let gamma', c', s' be pi split after m-th and m+n-th octet 703 2. gamma = OS2ECP(gamma') 705 3. if gamma = "INVALID" output "INVALID" and stop. 707 4. c = OS2IP(c') 709 5. s = OS2IP(s') 711 6. Output gamma, c, and s 713 5.5. EC-VRF Ciphersuites 715 This document defines EC-VRF-P256-SHA256 as follows: 717 o The EC group G is the NIST-P256 elliptic curve, with curve 718 parameters as specified in [FIPS-186-3] (Section D.1.2.3) and 719 [RFC5114] (Section 2.6). For this group, 2n = 32 and cofactor = 720 1. 722 o The key pair generation primitive is specified in Section 3.2.1 of 723 [SECG1]. 725 o EC2OSP is specified in Section 2.3.3 of [SECG1] with point 726 compression on. This implies m = 2n + 1 = 33. 728 o OS2ECP is specified in Section 2.3.4 of [SECG1]. 730 o RS2ECP(h) = OS2ECP(0x02 || h). The input h is a 32-octet string 731 and the output is either an EC point or "INVALID". 733 o The hash function Hash is SHA-256 as specified in [RFC6234]. 735 o The ECVRF_hash_to_curve function is as specified in 736 Section 5.4.1.1. 738 This document defines EC-VRF-ED25519-SHA256 as follows: 740 o The EC group G is the Ed25519 elliptic curve with parameters 741 defined in Table 1 of [RFC8032]. For this group, 2n = 32 and 742 cofactor = 8. 744 o The key pair generation primitive is specified in Section 5.1.5 of 745 [RFC8032] 747 o EC2OSP is specified in Section 5.1.2 of [RFC8032]. This implies m 748 = 2n = 32. 750 o OS2ECP is specified in Section 5.1.3 of [RFC8032]. 752 o RS2ECP is equivalent to OS2ECP. 754 o The hash function Hash is SHA-256 as specified in [RFC6234]. 756 o The ECVRF_hash_to_curve function is as specified in 757 Section 5.4.1.1. 759 [TODO: Should we add an EC-VRF-ED25519-SHA256-Elligator ciphersuite 760 where the Elligator hash function is used for ECVRF_hash-to-curve? 761 Should we add Elligator-Squared? We may want to consider options in 762 the upcoming draft [SW18].] 764 [TODO: Add an Ed448 ciphersuite? This is probably not needed...] 766 [NOTE: In the unlikely case that future versions of this spec use a 767 elliptic curve group G that does not also come with a specification 768 of the group generator g, then we can still have full uniqueness and 769 full collision resistance by adding an check to 770 ECVRF_validate_key(PK) that ensures that g is a point on the elliptic 771 curve and g^cofactor is not the EC point at infinity.] 773 5.6. When the EC-VRF Keys are Untrusted 775 The EC-VRF as specified above is a VRF that satisfies the "trusted 776 uniqueness", "trusted collision resistance", and "full 777 pseudorandomness" properties defined in Section 3. If the elliptic 778 curve parameters (including the generator g) are trusted, but the VRF 779 public key PK is not trusted, this VRF can be modified to 780 additionally satisfy "full uniqueness", and "full collision 781 resistance". This is done by additionally requiring the Verifier to 782 perform the following validation procedure upon receipt of the public 783 VRF key. 785 The Verifier MUST perform this validation procedure when the entity 786 that generated the public VRF key is untrusted. The public key MUST 787 NOT be used if this procedure returns "INVALID". Note well that this 788 procedure is not sufficient if the elliptic curve E or if g, the 789 generator of group G, is untrusted. 791 This procedure supposes that the public key provided to the Verifier 792 is an octet string. The procedure returns "INVALID" if the public 793 key in invalid. Otherwise, it returns y, the public key as an EC 794 point. 796 5.6.1. EC-VRF Validate Key 798 ECVRF_validate_key(PK) 800 Input: 802 PK - public key, an octet string 804 Output: 806 "INVALID", or 808 y - public key, an EC point 810 Steps: 812 1. y = OS2ECP(PK) 814 2. If y is "INVALID", output "INVALID" and stop 816 3. If y^cofactor is the EC point at infinty, output "INVALID" and 817 stop 819 4. Output y 821 6. Implementation Status 823 An implementation of the RSA-FDH-VRF (SHA-256) and EC-VRF-P256-SHA256 824 was first developed as a part of the NSEC5 project [I-D.vcelak-nsec5] 825 and is available at . The EC- 826 VRF implementation may be out of date as this spec has evolved. 828 The Key Transparency project at Google uses a VRF implemention that 829 is similar to the EC-VRF-P256-SHA256, with a few minor changes 830 including the use of SHA-512 instead of SHA-256. Its implementation 831 is available 832 835 An implementation by Yahoo! similar to the EC-VRF is available at 836 . 838 An implementation similar to EC-VRF is available as part of the 839 CONIKS implementation in Golang at . 842 Open Whisper Systems also uses a VRF very similar to EC-VRF- 843 ED25519-SHA512-Elligator, called VXEdDSA, and specified here: 844 846 7. Security Considerations 848 7.1. Key Generation 850 Applications that use the VRFs defined in this document MUST ensure 851 that that the VRF key is generated correctly, using good randomness. 853 7.1.1. Uniqueness and collision resistance with untrusted keys 855 The EC-VRF as specified in Section 5.1-Section 5.5 statisfies the 856 "trusted uniqueness" and "trusted collision resistance" properties as 857 long as the VRF keys are generated correctly, with good randomness. 858 If the Verifier trusts the VRF keys are generated correctly, it MAY 859 use the public key y as is. 861 However, if the EC-VRF uses keys that could be generated 862 adversarially, then the the Verfier MUST first perform the validation 863 procedure ECVRF_validate_key(PK) (specified in Section 5.6) upon 864 receipt of the public key PK as an octet string. If the validation 865 procedure outputs "INVALID", then the public key MUST not be used. 866 Otherwise, the procedure will output a valid public key y, and the 867 EC-VRF with public key y satisfies the "full uniqueness" and "full 868 collision resistance" properties. 870 The RSA-FDH-VRF statisfies the "trusted uniqueness" and "trusted 871 collision resistance" properties as long as the VRF keys are 872 generated correctly, with good randomness. These properties may not 873 hold if the keys are generated adversarially (e.g., if RSA is not 874 permutation). Meanwhile, the "full uniqueness" and "full collision 875 resistance" are properties that hold even if VRF keys are generated 876 by an adversary. The RSA-FDH-VRF defined in this document does not 877 have these properties. However, if adversarial key generation is a 878 concern, the RSA-FDH-VRF may be modifed to have these properties by 879 adding additional cryptographic checks that its public key has the 880 right form. These modifications are left for future specification. 882 7.1.2. Pseudorandomness with untrusted keys 884 Without good randomness, the "pseudorandomness" properties of the VRF 885 may not hold. Note that it is not possible to guarantee 886 pseudorandomness in the face of adversarially generated VRF keys. 887 This is because an adversary can always use bad randomness to 888 generate the VRF keys, and thus, the VRF output may not be 889 pseudorandom. 891 7.2. Selective vs Full Pseudorandomness 893 [nsec5ecc] presents cryptographic reductions to an underlying hard 894 problem (e.g. Decisional Diffie Hellman for the EC-VRF, or the 895 standard RSA assumption for RSA-FDH-VRF) that prove the VRFs 896 specificied in this document possess full pseudorandomness as well as 897 selective pseudorandomness. However, the cryptographic reductions 898 are tighter for selective pseudorandomness than for full 899 pseudorandomness. This means the the VRFs have quantitavely stronger 900 security guarentees for selective pseudorandomness. 902 Applications that are concerned about tightness of cryptographic 903 reductions therefore have two options. 905 o They may choose to ensure that selective pseudorandomness is 906 sufficient for the application. That is, that pseudorandomness of 907 outputs matters only for inputs that are chosen independently of 908 the VRF key. 910 o If full pseudorandomness is required for the application, the 911 application may increase security parameters to make up for the 912 loose security reduction. For RSA-FDH-VRF, this means increasing 913 the RSA key length. For EC-VRF, this means increasing the 914 cryptographic strength of the EC group G. For both RSA-FDH-VRF 915 and EC-VRF the cryptographic strength of the hash function Hash 916 may also potentially need to be increased. 918 7.3. Proper randomness for EC-VRF 920 Applications that use the EC-VRF defined in this document MUST ensure 921 that the random nonce k used in the ECVRF_prove algorithm is chosen 922 with proper randomness. Otherwise, an adversary may be able to 923 recover the private VRF key x (and thus break pseudorandomness of the 924 VRF) after observing several valid VRF proofs pi. 926 [TODO: In the next version of the draft we should add a specification 927 for nonce generation.] 929 7.4. Timing attacks 931 The EC-VRF_hash_to_curve algorithm defined in Section 5.4.1.1 SHOULD 932 NOT be used in applications where the VRF input alpha is secret and 933 is hashed by the VRF on-the-fly. This is because the EC- 934 VRF_hash_to_curve algorithm's running time depends on the VRF input 935 alpha, and thus creates a timing channel that can be used to learn 936 information about alpha. That said, for most inputs the amount of 937 information obtained from such a timing attack is likely to be small 938 (1 bit, on average), since the algorithm is expected to find a valid 939 curve point after only two attempts. However, there might be inputs 940 which cause the algorithm to make many attempts before it finds a 941 valid curve point; for such inputs, the information leaked in a 942 timing attack will be more than 1 bit. 944 8. Change Log 946 Note to RFC Editor: if this document does not obsolete an existing 947 RFC, please remove this appendix before publication as an RFC. 949 00 - Forked this document from draft-goldbe-vrf-01. 951 01 - Minor updates, mostly highlighting TODO items. 953 9. Contributors 955 This document also would not be possible without the work of Moni 956 Naor (Weizmann Institute), Sachin Vasant (Cisco Systems), and Asaf 957 Ziv (Facebook). Shumon Huque (Salesforce) and David C. Lawerence 958 (Akamai) provided valuable input to this draft. 960 10. References 962 10.1. Normative References 964 [FIPS-186-3] 965 National Institute for Standards and Technology, "Digital 966 Signature Standard (DSS)", FIPS PUB 186-3, June 2009. 968 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 969 Requirement Levels", BCP 14, RFC 2119, 970 DOI 10.17487/RFC2119, March 1997, 971 . 973 [RFC5114] Lepinski, M. and S. Kent, "Additional Diffie-Hellman 974 Groups for Use with IETF Standards", RFC 5114, 975 DOI 10.17487/RFC5114, January 2008, 976 . 978 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 979 (SHA and SHA-based HMAC and HKDF)", RFC 6234, 980 DOI 10.17487/RFC6234, May 2011, 981 . 983 [RFC8017] Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch, 984 "PKCS #1: RSA Cryptography Specifications Version 2.2", 985 RFC 8017, DOI 10.17487/RFC8017, November 2016, 986 . 988 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 989 Signature Algorithm (EdDSA)", RFC 8032, 990 DOI 10.17487/RFC8032, January 2017, 991 . 993 [SECG1] Standards for Efficient Cryptography Group (SECG), "SEC 1: 994 Elliptic Curve Cryptography", Version 2.0, May 2009, 995 . 997 10.2. Informative References 999 [BCIMRT10] 1000 Brier, E., Coron, J., Icart, T., Madore, D., Randriam, H., 1001 and M. Tibouchi, "Efficient Indifferentiable Hashing into 1002 Ordinary Elliptic Curves", in CRYPTO, 2010. 1004 [I-D.vcelak-nsec5] 1005 Vcelak, J., Goldberg, S., Papadopoulos, D., Huque, S., and 1006 D. Lawrence, "NSEC5, DNSSEC Authenticated Denial of 1007 Existence", draft-vcelak-nsec5-06 (work in progress), 1008 January 2018. 1010 [Icart09] Icart, T., "How to Hash into Elliptic Curves", in CRYPTO, 1011 2009. 1013 [MRV99] Michali, S., Rabin, M., and S. Vadhan, "Verifiable Random 1014 Functions", in FOCS, 1999. 1016 [nsec5ecc] 1017 Papadopoulos, D., Wessels, D., Huque, S., Vcelak, J., 1018 Naor, M., Reyzin, L., and S. Goldberg, "Making NSEC5 1019 Practical for DNSSEC", in ePrint Cryptology Archive 1020 2017/099, February 2017, 1021 . 1023 [SW18] Sullivan, E. and C. Wood, "Hashing to Elliptic Curves", 1024 2018. 1026 Authors' Addresses 1028 Sharon Goldberg 1029 Boston University 1030 111 Cummington St, MCS135 1031 Boston, MA 02215 1032 USA 1034 EMail: goldbe@cs.bu.edu 1036 Leonid Reyzin 1037 Boston University 1038 111 Cummington St, MCS135 1039 Boston, MA 02215 1040 USA 1042 EMail: reyzin@bu.edu 1044 Dimitrios Papadopoulos 1045 Hong Kong University of Science and Techology 1046 Clearwater Bay 1047 Hong Kong 1049 EMail: dipapado@cse.ust.hkbu.edu 1050 Jan Vcelak 1051 NS1 1052 16 Beaver St 1053 New York, NY 10004 1054 USA 1056 EMail: jvcelak@ns1.com