idnits 2.17.1 draft-goldbe-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 (June 30, 2017) is 2485 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-04 Summary: 5 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group S. Goldberg 3 Internet-Draft Boston University 4 Intended status: Standards Track D. Papadopoulos 5 Expires: January 1, 2018 University of Maryland 6 J. Vcelak 7 NS1 8 June 30, 2017 10 Verifiable Random Functions (VRFs) 11 draft-goldbe-vrf-01 13 Abstract 15 A Verifiable Random Function (VRF) is the public-key version of a 16 keyed cryptographic hash. Only the holder of the private key can 17 compute the hash, but anyone with public key can verify the 18 correctness of the hash. VRFs are useful for preventing enumeration 19 of hash-based data structures. This document specifies several VRF 20 constructions that are secure in the cryptographic random oracle 21 model. One VRF uses RSA and the other VRF uses Eliptic Curves (EC). 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at http://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on January 1, 2018. 40 Copyright Notice 42 Copyright (c) 2017 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (http://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 58 1.1. Rationale . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.2. Requirements . . . . . . . . . . . . . . . . . . . . . . 3 60 1.3. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. VRF Algorithms . . . . . . . . . . . . . . . . . . . . . . . 4 62 3. VRF Security Properties . . . . . . . . . . . . . . . . . . . 4 63 3.1. Full Uniqueness or Trusted Uniqueness . . . . . . . . . . 4 64 3.2. Full Collison Resistance or Trusted Collision Resistance 5 65 3.3. Full Pseudorandomness or Selective Pseudorandomness . . . 5 66 3.4. An additional pseudorandomness property . . . . . . . . . 6 67 4. RSA Full Domain Hash VRF (RSA-FDH-VRF) . . . . . . . . . . . 7 68 4.1. RSA-FDH-VRF Proving . . . . . . . . . . . . . . . . . . . 8 69 4.2. RSA-FDH-VRF Proof To Hash . . . . . . . . . . . . . . . . 8 70 4.3. RSA-FDH-VRF Verifying . . . . . . . . . . . . . . . . . . 9 71 5. Elliptic Curve VRF (EC-VRF) . . . . . . . . . . . . . . . . . 9 72 5.1. EC-VRF Proving . . . . . . . . . . . . . . . . . . . . . 11 73 5.2. EC-VRF Proof To Hash . . . . . . . . . . . . . . . . . . 11 74 5.3. EC-VRF Verifying . . . . . . . . . . . . . . . . . . . . 12 75 5.4. EC-VRF Auxiliary Functions . . . . . . . . . . . . . . . 13 76 5.4.1. EC-VRF Hash To Curve . . . . . . . . . . . . . . . . 13 77 5.4.2. EC-VRF Hash Points . . . . . . . . . . . . . . . . . 14 78 5.4.3. EC-VRF Decode Proof . . . . . . . . . . . . . . . . . 15 79 5.5. EC-VRF Ciphersuites . . . . . . . . . . . . . . . . . . . 15 80 5.6. When the EC-VRF Keys are Untrusted . . . . . . . . . . . 16 81 5.6.1. EC-VRF Validate Key . . . . . . . . . . . . . . . . . 17 82 6. Implementation Status . . . . . . . . . . . . . . . . . . . . 17 83 7. Security Considerations . . . . . . . . . . . . . . . . . . . 18 84 7.1. Key Generation . . . . . . . . . . . . . . . . . . . . . 18 85 7.1.1. Uniqueness and collision resistance with untrusted 86 keys . . . . . . . . . . . . . . . . . . . . . . . . 18 87 7.1.2. Pseudorandomness with untrusted keys . . . . . . . . 19 88 7.2. Selective vs Full Pseudorandomness . . . . . . . . . . . 19 89 7.3. Proper randomness for EC-VRF . . . . . . . . . . . . . . 19 90 7.4. Timing attacks . . . . . . . . . . . . . . . . . . . . . 20 91 8. Change Log . . . . . . . . . . . . . . . . . . . . . . . . . 20 92 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 20 93 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 94 10.1. Normative References . . . . . . . . . . . . . . . . . . 21 95 10.2. Informative References . . . . . . . . . . . . . . . . . 21 96 Appendix A. Open Issues . . . . . . . . . . . . . . . . . . . . 23 97 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 23 99 1. Introduction 101 1.1. Rationale 103 A Verifiable Random Function (VRF) [MRV99] is the public-key version 104 of a keyed cryptographic hash. Only the holder of the private VRF 105 key can compute the hash, but anyone with corresponding public key 106 can verify the correctness of the hash. 108 A key application of the VRF is to provide privacy against offline 109 enumeration (e.g. dictionary attacks) on data stored in a hash-based 110 data structure. In this application, a Prover holds the VRF secret 111 key and uses the VRF hashing to construct a hash-based data structure 112 on the input data. Due to the nature of the VRF, only the Prover can 113 answer queries about whether or not some data is stored in the data 114 structure. Anyone who knows the public VRF key can verify that the 115 Prover has answered the queries correctly. However no offline 116 inferences (i.e. inferences without querying the Prover) can be made 117 about the data stored in the data strucuture. 119 1.2. Requirements 121 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 122 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 123 document are to be interpreted as described in [RFC2119]. 125 1.3. Terminology 127 The following terminology is used through this document: 129 SK: The private key for the VRF. 131 PK: The public key for the VRF. 133 alpha: The input to be hashed by the VRF. 135 beta: The VRF hash output. 137 pi: The VRF proof. 139 Prover: The Prover holds the private VRF key SK and public VRF key 140 PK. 142 Verifier: The Verifier holds the public VRF key PK. 144 2. VRF Algorithms 146 A VRF comes with a key generation algorithm that generates a public 147 VRF key PK and private VRF key SK. 149 A VRF hashes an input alpha using the private VRF key SK to obtain a 150 VRF hash output beta 152 beta = VRF_hash(SK, alpha) 154 The VRF_hash algorithm is deterministic, in the sense that it always 155 produces the same output beta given a pair of inputs (SK, alpha). 156 The private key SK is also used to construct a proof pi that beta is 157 the correct hash output 159 pi = VRF_prove(SK, alpha) 161 The VRFs defined in this document allow anyone to deterministically 162 obtain the VRF hash output beta directly from the proof value pi as 164 beta = VRF_proof2hash(pi) 166 Notice that this means that 168 VRF_hash(SK, alpha) = VRF_proof2hash(VRF_prove(SK, alpha)) 170 The proof pi allows a Verifier holding the public key PK to verify 171 that beta is the correct VRF hash of input alpha under key PK. Thus, 172 the VRF also comes with an algorithm 174 VRF_verify(PK, alpha, pi) 176 that outputs VALID if beta=VRF_proof2hash(pi) is correct VRF hash of 177 alpha under key PK, and outputs INVALID otherwise. 179 3. VRF Security Properties 181 VRFs are designed to ensure the following security properties. 183 3.1. Full Uniqueness or Trusted Uniqueness 185 Uniqueness means that, for any fixed public VRF key and for any input 186 alpha, there is a unique VRF output beta that can be proved to be 187 valid. Uniqueness must hold even for an adversarial Prover that 188 knows the VRF secret key SK. 190 "Full uniqueness" states that a computationally-bounded adversary 191 cannot choose a VRF public key PK, a VRF input alpha, two different 192 VRF hash outputs beta1 and beta2, and two proofs pi1 and pi2 such 193 that VRF_verify(PK, alpha, pi1) and VRF_verify(PK, alpha, pi2) both 194 output VALID. 196 A slightly weaker security property called "trusted uniquness" 197 sufficies for many applications. Trusted uniqueness is the same as 198 full uniqueness, but it must hold only if the VRF keys PK and SK were 199 generated in a trustworthy manner. In otherwords, uniqueness might 200 not hold if keys were generated in an invalid manner or with bad 201 randomness. 203 3.2. Full Collison Resistance or Trusted Collision Resistance 205 Like any cryprographic hash function, VRFs need to be collision 206 resistant. Collison resistance must hold even for an adversarial 207 Prover that knows the VRF secret key SK. 209 More percisely, "full collision resistance" states that it should be 210 computationally infeasible for an adversary to find two distinct VRF 211 inputs alpha1 and alpha2 that have the same VRF hash beta, even if 212 that adversary knows the secret VRF key SK. 214 For most applications, a slightly weaker security property called 215 "trusted collision resistance" suffices. Trusted collision 216 resistance is the same as collision resistance, but it holds only if 217 PK and SK were generated in a trustworthy manner. 219 3.3. Full Pseudorandomness or Selective Pseudorandomness 221 Pseudorandomness ensures that when an adversarial Verifier sees a VRF 222 hash output beta without its corresponding VRF proof pi, then beta is 223 indistinguishable from a random value. 225 More percisely, suppose the public and private VRF keys (PK, SK) were 226 generated in a trustworthy manner. Pseudorandomness ensures that the 227 VRF hash output beta (without its corresponding VRF proof pi) on any 228 adversarially-chosen "target" VRF input alpha looks indistinguishable 229 from random for any computationally bounded adversary who does not 230 know the private VRF key SK. This holds even if the adversary also 231 gets to choose other VRF inputs alpha' and observe their 232 corresponding VRF hash outputs beta' and proofs pi'. 234 With "full pseudorandomness", the adversary is allowed to choose the 235 "target" VRF input alpha at any time, even after it observes VRF 236 outputs beta' and proofs pi' on a variety of chosen inputs alpha'. 238 "Selective pseudorandomness" is a weaker security property which 239 suffices in many applications. Here, the adversary must choose the 240 target VRF input alpha independently of the public VRF key PK, and 241 before it observes VRF outputs beta' and proofs pi' on inputs alpha' 242 of its choice. 244 It is important to remember that the VRF output beta does not look 245 random to the Prover, or to any other party that knows the private 246 VRF key SK! Such a party can easily distinguish beta from a random 247 value by comparing beta to the result of VRF_hash(SK, alpha). 249 Also, the VRF output beta does not look random to any party that 250 knows valid VRF proof pi corresponding to the VRF input alpha, even 251 if this party does not know the private VRF key SK. Such a party can 252 easily distinguish beta from a random value by checking whether 253 VRF_verify(PK, alpha, pi) returns "VALID" and beta = 254 VRF_proof2hash(pi). 256 Also, the VRF output beta may not look random if VRF key generation 257 was not done in a trustworthy fashion. (For example, if VRF keys 258 were generated with bad randomness.) 260 3.4. An additional pseudorandomness property 262 [TODO: The following property is not needed for applications that use 263 VRFs to prevent enumeration of hash-based data structures. However, 264 we noticed that some other applications of VRF rely on this property. 265 As we have not yet found a formal definition of this property in the 266 literature, we write it down here. ] 268 Pseudorandomness, as defined in Section 3.3, does not hold if the VRF 269 keys were generated adversarially. 271 There is, however, a different type of pseudorandomness that could 272 hold even if the VRF keys are generated adversarially, as long as the 273 VRF input alpha is unpredictable. Suppose the VRF keys are generated 274 by an adversary. Then, a VRF hash output beta should look 275 pseudorandom to the adversary as long as (1) its corresponding VRF 276 hash alpha is chosen randomly and independently of the VRF key, (2) 277 alpha is unknown to the adversary, (3) the corresponding proof pi is 278 unknown to the adversary, and (4) the VRF public key chosen by the 279 adversary is valid. 281 [TODO: It should be possible to get the EC-VRF to satisfy this 282 property, as long as verifiers run an VRF_validate_key() key function 283 upon receipt of VRF public keys. However, we need to work out 284 exactly what properties are needed from the VRF public keys in order 285 for this property to hold. Some additional checks might need to be 286 added to the ECVRF_validate_key() function. Need to work out what 287 are these checks.] 289 4. RSA Full Domain Hash VRF (RSA-FDH-VRF) 291 The RSA Full Domain Hash VRF (RSA-FDH-VRF) is a VRF that satisfies 292 the "trusted uniqueness", "trusted collision resistance", and "full 293 pseudorandomness" properties defined in Section 3. Its security 294 follows from the standard RSA assumption in the random oracle model. 295 Formal security proofs are in [nsec5ecc]. 297 The VRF computes the proof pi as a deterministic RSA signature on 298 input alpha using the RSA Full Domain Hash Algorithm [RFC8017] 299 parametrized with the selected hash algorithm. RSA signature 300 verification is used to verify the correctness of the proof. The VRF 301 hash output beta is simply obtained by hashing the proof pi with the 302 selected hash algorithm. 304 The key pair for RSA-FDH-VRF MUST be generated in a way that it 305 satisfies the conditions specified in Section 3 of [RFC8017]. 307 In this document, the notation from [RFC8017] is used. 309 Parameters used: 311 (n, e) - RSA public key 313 K - RSA private key 315 k - length in octets of the RSA modulus n 317 Fixed options: 319 Hash - cryptographic hash function 321 hLen - output length in octets of hash function Hash 323 Constraints on options: 325 Cryptographic security of Hash is at least as high as the 326 cryptographic security level of the RSA key 328 Primitives used: 330 I2OSP - Coversion of a nonnegative integer to an octet string as 331 defined in Section 4.1 of [RFC8017] 333 OS2IP - Coversion of an octet string to a nonnegative integer as 334 defined in Section 4.2 of [RFC8017] 335 RSASP1 - RSA signature primitive as defined in Section 5.2.1 of 336 [RFC8017] 338 RSAVP1 - RSA verification primitive as defined in Section 5.2.2 of 339 [RFC8017] 341 MGF1 - Mask Generation Function based on a hash function as 342 defined in Section B.2.1 of [RFC8017] 344 4.1. RSA-FDH-VRF Proving 346 RSAFDHVRF_prove(K, alpha) 348 Input: 350 K - RSA private key 352 alpha - VRF hash input, an octet string 354 Output: 356 pi - proof, an octet string of length k 358 Steps: 360 1. EM = MGF1(alpha, k - 1) 362 2. m = OS2IP(EM) 364 3. s = RSASP1(K, m) 366 4. pi = I2OSP(s, k) 368 5. Output pi 370 4.2. RSA-FDH-VRF Proof To Hash 372 RSAFDHVRF_proof2hash(pi) 374 Input: 376 pi - proof, an octet string of length k 378 Output: 380 beta - VRF hash output, an octet string of length hLen 382 Steps: 384 1. beta = Hash(pi) 386 2. Output beta 388 4.3. RSA-FDH-VRF Verifying 390 RSAFDHVRF_verify((n, e), alpha, pi) 392 Input: 394 (n, e) - RSA public key 396 alpha - VRF hash input, an octet string 398 pi - proof to be verified, an octet string of length n 400 Output: 402 "VALID" or "INVALID" 404 Steps: 406 1. s = OS2IP(pi) 408 2. m = RSAVP1((n, e), s) 410 3. EM = I2OSP(m, k - 1) 412 4. EM' = MGF1(alpha, k - 1) 414 5. If EM and EM' are equal, output "VALID"; else output "INVALID". 416 5. Elliptic Curve VRF (EC-VRF) 418 The Elliptic Curve Verifiable Random Function (EC-VRF) is a VRF that 419 satisfies the trusted uniqueness, trusted collision resistance, and 420 full pseudorandomness properties defined in Section 3. The security 421 of this VRF follows from the decisional Diffie-Hellman (DDH) 422 assumption in the random oracle model. Formal security proofs are in 423 [nsec5ecc]. 425 Fixed options: 427 F - finite field 429 2n - length, in octets, of a field element in F 431 E - elliptic curve (EC) defined over F 432 m - length, in octets, of an EC point encoded as an octet string 434 G - subgroup of E of large prime order 436 q - prime order of group G 438 cofactor - number of points on E divided by q 440 g - generator of group G 442 Hash - cryptographic hash function 444 hLen - output length in octets of Hash 446 Constraints on options: 448 Field elements in F have bit lengths divisible by 16 450 hLen is equal to 2n 452 Parameters used: 454 y = g^x - VRF public key, an EC point 456 x - VRF private key, an integer where 0 < x < q [[CREF1: check 457 this with leo --Sharon]] 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 5.4. EC-VRF Auxiliary Functions 580 5.4.1. EC-VRF Hash To Curve 582 The ECVRF_hash_to_curve algorithm takes in an octet string alpha and 583 converts it to h, an EC point in G. 585 5.4.1.1. ECVRF_hash_to_curve1 587 The following ECVRF_hash_to_curve1(y, alpha) algorithm implements 588 ECVRF_hash_to_curve in a simple and generic way that works for any 589 elliptic curve. 591 The running time of this algorithm depends on alpha. For the 592 ciphersuites specified in Section 5.5, this algorithm is expected to 593 find a valid curve point after approximately two attempts (i.e., when 594 ctr=1) on average. See also [Icart09]. 596 However, because the running time of algorithm depends on alpha, this 597 algorithm SHOULD be avoided in applications where it is important 598 that the VRF input alpha remain secret. 600 ECVRF_hash_to_curve1(y, alpha) 602 Input: 604 alpha - value to be hashed, an octet string 606 y - public key, an EC point 608 Output: 610 h - hashed value, a finite EC point in G 612 Steps: 614 1. ctr = 0 616 2. pk = EC2OSP(y) 618 3. h = "INVALID" 620 4. While h is "INVALID" or h is EC point at infinity: 622 A. CTR = I2OSP(ctr, 4) 623 B. ctr = ctr + 1 625 C. attempted_hash = Hash(pk || alpha || CTR) 627 D. h = RS2ECP(attempted_hash) 629 E. If h is not "INVALID" and cofactor > 1, set h = h^cofactor 631 5. Output h 633 5.4.1.2. ECVRF_hash_to_curve2 635 For applications where VRF input alpha must be kept secret, the 636 following ECVRF_hash_to_curve algorithm MAY be used to used as 637 generic way to hash an octet string onto any elliptic curve. 639 [TODO: If there interest, we could look into specifying the generic 640 deterministic time hash_to_curve algorithm from [Icart09]. Note also 641 for the Ed25519 curve (but not the P256 curve), the Elligator 642 algorithm could be used here.] 644 5.4.2. EC-VRF Hash Points 646 ECVRF_hash_points(p_1, p_2, ..., p_j) 648 Input: 650 p_i - EC point in G 652 Output: 654 h - hash value, integer between 0 and 2^(8n)-1 656 Steps: 658 1. P = empty octet string 660 2. for p_i in [p_1, p_2, ... p_j]: 661 P = P || EC2OSP(p_i) 663 3. h1 = Hash(P) 665 4. h2 = first n octets of h1 667 5. h = OS2IP(h2) 669 6. Output h 671 5.4.3. EC-VRF Decode Proof 673 ECVRF_decode_proof(pi) 675 Input: 677 pi - VRF proof, octet string (m+3n octets) 679 Output: 681 "INVALID", or 683 gamma - EC point 685 c - integer between 0 and 2^(8n)-1 687 s - integer between 0 and 2^(16n)-1 689 Steps: 691 1. let gamma', c', s' be pi split after m-th and m+n-th octet 693 2. gamma = OS2ECP(gamma') 695 3. if gamma = "INVALID" output "INVALID" and stop. 697 4. c = OS2IP(c') 699 5. s = OS2IP(s') 701 6. Output gamma, c, and s 703 5.5. EC-VRF Ciphersuites 705 This document defines EC-VRF-P256-SHA256 as follows: 707 o The EC group G is the NIST-P256 elliptic curve, with curve 708 parameters as specified in [FIPS-186-3] (Section D.1.2.3) and 709 [RFC5114] (Section 2.6). For this group, 2n = 32 and cofactor = 710 1. 712 o The key pair generation primitive is specified in Section 3.2.1 of 713 [SECG1]. 715 o EC2OSP is specified in Section 2.3.3 of [SECG1] with point 716 compression on. This implies m = 2n + 1 = 33. 718 o OS2ECP is specified in Section 2.3.4 of [SECG1]. 720 o RS2ECP(h) = OS2ECP(0x02 || h). The input h is a 32-octet string 721 and the output is either an EC point or "INVALID". 723 o The hash function Hash is SHA-256 as specified in [RFC6234]. 725 o The ECVRF_hash_to_curve function is as specified in 726 Section 5.4.1.1. 728 This document defines EC-VRF-ED25519-SHA256 as follows: 730 o The EC group G is the Ed25519 elliptic curve with parameters 731 defined in Table 1 of [RFC8032]. For this group, 2n = 32 and 732 cofactor = 8. 734 o The key pair generation primitive is specified in Section 5.1.5 of 735 [RFC8032] 737 o EC2OSP is specified in Section 5.1.2 of [RFC8032]. This implies m 738 = 2n = 32. 740 o OS2ECP is specified in Section 5.1.3 of [RFC8032]. 742 o RS2ECP is equivalent to OS2ECP. 744 o The hash function Hash is SHA-256 as specified in [RFC6234]. 746 o The ECVRF_hash_to_curve function is as specified in 747 Section 5.4.1.1. 749 [TODO: Should we add an EC-VRF-ED25519-SHA256-Elligator ciphersuite 750 where the Elligator hash function is used for ECVRF_hash-to-curve?] 752 [TODO: Add an Ed448 ciphersuite?] 754 [NOTE: In the unlikely case that future versions of this spec use a 755 elliptic curve group G that does not also come with a specification 756 of the group generator g, then we can still have full uniqueness and 757 full collision resistance by adding an check to 758 ECVRF_validate_key(PK) that ensures that g is a point on the elliptic 759 curve and g^cofactor is not the EC point at infinity.] 761 5.6. When the EC-VRF Keys are Untrusted 763 The EC-VRF as specified above is a VRF that satisfies the "trusted 764 uniqueness", "trusted collision resistance", and "full 765 pseudorandomness" properties defined in Section 3. If the elliptic 766 curve parameters (including the generator g) are trusted, but the VRF 767 public key PK is not trusted, this VRF can be modified to 768 additionally satisfy "full uniqueness", and "full collision 769 resistance". This is done by additionally requiring the Verifier to 770 perform the following validation procedure upon receipt of the public 771 VRF key. 773 The Verifier MUST perform this validation procedure when the entity 774 that generated the public VRF key is untrusted. The public key MUST 775 NOT be used if this procedure returns "INVALID". Note well that this 776 procedure is not sufficient if the elliptic curve E or if g, the 777 generator of group G, is untrusted. 779 This procedure supposes that the public key provided to the Verifier 780 is an octet string. The procedure returns "INVALID" if the public 781 key in invalid. Otherwise, it returns y, the public key as an EC 782 point. 784 5.6.1. EC-VRF Validate Key 786 ECVRF_validate_key(PK) 788 Input: 790 PK - public key, an octet string 792 Output: 794 "INVALID", or 796 y - public key, an EC point 798 Steps: 800 1. y = OS2ECP(PK) 802 2. If y is "INVALID", output "INVALID" and stop 804 3. If y^cofactor is the EC point at infinty, output "INVALID" and 805 stop 807 4. Output y 809 6. Implementation Status 811 An implementation of the RSA-FDH-VRF (SHA-256) and EC-VRF-P256-SHA256 812 was first developed as a part of the NSEC5 project [I-D.vcelak-nsec5] 813 and is available at . The EC- 814 VRF implementation may be out of date as this spec has evolved. 816 The Key Transparency project at Google uses a VRF implemention that 817 is similar to the EC-VRF-P256-SHA256, with a few minor changes 818 including the use of SHA-512 instead of SHA-256. Its implementation 819 is available 820 823 An implementation by Yahoo! similar to the EC-VRF is available at 824 . 826 An implementation similar to EC-VRF is available as part of the 827 CONIKS implementation in Golang at . 830 Open Whisper Systems also uses a VRF very similar to EC-VRF- 831 ED25519-SHA512-Elligator, called VXEdDSA, and specified here: 832 834 7. Security Considerations 836 7.1. Key Generation 838 Applications that use the VRFs defined in this document MUST ensure 839 that that the VRF key is generated correctly, using good randomness. 841 7.1.1. Uniqueness and collision resistance with untrusted keys 843 The EC-VRF as specified in Section 5.1-Section 5.5 statisfies the 844 "trusted uniqueness" and "trusted collision resistance" properties as 845 long as the VRF keys are generated correctly, with good randomness. 846 If the Verifier trusts the VRF keys are generated correctly, it MAY 847 use the public key y as is. 849 However, if the EC-VRF uses keys that could be generated 850 adversarially, then the the Verfier MUST first perform the validation 851 procedure ECVRF_validate_key(PK) (specified in Section 5.6) upon 852 receipt of the public key PK as an octet string. If the validation 853 procedure outputs "INVALID", then the public key MUST not be used. 854 Otherwise, the procedure will output a valid public key y, and the 855 EC-VRF with public key y satisfies the "full uniqueness" and "full 856 collision resistance" properties. 858 The RSA-FDH-VRF statisfies the "trusted uniqueness" and "trusted 859 collision resistance" properties as long as the VRF keys are 860 generated correctly, with good randomness. These properties may not 861 hold if the keys are generated adversarially (e.g., if RSA is not 862 permutation). Meanwhile, the "full uniqueness" and "full collision 863 resistance" are properties that hold even if VRF keys are generated 864 by an adversary. The RSA-FDH-VRF defined in this document does not 865 have these properties. However, if adversarial key generation is a 866 concern, the RSA-FDH-VRF may be modifed to have these properties by 867 adding additional cryptographic checks that its public key has the 868 right form. These modifications are left for future specification. 870 7.1.2. Pseudorandomness with untrusted keys 872 Without good randomness, the "pseudorandomness" properties of the VRF 873 may not hold. Note that it is not possible to guarantee 874 pseudorandomness in the face of adversarially generated VRF keys. 875 This is because an adversary can always use bad randomness to 876 generate the VRF keys, and thus, the VRF output may not be 877 pseudorandom. 879 7.2. Selective vs Full Pseudorandomness 881 [nsec5ecc] presents cryptographic reductions to an underlying hard 882 problem (e.g. Decisional Diffie Hellman for the EC-VRF, or the 883 standard RSA assumption for RSA-FDH-VRF) that prove the VRFs 884 specificied in this document possess full pseudorandomness as well as 885 selective pseudorandomness. However, the cryptographic reductions 886 are tighter for selective pseudorandomness than for full 887 pseudorandomness. This means the the VRFs have quantitavely stronger 888 security guarentees for selective pseudorandomness. 890 Applications that are concerned about tightness of cryptographic 891 reductions therefore have two options. 893 o They may choose to ensure that selective pseudorandomness is 894 sufficient for the application. That is, that pseudorandomness of 895 outputs matters only for inputs that are chosen independently of 896 the VRF key. 898 o If full pseudorandomness is required for the application, the 899 application may increase security parameters to make up for the 900 loose security reduction. For RSA-FDH-VRF, this means increasing 901 the RSA key length. For EC-VRF, this means increasing the 902 cryptographic strength of the EC group G. For both RSA-FDH-VRF 903 and EC-VRF the cryptographic strength of the hash function Hash 904 may also potentially need to be increased. 906 7.3. Proper randomness for EC-VRF 908 Applications that use the EC-VRF defined in this document MUST ensure 909 that the random nonce k used in the ECVRF_prove algorithm is chosen 910 with proper randomness. Otherwise, an adversary may be able to 911 recover the private VRF key x (and thus break pseudorandomness of the 912 VRF) after observing several valid VRF proofs pi. 914 7.4. Timing attacks 916 The EC-VRF_hash_to_curve algorithm defined in Section 5.4.1.1 SHOULD 917 NOT be used in applications where the VRF input alpha is secret and 918 is hashed by the VRF on-the-fly. This is because the EC- 919 VRF_hash_to_curve algorithm's running time depends on the VRF input 920 alpha, and thus creates a timing channel that can be used to learn 921 information about alpha. That said, for most inputs the amount of 922 information obtained from such a timing attack is likely to be small 923 (1 bit, on average), since the algorithm is expected to find a valid 924 curve point after only two attempts. However, there might be inputs 925 which cause the algorithm to make many attempts before it finds a 926 valid curve point; for such inputs, the information leaked in a 927 timing attack will be more than 1 bit. 929 8. Change Log 931 Note to RFC Editor: if this document does not obsolete an existing 932 RFC, please remove this appendix before publication as an RFC. 934 00 - Forked this document from draft-vcelak-nsec5-04. Cleaned up 935 the definitions of VRF algorithms. Added security definitions for 936 VRF and security considerations. Parameterized EC-VRF so it could 937 support curves other than P-256 and Ed25519. 939 01 - Fixed ECVRF to work when cofactor > 1. Changed 940 ECVRF_proof2hash(pi) so that it outputs a value raised to the 941 cofactor and then processed by the cryptographic hash function 942 Hash. Included the VRF public key y as input to the hash function 943 ECVRF_hash_to_curve1. Cleaned up ciphersuites and ECVRF 944 description so that it works with EC point encodings for both P256 945 and Ed25519 curves. Added ECVRF_validate_key so that EC-VRF can 946 satisfy "full uniqueness" and "full collision" resistance. 947 Updated implementation status. Added "an additional 948 pseudorandomness property" to security definitions. 950 9. Contributors 952 Leonid Reyzin (Boston University) is a major contributor to this 953 document. 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 [I-D.vcelak-nsec5] 1000 Vcelak, J., Goldberg, S., Papadopoulos, D., Huque, S., and 1001 D. Lawrence, "NSEC5, DNSSEC Authenticated Denial of 1002 Existence", draft-vcelak-nsec5-04 (work in progress), 1003 March 2017. 1005 [Icart09] Icart, T., "How to Hash into Elliptic Curves", in CRYPTO, 1006 2009. 1008 [MRV99] Michali, S., Rabin, M., and S. Vadhan, "Verifiable Random 1009 Functions", in FOCS, 1999. 1011 [nsec5ecc] 1012 Papadopoulos, D., Wessels, D., Huque, S., Vcelak, J., 1013 Naor, M., Reyzin, L., and S. Goldberg, "Making NSEC5 1014 Practical for DNSSEC Deployments", in ePrint Cryptology 1015 Archive 2017/099, February 2017, 1016 . 1018 Appendix A. Open Issues 1020 Note to RFC Editor: please remove this appendix before publication as 1021 an RFC. 1023 1. Open issue. 1025 Authors' Addresses 1027 Sharon Goldberg 1028 Boston University 1029 111 Cummington St, MCS135 1030 Boston, MA 02215 1031 USA 1033 EMail: goldbe@cs.bu.edu 1035 Dimitrios Papadopoulos 1036 University of Maryland 1037 8223 Paint Branch Dr 1038 College Park, MD 20740 1039 USA 1041 EMail: dipapado@bu.edu 1043 Jan Vcelak 1044 NS1 1045 16 Beaver St 1046 New York, NY 10004 1047 USA 1049 EMail: jvcelak@ns1.com