cisco / go-hpke

Implementation of draft-irtf-cfrg-hpke
BSD 2-Clause "Simplified" License
30 stars 15 forks source link

Add test vector support #6

Closed chris-wood closed 4 years ago

chris-wood commented 4 years ago

This change adds module-private interfaces that allow ephemeral key material to be recorded during execution and, during verification, injected. Two special tests are defined for generating and verifying test vectors: TestVectorGenerate and TestVectorInterop. The former writes test vectors to the file identified by the HPKE_TEST_VECTORS_OUT environment variable, or does nothing if not set. The latter reads test vectors from the file identified by the HPKE_TEST_VECTORS_IN environment variable and verifies them, or does nothing if not set. See README.md for sample usage.

Only generate test vectors for "standard" algorithms. PQC KEMs, not having backing standards (or ways to encode private keys), are unsupported.

bifurcation commented 4 years ago

I have a couple of ideas for cleaning things up, but I'll do that as a follow-up.