VECRO stands for a verifiable elliptic curve random oracle.
VECRO allows to produce unique, collision resistant and fully pseudorandom numbers based on client's data. These numbers can be easily verified as regular EdDSA signatures.
EdDSA signature consists of R and S values, where R represents a nonce and S represents a signature, the R, S pair proofs that a message is signed by a private key. This can be verified by a corresponding public key at any time.
EdDSA has a problem when used as a source for a random oracle, because it can generate an infinite number of valid signatures for one message, so an oracle on this method can easily manipulate a final result. R value must be unique every time and even if R is fixed and based on a message input, there is no garantees that the oracle does not manipulate the value of R, otherwise, his private key is compromised.
VECRO defines a mechanism in which R value fixates before a signature generation, so for one message and fixed R there is only one S value, which can then be used as verifiable random number, because there is no room for manipulations.
VECRO provides his public key and getR(), getRS() functions for clients.
getR() function:
- gets
rseedvalue from a client; - calculates
Rvalue based onrseed; - publishes
Rfor the client.
getRS() function:
- gets a
messageandrseedfrom a client; - calculates a signature as
R, Spair based on themessageandrseed; - publishes
R, Sfor the client.
When a client wants a new random number, he:
- chooses a VECRO he wants to work with;
- gets the VECRO's public key;
- generates unique
rseed; - calls
getR( rseed )on the VECRO; - gets
Rvalue from the VECRO; - generates a
message; - calls
getRS( message, rseed )on the VECRO; - gets
R, Spair from the VECRO; - verifies
RmatchesRfromR, S; - stops if not;
- verifies
R, Sis a signature of themessageby the VECRO's public key; - stops if not;
- uses
Sas a verified random value.
And there are a few important things here.
For a VECRO:
Rmust be unique;Rmust be used only once.
For a client:
- VECRO must be chosen prior a
messagegeneration; rseedmust be chosen prior amessagegeneration;Rthat correspondsrseedmust appear prior amessagegeneration.
This is done to ensure that when the message is ready, no one can manipulate S as the final result.
VECRO needs a few additional cryptographic library functions:
- to produce
Rvalue based onrseedand the VECRO's private key; - to produce
R, Spair based on amessage, the VECRO's private key andrseed; Rvalues in both calls must be equal ifrseedis equal;R, Smust be amessagesignature which is verifiable by VECRO's public key.
Beware of direct rseed usage, rseed which goes to R generation must include all available static identificators, such as addresses, keys and other fixed parameters.
Reference implementation @ deemru / curve25519-php:
- interface: curve25519.php #L379
- internal
rseedusage: curve25519.php #301
VECRO is designed to function on blockchains which have smart contracts which allow:
- to publish VECRO's public key once and for all;
- to publish
Rvalue identified by client'srseed, public key and transaction id; - to overwrite
Rvalue byR, Spair only if there is a transaction with the same client's public key, with the samerseed, with amessagefor whichR, Sis a signature verified by VECRO's public key.