-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
Currently KeGroup is implemented on what represents the public key of a curve, the RistrettoPoint for ristretto255, ProjectivePoint for P-256 and MontgomaryPoint for X25519. When I switched to higher-level implementation for #250 I realized that we potentially don't even need a custom trait anymore.
elliptic_curve::PublicKey requires a type that implements Curve and ProjectiveArithmetic for example.
We can't actually use those because the current ristretto255 implementation we use doesn't implement any of these traits. So instead I'm proposing the following:
- Change
KeGroupto not be implemented on the public key, but on a trait that is supposed to implementCurveandProjectiveArithmetic. We introduce two associated types for a public and secret key. - We can't provide a blanket implement of
KeGroupfor anything that satisfies the right trait, because we lack specialization to also provide a custom implementation forRistrettoPoint, but we can provide a simple template as an example. - In the future, when curve25519-dalek implements the necessary traits, we can do a blanket implementation and basically remove all curve dependencies and associated crate features. Unless Rust stabilizes specialization first, lol.
This idea can also be implemented for voprf.
This is a proposal, I am planning to do the implementation as soon as this is approved.
Metadata
Metadata
Assignees
Labels
No labels