Oblivious PRFs
Compute a keyed PRF on a client's input without the server seeing the input (RFC 9497).
An oblivious pseudorandom function (OPRF) lets a client learn F(key, input)
from a server that holds key, without the server learning input or the
client learning key. oxcrypto implements the three RFC 9497 modes:
- OPRF Base mode.
- VOPRF Verifiable mode: the server proves it used the key behind its public key.
- POPRF Partially oblivious mode: verifiable, with a public
infovalue both sides see.
Each mode is a selector with one value per ciphersuite:
RISTRETTO255_SHA512, P256_SHA256, P384_SHA384 and P521_SHA512.
Protocol rounds
- The client calls
blind(input)and sendsclient.blinded_element. - The server calls
key.blind_evaluate(blinded_element)and returns the evaluated element (and, in VOPRF/POPRF, a proof). - The client calls
client.finalize(...)and gets the PRF output.
blind returns a client state object. finalize consumes it: a second call
raises ValueError, whether the first call succeeded or failed. Client state
and private keys cannot be copied or pickled. key.evaluate(input) computes
the same output directly on the server.
Private keys come from generate() (operating system RNG),
derive_private_key(seed, info) (RFC 9497 DeriveKeyPair, 32-byte seed) or
load_private_bytes(data). to_bytes() returns the serialized scalar (Ns
bytes). Public keys use the compressed serialized group element (Ne bytes).
Loading requires the exact encoding: trailing bytes, uncompressed points and
short scalars raise ValueError. RFC 9497 has
no PKCS#8 or SPKI encoding for these keys, so only raw bytes are supported.
Private key equality is constant time.
Invalid keys, elements or proofs, inputs or info longer than 65535 bytes,
and failed proofs raise ValueError. Arguments that are not bytes (or the
matching key object) raise TypeError.
Upstream and status
| Standard | RFC 9497 (Informational, IRTF CFRG, December 2023) |
| Crate | voprf 0.6.0-pre.2 (pre-release), MIT, maintained by Meta (facebook/voprf) |
| Curves | voprf ristretto255 (curve25519-dalek 5); RustCrypto p256, p384, p521 0.14 |
| Audit | No published audit |
| MSRV | Rust 1.88 (builds and passes clippy with oxcrypto's 1.88 toolchain) |
| Experimental | No: RFC 9497 is final. The crate release is a pre-release. |
| Vectors | RFC 9497 Appendix A |
Constant-time behavior comes from voprf and the curve crates; oxcrypto has
not verified it independently.
Zeroization
What oxcrypto keeps after a call:
- Private keys hold a
voprfserver (OprfServer,VoprfServer,PoprfServer). Its scalar is wiped on drop by the upstreamZeroizeOnDropimplementation. - Client state holds a
voprfclient (blind scalar and blinded element, wiped on drop upstream) and a copy of the input in a zeroizing buffer.finalizedrops both. - Exported key bytes and PRF outputs pass through zeroizing buffers before
they become Python
bytes.
Zeroization does not cover:
- Inputs,
info, keys and outputs as Pythonbytes. Python owns these and oxcrypto does not wipe them. - Short-lived copies inside
voprfand the curve crates during a call: the random seed ingenerate(),DeriveKeyPairintermediates, the proof nonce and challenge scalars, the POPRF tweaked scalar, the unblinded element and hash-input buffers infinalize, and field and scalar temporaries on the stack or in registers. - Copies left behind when Rust moves the server or client into the object.
VoprfServer::blind_evaluate panics if the RNG fails; oxcrypto surfaces this
as a Python pyo3_runtime.PanicException.
Treat zeroization as defense in depth. It does not guarantee that secrets are gone from process memory.