Internet-Draft | VRF | August 2022 |
Goldberg, et al. | Expires 10 February 2023 | [Page] |
A Verifiable Random Function (VRF) is the public-key version of a keyed cryptographic hash. Only the holder of the secret key can compute the hash, but anyone with the public key can verify the correctness of the hash. VRFs are useful for preventing enumeration of hash-based data structures. This document specifies VRF constructions based on RSA and elliptic curves that are secure in the cryptographic random oracle model.¶
This document is a product of the Crypto Forum Research Group (CFRG) in the IRTF.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 10 February 2023.¶
Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
A Verifiable Random Function (VRF) [MRV99] is the public-key version of a keyed cryptographic hash. Only the holder of the VRF secret key can compute the hash, but anyone with the corresponding public key can verify the correctness of the hash.¶
A key application of the VRF is to provide privacy against offline dictionary attacks (also known as enumeration attacks) on data stored in a hash-based data structure. In this application, a Prover holds the VRF secret key and uses the VRF hashing to construct a hash-based data structure on the input data.¶
Due to the nature of the VRF, only the Prover can answer queries about whether or not some data is stored in the data structure. Anyone who knows the VRF public key can verify that the Prover has answered the queries correctly. However, no offline inferences (i.e. inferences without querying the Prover) can be made about the data stored in the data structure.¶
This document defines VRFs based on RSA and elliptic curves. The choices of VRFs for inclusion into this document were based, in part, on synergy with existing RFCs and commonly available implementations of individual components that are used within the VRFs.¶
The particular choice of the VRF for a given application depends on the desired security properties, the availability of cryptographically strong implementations, efficiency constraints, and the trust one places in RSA and elliptic curve Diffie-Hellman assumptions (and the trust in a particular choice of curve in case of elliptic curves). Differences in the security properties provided by the different options are discussed in Section 3 and Section 7.¶
This document represents the consensus of the Crypto Forum Research Group (CFRG).¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC8174].¶
The following terminology is used through this document:¶
A VRF comes with a key generation algorithm that generates a VRF public key PK and secret key SK.¶
The prover hashes an input alpha using the VRF secret key SK to obtain a VRF hash output beta¶
The VRF_hash algorithm is deterministic, in the sense that it always produces the same output beta given the same pair of inputs (SK, alpha).¶
The prover also uses the secret key SK to construct a proof pi that beta is the correct hash output¶
The VRFs defined in this document allow anyone to deterministically obtain the VRF hash output beta directly from the proof value pi by using the function VRF_proof_to_hash:¶
Thus, for VRFs defined in this document, VRF_hash is defined as¶
and therefore this document will specify VRF_prove and VRF_proof_to_hash rather than VRF_hash.¶
The proof pi allows a Verifier holding the public key PK to verify that beta is the correct VRF hash of input alpha under key PK. Thus, the VRFs defined in this document also come with an algorithm¶
that outputs (VALID, beta = VRF_proof_to_hash(pi)) if pi is valid, and INVALID otherwise.¶
VRFs are designed to ensure the following security properties: uniqueness (full or trusted), collision resistance (full or trusted), and pseudorandomness (full or selective). Some are designed to also ensure unpredictability under malicious key generation. We now describe these properties.¶
Uniqueness means that, for any fixed VRF public key and for any input alpha, it is infeasible to find proofs for more than one VRF output beta.¶
More precisely, "full uniqueness" means that an adversary cannot find¶
such that¶
Like cryptographic hash functions, VRFs are collision resistant. Collison resistance means that it is infeasible to find two different inputs alpha1 and alpha2 with the same output beta.¶
More precisely, "full collision resistance" means that an adversary cannot find¶
such that¶
Full uniqueness and full collision resistance hold even if the VRF keys are generated maliciously. For some applications, it is sufficient for a VRF to possess weaker security properties than full uniqueness and full collision resistance, called "trusted uniqueness" and "trusted collision resistance". These properties are the same as full uniqueness and full collision resistance, respectively, but are not guaranteed to hold if the adversary gets to choose the VRF public key PK. Instead, they are guaranteed to hold only if the VRF keys PK and SK are generated as specified by the VRF key generation algorithm and then given to the adversary. In other words, they are guaranteed to hold even if the adversary has the knowledge of SK and PK, but not guaranteed to hold if the adversary has the ability to choose SK and PK.¶
As further discussed in Section 7.1.1, some VRFs specified in this document satisfy only trusted uniqueness and trusted collision resistance. VRFs in this document that satisfy only trusted uniqueness and trusted collision resistance MUST NOT be used in applications that need protection against adversarial VRF key generation.¶
Pseudorandomness ensures that when someone who does not know SK sees a VRF hash output beta without its corresponding VRF proof pi, then beta is indistinguishable from a random value.¶
More precisely, suppose the public and secret VRF keys (PK, SK) were generated correctly. Pseudorandomness ensures that the VRF hash output beta (without its corresponding VRF proof pi) on any adversarially chosen "target" VRF input alpha looks indistinguishable from random for any adversary who does not know the VRF secret key SK. This holds even if the adversary sees VRF hash outputs beta' and proofs pi' for multiple other inputs alpha' (and even if those other inputs alpha' are chosen by the adversary).¶
"Full pseudorandomness" security property holds even against an adversary who is allowed to choose the "target" VRF input alpha at any time, even after it observes VRF outputs beta' and proofs pi' on a variety of chosen inputs alpha'.¶
"Selective pseudorandomness" is a weaker security property that suffices in many applications. This security property holds against an adversary who chooses the target VRF input alpha first, before it learns the VRF public key PK and obtains VRF outputs beta' and proofs pi' on other inputs alpha' of its choice.¶
As further discussed in Section 7.3, VRFs specified in this document satisfy both full pseudorandomness and selective pseudorandomness, but their quantitative security against the selective pseudorandomness attack is stronger.¶
It is important to remember that the VRF output beta is always distinguishable from random by the Prover, or by any other party that knows the VRF secret key SK. Such a party can easily distinguish beta from a random value by comparing beta to the result of VRF_hash(SK, alpha).¶
Similarly, the VRF output beta is always distinguishable from random by any party that knows a valid VRF proof pi corresponding to the VRF input alpha, even if this party does not know the VRF secret key SK. Such a party can easily distinguish beta from a random value by checking whether VRF_verify(PK, alpha, pi) returns (VALID, beta).¶
Additionally, the VRF output beta may be distinguishable from random if VRF key generation was not done correctly. (For example, if VRF keys were generated with bad randomness.)¶
As explained in Section 3.4, pseudorandomness cannot hold against malicious key generation. For instance, if an adversary outputs VRF keys that are deterministically generated (or hard-coded and publicly known), then the outputs are easily derived by anyone and are therefore not pseudorandom.¶
There is, however, a different type of unpredictability that is desirable in certain VRF applications (such as leader selection in the consensus protocols of [GHMVZ17] and [DGKR18]), called "unpredictability under malicious key generation". This property is similar to the unpredictability achieved by an (ordinary, unkeyed) cryptographic hash function: if the input has enough entropy (i.e., cannot be predicted), then the correct output is indistinguishable from uniformly random, no matter how the VRF keys are generated.¶
A formal definition of this property appears in Section 3.2 of [DGKR18]. As further discussed in Section 7.1.3, only some VRFs specified in this document satisfy this property.¶
The RSA Full Domain Hash VRF (RSA-FDH-VRF) is a VRF that, for suitable key lengths, satisfies the "trusted uniqueness", "trusted collision resistance", and "full pseudorandomness" properties defined in Section 3, as further discussed in Section 7. Its security follows from the standard RSA assumption in the random oracle model. Formal security proofs are in [PWHVNRG17].¶
The VRF computes the proof pi as a deterministic RSA signature on input alpha using the RSA Full Domain Hash Algorithm [RFC8017] parametrized with the selected hash algorithm. RSA signature verification is used to verify the correctness of the proof. The VRF hash output beta is simply obtained by hashing the proof pi with the selected hash algorithm.¶
The key pair for RSA-FDH-VRF MUST be generated in a way that it satisfies the conditions specified in Section 3 of [RFC8017].¶
In this section, the notation from [RFC8017] is used.¶
Parameters used:¶
Fixed options (specified in Section 4.4):¶
Primitives used:¶
RSAFDHVRF_prove(K, alpha_string[, MGF_salt])¶
Input:¶
Optional Input:¶
Output:¶
Steps:¶
RSAFDHVRF_proof_to_hash(pi_string)¶
Input:¶
Output:¶
Important note:¶
Steps:¶
RSAFDHVRF_verify((n, e), alpha_string, pi_string[, MGF_salt])¶
Input:¶
Optional Input:¶
Output:¶
Output:¶
("VALID", beta_string), where beta_string is the VRF hash output, an octet string of length hLen; or¶
"INVALID"¶
Steps:¶
This document defines RSA-FDH-VRF-SHA256 as follows:¶
This document defines RSA-FDH-VRF-SHA384 as follows:¶
This document defines RSA-FDH-VRF-SHA512 as follows:¶
The Elliptic Curve Verifiable Random Function (ECVRF) is a VRF that, for suitable parameter choices, satisfies the "full uniqueness", "trusted collision resistance", and "full pseudorandomness properties" defined in Section 3. If validate_key parameter given to the ECVRF_verify is TRUE, then the ECVRF additionally satisfies "full collision resistance" and "unpredictability under malicious key generation". See Section 7 for further discussion. Formal security proofs are in [PWHVNRG17].¶
Notation used:¶
Fixed options (specified in Section 5.5):¶
Type conversions (specified in Section 5.5):¶
Parameters used (the generation of these parameters is specified in Section 5.5):¶
ECVRF_prove(SK, alpha_string[, encode_to_curve_salt])¶
Input:¶
Optional input:¶
Output:¶
Steps:¶
Use SK to derive the VRF secret scalar x and the VRF public key Y = x*B¶
(this derivation depends on the ciphersuite, as per Section 5.5;¶
these values can be cached, for example, after key generation, and need not be rederived each time)¶
ECVRF_proof_to_hash(pi_string)¶
Input:¶
Output:¶
Important note:¶
Steps:¶
ECVRF_verify(PK_string, alpha_string, pi_string[, encode_to_curve_salt, validate_key])¶
Input:¶
Optional input:¶
Output:¶
("VALID", beta_string), where beta_string is the VRF hash output, octet string of length hLen; or¶
"INVALID"¶
Steps:¶
Note that the first three steps need to be performed only once for a given public key.¶
The ECVRF_encode_to_curve algorithm takes a public salt (see Section 7.9) and the VRF input alpha and converts it to H, an EC point in G. This algorithm is the only place the VRF input alpha is used for proving and verifying. See Section 7.7 for further discussion.¶
This section specifies a number of such algorithms, which are not compatible with each other and are intended to use with various ciphersuites specified in Section 5.5.¶
Input:¶
Output:¶
The following ECVRF_encode_to_curve_try_and_increment(encode_to_curve_salt, alpha_string) algorithm implements ECVRF_encode_to_curve in a simple and generic way that works for any elliptic curve. To use this algorithm, hLen MUST be at least fLen.¶
The running time of this algorithm depends on alpha_string. For the ciphersuites specified in Section 5.5, this algorithm is expected to find a valid curve point after approximately two attempts (i.e., when ctr=1) on average.¶
However, because the running time of algorithm depends on alpha_string, this algorithm SHOULD be avoided in applications where it is important that the VRF input alpha remain secret.¶
ECVRF_encode_to_curve_try_and_increment(encode_to_curve_salt, alpha_string)¶
Fixed option (specified in Section 5.5):¶
Steps:¶
While H is "INVALID" or H is the identity element of the elliptic curve group:¶
Note even though the loop is infinite as written, and int_to_string(ctr,1) may fail when ctr reaches 256, interpret_hash_value_as_a_point functions specified in Section 5.5 will succeed on roughly half hash_string values. Thus the loop is expected to stop after two iterations, and ctr is overwhelmingly unlikely (probability about 2^-256) to reach 256.¶
The ECVRF_encode_to_curve_h2c_suite(encode_to_curve_salt, alpha_string) algorithm implements ECVRF_encode_to_curve using one of the several hash-to-curve options defined in [I-D.irtf-cfrg-hash-to-curve]. The specific choice of the hash-to-curve option (called Suite ID in [I-D.irtf-cfrg-hash-to-curve]) is given by the h2c_suite_ID_string parameter.¶
ECVRF_encode_to_curve_h2c_suite(encode_to_curve_salt, alpha_string)¶
Fixed option (specified in Section 5.5):¶
Steps:¶
H = encode(string_to_be_hashed)¶
(the encode function is discussed below)¶
The encode function is provided by the hash-to-curve suite whose ID is h2c_suite_ID_string, as specified in [I-D.irtf-cfrg-hash-to-curve], Section 8. The domain separation tag DST, a parameter to the hash-to-curve suite, SHALL be set to¶
where "ECVRF_" is represented as a 6-byte ASCII encoding (in hexadecimal, octets 45 43 56 52 46 5F).¶
The following algorithms generate the nonce value k in a deterministic pseudorandom fashion. This section specifies a number of such algorithms, which are not compatible with each other. The choice of a particular algorithm from the options specified in this section depends on the ciphersuite, as specified in Section 5.5.¶
ECVRF_nonce_generation_RFC6979(SK, h_string)¶
Input:¶
Output:¶
The ECVRF_nonce_generation function is as specified in [RFC6979] Section 3.2 where¶
ECVRF_challenge_generation(P1, P2, P3, P4, P5)¶
Input:¶
Output:¶
Steps:¶
for PJ in [P1, P2, P3, P4, P5]:¶
str = str || point_to_string(PJ)¶
ECVRF_decode_proof(pi_string)¶
Input:¶
Output:¶
Steps:¶
ECVRF_validate_key(Y)¶
Input:¶
Output:¶
Important note: the public key Y given to this procedure MUST be a valid point on E.¶
Steps:¶
Note that if the cofactor = 1, then Step 1 simply sets Y'=Y. In particular, for the P-256 curve, ECVRF_validate_key simply ensures that Y is not the point at infinity.¶
Any algorithm with identical input-output behavior MAY be used in place of the above steps. For example, if the total number of Y values that could cause Step 2 to output "INVALID" is small, it may be more efficient to simply check Y against a fixed list of such values. For example, the following algorithm MAY be used for the edwards25519 curve:¶
y_string[31] = y_string[31] & oneTwentySeven_string¶
(this step clears the high-order bit of octet 31)¶
(This algorithm works for the following reason. Note that there are 8 bad points -- namely, the points whose order is 1, 2, 4, or 8 -- on the edwards25519 curve. Their y coordinates happen to be 0 (two points of order 4), 1 (one point of order 1), bad_y2 (two points of order 8), p-bad_y2 (two points of order 8), and p-1 (one point of order 2). They can obtained by converting the points specified in [X25519] to Edwards coordinates. Thus, bad_pk[0] (of order 4), bad_pk[2] (of order 8), and bad_pk[3] (of order 8) each match two bad points, depending on the sign of the x-coordinate, which was cleared in step 3, in order to make sure that it does not affect the comparison. bad_pk[1] (of order 1) and bad_pk[4] (of order 2) each match one bad point, because x-coordinate is 0 for these two points. Note that the first 5 list elements cover the 8 bad points. However, in case the y-coordinate of the public key Y had not been modular reduced by p, the list also includes bad_pk[5] and bad_pk[6], which are simply bad_pk[0] and bad_pk[1] shifted by p. There is no need to shift the other bad_pk values by p (or any bad_pk values by a larger multiple of p), because their y coordinate would exceed 2^255; and we ensure that y_string corresponds to an integer less than 2^255 in step 3.)¶
This document defines ECVRF-P256-SHA256-TAI as follows:¶
This document defines ECVRF-P256-SHA256-SSWU as identical to ECVRF-P256-SHA256-TAI, except that:¶
This document defines ECVRF-EDWARDS25519-SHA512-TAI as follows:¶
This document defines ECVRF-EDWARDS25519-SHA512-ELL2 as identical to ECVRF-EDWARDS25519-SHA512-TAI, except:¶
Note to RFC editor: Remove before publication¶
A reference C++ implementation of ECVRF-P256-SHA256-TAI, ECVRF-P256-SHA256-SSWU, ECVRF-EDWARDS25519-SHA512-TAI, and ECVRF-EDWARDS25519-SHA512-ELL2 is available at https://github.com/reyzin/ecvrf. This implementation is neither secure nor especially efficient, but can be used to generate test vectors.¶
A Python implementation of an older version of ECVRF-EDWARDS25519-SHA512-ELL2 from the -05 version of this draft is available at https://github.com/integritychain/draft-irtf-cfrg-vrf-05.¶
A C implementation of an older version of ECVRF-EDWARDS25519-SHA512-ELL2 from the -03 version of this draft is available at https://github.com/algorand/libsodium/tree/draft-irtf-cfrg-vrf-03/src/libsodium/crypto_vrf/ietfdraft03.¶
A Rust implementation of an older version of ECVRF-P256-SHA256-TAI from the -05 version of this draft, as well as variants for the sect163k1 and secp256k1 curves, is available at https://crates.io/crates/vrf.¶
A C implementation of a variant of ECVRF-P256-SHA256-TAI from the -05 version of this draft adapted for the secp256k1 curve is available at https://github.com/aergoio/secp256k1-vrf.¶
An implementation of an earlier version of RSA-FDH-VRF (SHA-256) and ECVRF-P256-SHA256-TAI was first developed as a part of the NSEC5 project [I-D.vcelak-nsec5] and is available at http://github.com/fcelda/nsec5-crypto.¶
The Key Transparency project at Google uses a VRF implementation that is similar to the ECVRF-P256-SHA256-TAI, with a few changes including the use of SHA-512 instead of SHA-256. Its implementation is available at https://github.com/google/keytransparency/blob/master/core/crypto/vrf/¶
An implementation by Ryuji Ishiguro following an older version of ECVRF-EDWARDS25519-SHA512-TAI from the -00 version of this draft is available at https://github.com/r2ishiguro/vrf.¶
An implementation similar to ECVRF-EDWARDS25519-SHA512-ELL2 (with some changes, including the use of SHA-3) is available as part of the CONIKS implementation in Golang at https://github.com/coniks-sys/coniks-go/tree/master/crypto/vrf.¶
Open Whisper Systems also uses a VRF similar to ECVRF-EDWARDS25519-SHA512-ELL2, called VXEdDSA, and specified here https://whispersystems.org/docs/specifications/xeddsa/ and here https://moderncrypto.org/mail-archive/curves/2017/000925.html. Implementations in C and Java are available at https://github.com/signalapp/curve25519-java and https://github.com/wavesplatform/curve25519-java.¶
Implementations of VRFs defined in this document MUST ensure that they generate VRF keys correctly and using good randomness. However, in some applications keys may be generated by an adversary who does not necessarily implement this document. We now discuss the implications of this possibility.¶
See Section 3 for definitions of uniqueness and collision resistance properties.¶
The RSA-FDH-VRF satisfies only the "trusted" variants of uniqueness and collision resistance. Thus, for RSA-FDH-VRF, uniqueness and collision resistance may not hold if the keys are generated adversarially (specifically, if the RSA function specified in the public key is not bijective because the modulus n or the exponent e are chosen not in compliance with [RFC8017]); thus, RSA-FDH-VRF defined in this document does not have "full uniqueness" and "full collision resistance". Therefore, if malicious key generation is a concern, the RSA-FDH-VRF has to be enhanced by additional cryptographic checks (such as zero-knowledge proofs) that its public key has the right form. These enhancements are left for future specification.¶
For the ECVRF, the Verifier MUST obtain E and B from a trusted source, such as a ciphersuite specification, rather than from the prover. If the verifier does so, then the ECVRF satisfies the "full uniqueness", ensuring uniqueness even under malicious key generation. The ECVRF also satisfies "trusted collision resistance". It additionally satisfies "full collision resistance" if validate_key parameter given to the ECVRF_verify is TRUE. This setting of ECVRF_verify ensures collision resistance under malicious key generation.¶
Without good randomness, the "pseudorandomness" properties of the VRF (defined in Section 3.4) may not hold. Note that it is not possible to guarantee pseudorandomness in the face of adversarially generated VRF keys. This is because an adversary can always use bad randomness to generate the VRF keys, and thus, the VRF output may not be pseudorandom.¶
Unpredictability under malicious key generation (defined in Section 3.5) does not hold for the RSA-FDH-VRF. (Specifically, the VRF output may be predictable if the RSA function specified in the public key is far from bijective because the modulus n or the exponent e are chosen not in compliance with [RFC8017].) If unpredictability under malicious key generation is desired, the RSA-FDH-VRF has to be enhanced by additional cryptographic checks (such as zero-knowledge proofs) that its public key has the right form. These enhancements are left for future specification.¶
Unpredictability under malicious key generation holds for the ECVRF if validate_key parameter given to the ECVRF_verify is TRUE.¶
As shown in [PWHVNRG17], RSA-FDH-VRF satisfies the trusted uniqueness property unconditionally. The security level of the RSA-FDH-VRF, measured in bits, for the other two properties is as follows (in the random oracle model for the functions MGF1 and Hash):¶
As shown in [PWHVNRG17], the security level of the ECVRF, measured in bits, is as follows (in the random oracle model for the functions Hash and ECVRF_encode_to_curve):¶
See Section 3 for the definitions of these security properties. See Section 7.3 for the discussion of full pseudorandomness.¶
[PWHVNRG17] presents cryptographic reductions to an underlying hard problem (namely, the RSA problem for RSA-FDH-VRF and the Decisional Diffie-Hellman problem for the ECVRF) to prove that the VRFs specified in this document possess not only selective pseudorandomness, but also full pseudorandomness (see Section 3.4 for an explanation of these notions). However, the cryptographic reductions are tighter for selective pseudorandomness than for full pseudorandomness. Specifically, the approximate provable security level, measured in bits, for full pseudorandomness may be obtained from the provable security level for selective pseudorandomness (given in Section 7.2) by subtracting the binary logarithm of the number of proofs produced for a given secret key. This holds for both the RSA-FDH-VRF and the ECVRF.¶
While no known attacks against full pseudorandomness are stronger than similar attacks against selective pseudorandomness, some applications may be concerned about tightness of cryptographic reductions to ensure specific levels of provable security. Such applications may consider the following three options:¶
The security of the ECVRF defined in this document relies on the fact that the nonce k used in the ECVRF_prove algorithm is chosen uniformly and pseudorandomly modulo q, and is unknown to the adversary. Otherwise, an adversary may be able to recover the VRF secret scalar x (and thus break pseudorandomness of the VRF) after observing several valid VRF proofs pi, using, for example, techniques described in [BreHen19]. The nonce generation methods specified in the ECVRF ciphersuites of Section 5.5 are designed with this requirement in mind.¶
Side channel attacks on cryptographic primitives are an important issue. Implementers should take care to avoid side-channel attacks that leak information about the VRF secret key SK (and the nonce k used in the ECVRF), which is used in VRF_prove. In most applications, VRF_proof_to_hash and VRF_verify algorithms take only inputs that are public, and thus side channel attacks are typically not a concern for these algorithms.¶
The VRF input alpha may be also a sensitive input to VRF_prove and may need to be protected against side channel attacks. Below we discuss one particular class of such attacks: timing attacks that can be used to leak information about the VRF input alpha.¶
The ECVRF_encode_to_curve_try_and_increment algorithm defined in Section 5.4.1.1 SHOULD NOT be used in applications where the VRF input alpha is secret and is hashed by the VRF on-the-fly. This is because the algorithm's running time depends on the VRF input alpha, and thus creates a timing channel that can be used to learn information about alpha. That said, for most inputs the amount of information obtained from such a timing attack is likely to be small (1 bit, on average), since the algorithm is expected to find a valid curve point after only two attempts. However, there might be inputs which cause the algorithm to make many attempts before it finds a valid curve point; for such inputs, the information leaked in a timing attack will be more than 1 bit.¶
ECVRF-P256-SHA256-SSWU and ECVRF-EDWARDS25519-SHA512-ELL2 can be made to run in time independent of alpha, following recommendations in [I-D.irtf-cfrg-hash-to-curve].¶
The VRF proof pi is not designed to provide secrecy and, in general, may reveal the VRF input alpha. Anyone who knows PK and pi is able to perform an offline dictionary attack to search for alpha, by verifying guesses for alpha using VRF_verify. This is in contrast to the VRF hash output beta which, without the proof, is pseudorandom and thus is designed to reveal no information about alpha.¶
The VRFs specified in this document allow for read-once access to the input alpha for both signing and verifying. Thus, additional prehashing of alpha (as specified, for example, in [RFC8032] for EdDSA signatures) is not needed, even for applications that need to handle long alpha or to support the Initialize-Update-Finalize (IUF) interface (in such an interface, alpha is not supplied all at once, but rather in pieces by a sequence of calls to Update). The ECVRF, in particular, uses alpha only in ECVRF_encode_to_curve. The curve point H becomes the representative of alpha thereafter.¶
Hashing is used for different purposes in the two VRFs. Specifically, in the RSA-FDH-VRF, hashing is used in MGF1 and in proof_to_hash; in the ECVRF, hashing is used in encode_to_curve, nonce_generation, challenge_generation, and proof_to_hash. The theoretical analysis treats each of these functions as a separate hash function, modeled as a random oracle. This analysis still holds even if the same hash function is used, as long as the four inputs given to the hash function for a given SK and alpha are overwhelmingly unlikely to equal each other or to any inputs given to the hash function for the same SK and different alpha. This is indeed the case for the RSA-FDH-VRF defined in this document, because the second octets of the input to the hash function used in MGF1 and in proof_to_hash are different.¶
This is also the case for the ECVRF ciphersuites defined in this document, because:¶
In case a hash collision is found, in order to make it more difficult for the adversary to exploit such a collision, the MGF1 function for the RSA-FDH-VRF and ECVRF_encode_to_curve function for the ECVRF use a public value in addition to alpha (as a so-called salt). This value is determined by the ciphersuite. For the ciphersuites defined in this document, it is set equal to the string representation of the RSA modulus and EC public key, respectively. Implementations that do not use one of the ciphersuites (see Section 7.10) MAY use a different salt. For example, if a group of public keys to share the same salt, then the hash of the VRF input alpha will be the same for the entire group of public keys, which may aid in some protocol that uses the VRF.¶
If future designs need to specify variants (e.g., additional ciphersuites) of the RSA-FDH-VRF or the ECVRF in this document, then, to avoid the possibility that an adversary can obtain a VRF output under one variant, and then claim it was obtained under another variant, they should specify a different suite_string constant. The suite_string constants in this document are all single octets; if a future suite_string constant is longer than one octet, then it should start with a different octet than the suite_string constants in this document. Then, for the RSA-FDH-VRF, the inputs to the hash function used in MGF1 and proof_to_hash will be different from other ciphersuites. For the ECVRF, the inputs ECVRF_encode_to_curve hash function used in producing H are then guaranteed to be different from other ciphersuites; since all the other hashing done by the prover depends on H, inputs to all the hash functions used by the prover will also be different from other ciphersuites as long as ECVRF_encode_to_curve is collision resistant.¶
Note to RFC Editor: if this document does not obsolete an existing RFC, please remove this appendix before publication as an RFC.¶
This document would not be possible without the work of Moni Naor, Sachin Vasant, and Asaf Ziv. Chloe Martindale provided a thorough cryptographer's review. Liliya Akhmetzyanova, Tony Arcieri, Gary Belvin, Mario Cao Cueto, Brian Chen, Sergey Gorbunov, Shumon Huque, Gorka Irazoqui Apecechea, Marek Jankowski, Burt Kaliski, Mallory Knodel, David C. Lawerence, Derek Ting-Haye Leung, Antonio Marcedone, Piotr Nojszewski, Chris Peikert, Colin Perkins, Trevor Perrin, Sam Scott, Stanislav Smyshlyaev, Adam Suhl, Nick Sullivan, Christopher Wood, Jiayu Xu, and Annie Yousar provided valuable input to this draft. Christopher Wood, Malte Thomsen, Marcus Rasmussen, and Tobias Vestergaard provided independent verification of the test vectors. Riad Wahby helped this document align with draft-irtf-cfrg-hash-to-curve.¶
The test vectors in this section were generated using code at https://github.com/reyzin/rsa-fdh-vrf.¶
There are three keys used in the nine examples below. First, we provide the keys. They are shown in hexadecimal big-endian notation.¶
2048-bit key:¶
3072-bit key:¶
4096-bit key:¶
Example 1, using the 2048-bit key above:¶
Example 2, using the 3072-bit key above:¶
Example 3, using the 4096-bit key above:¶
Example 4, using the 2048-bit key above:¶
Example 5, using the 3072-bit key above:¶
Example 6, using the 4096-bit key above:¶
Example 7, using the 2048-bit key above:¶
Example 8, using the 3072-bit key above:¶
Example 9, using the 4096-bit key above:¶
The test vectors in this section were generated using code at https://github.com/reyzin/ecvrf.¶
The example secret keys and messages in Examples 10 and 11 are taken from Appendix A.2.5 of [RFC6979].¶
Example 10:¶
Example 11:¶
The example secret key in Example 12 is taken from Appendix L.4.2 of [ANSI.X9-62-2005].¶
Example 12:¶
The example secret keys and messages in Examples 13 and 14 are taken from Appendix A.2.5 of [RFC6979].¶
Example 13:¶
Example 14:¶
The example secret key in Example 15 is taken from Appendix L.4.2 of [ANSI.X9-62-2005].¶
Example 15:¶
The example secret keys and messages in Examples 16, 17, and 18 are taken from Section 7.1 of [RFC8032].¶
Example 16:¶
Example 17:¶
Example 18:¶
The example secret keys and messages in Examples 19, 20, and 21 are taken from Section 7.1 of [RFC8032].¶
Example 19:¶
Example 20:¶
Example 21:¶