voprf-poc
voprf-poc copied to clipboard
Process (V)OPRF test vectors as part of unit tests
Problem
Currently test vector outputs for a full VOPRF invocation have to be verified manually by running both a HTTP server & client for both the rust and go versions of the code.
Task summary
Generate expected values for each of the test vector inputs on full VOPRF executions between a server and a client. The unit tests should verify that the expected values are correct. In other words, the tests should emulate a full VOPRF execution and then check that the outputs in the test are equivalent to the expected values.
The expected values should include the finalized outputs
of the protocol, as well as the proof
values. In particular, we define the output of the protocol to be the output of the Finalize
algorithm. The proof
values are defined as part of the Eval
algorithm when running the VOPRF functionality.
These values should be stored in the test vectors files as new members of each of the JSON objects.
Note: we do not necessarily have to define test vectors for the simpler OPRF case (non-verifiable), as the functionality is strictly weaker. Thus it is checked when running the more expressive VOPRF.
Milestones
- [x] Generate expected results for each test vector from each ciphersuite and add them to existing test vector data structures.
- [ ] Write unit tests that take test vector inputs and check that the computed outputs and DLEQ proof values match against the expected results when running end-to-end VOPRF tests.
- [x] rust
- [ ] go
Extensions
- [ ] Create a separate program that automatically generates test vector inputs and runs the references implementations to compute expected results and add these to test vector files.
- [ ] Modify test vector generation program to also output test vectors in ASCII format for adding to https://datatracker.ietf.org/doc/draft-irtf-cfrg-voprf/.
Useful links
- Draft documentation: https://datatracker.ietf.org/doc/draft-irtf-cfrg-voprf/
- Existing test vectors: https://github.com/alxdavids/voprf-poc/tree/master/test-vectors
- VOPRF unit tests (rust): https://github.com/alxdavids/voprf-poc/blob/master/rust/src/oprf/mod.rs#L471
- VOPRF unit tests (go): https://github.com/alxdavids/voprf-poc/blob/master/go/oprf/oprf_test.go
Thanks for your work @mskd12! I've updated the issue with what has been completed. I'm going to take a stab at writing similar tests in golang.
@mskd12 If you were interested in integrating your program for updating the expected values in the test vectors into this repository in a way that we could update the vectors periodically, that would be really useful.
@alxdavids, sure, I will add that file to the test-vectors directory!