-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with RustCypto/traits/elliptic-curve trait Curve
on API side.
#492
Comments
trait Curve
on API side.
What do you want this for specifically? Are you looking for compatibility with e.g. Note that #473 adds trait impls that |
ecdh |
The |
I also would vouch for this feature. I believe a standard trait that multiple elliptic curves implement is needed. ECDH is one usecase, implementing a geneeic ECIES is another, but I'm thinking more broadly -- for generic signature code, and even more specifically TSS (MPC) code running on generic curves. ZenGo's curv is an alternative for that, however there are no compatibility between curv's Curve and Rust Crypto's Curve. |
The difficult part is different use cases require different traits.
We have the https://github.com/RustCrypto/traits/tree/master/kem
We have the |
Thanks for the reply.
|
ECDH is just scalar multiplication, and as I mentioned earlier that's covered by combining the That's all the
The traits are for KEMs which can be used for hybrid encryption. If you don't consider hybrid encryption under the purview of asymmetric encryption, aside from El Gamal (which is rarely used), there aren't really asymmetric cryptosystems which work across algorithms. That's why the NIST PQcrypto competition focused on KEMs.
ECIES is just one example of hybrid encryption. HPKE is an effort to standardize hybrid encryption, and the Rust HPKE implementation is built on the
Different elliptic curves have wildly different properties and not all signature systems work for all elliptic curves. ECDSA requires prime order elliptic curves. EdDSA requires Edwards curves. The Getting things to work in a generic manner at all requires extremely careful design to prevent incompatibilities between the underlying elliptic curve type and the signature algorithm.
RSA-KEM and (EC)DH-based KEMs can both be used with the KEMs are the modern API for asymmetric encryption.
Cryptography has a litany of ways in which it can be generically composed, but that all depends on the specific properties of algorithms. As you can see at https://github.com/rustcrypto/traits we have a large number of traits for the different subcomponents of cryptosystems, and they're designed to cover much more than just elliptic curves.
If #473 were to land, what are you missing? |
Thanks for the detailed response, it was very helpful and got my along pretty far, but I'm stuck again now. Here are my thoughts;
But besides not working with RustCrypto traits, it also lacks some features that currently make it impossible for me to implement my logic (e.g. the Kem::PublicKey type does implement PartialEq, which makes it impossible for me to find a public key in a list of public keys. This is one example but I've already opened three issues which haven't been tended to yet). (I understand that this implies software-only public, private keys but that's OK for some use-cases, as for mine.) I understand this is a lot, but I really envision a unified ecosystem of Rust crypto's libraries and it is not the case right now. And I would love to help make it so. |
Pinging @rozbb about HPKE questions |
Oh, and I would have liked Kem to be derived from the same curve too and work with the same Public, PrivateKey structs. |
Ideally, what is now:
I think that, given that the only three real building blocks are curve, ahead and digest, it would make sense everything else could be derived from it. |
Opened an issue for rust-hpke working directly with RustCrypto traits rozbb/rust-hpke#37 In any case @tarcieri I think the main issue I described is not with rust-hpke but with curve25519-dalek which needs to support the |
…but that’s a marker trait for prime order curves, which Curve25519 isn’t |
I checked before writing this-from Wikipedia; What am I missing? and perhaps the fact it is not prime shouldn't effect our purpose and we can simply work with CurveArithmetic? |
Thank you, that'll be appreciated. Happy to help & contribute if that's needed |
^^^ the subgroup. There are a total of 8 such subgroups, i.e. Curve25519 is cofactor-8 |
@rozbb that's fine for making the implementation of the prime order subgroup work, however...
When a curve has a cofactor, the security of such protocols can be broken in the presence of low order points. Making protocols secure in the presence of such points requires adding checks that e.g. a given point is a member of the prime order subgroup. |
Thanks that's helpful. One of those things that are brushed over in papers and could lead to serious security issues in the implementation. What about implementing |
That's a possibility, although |
I guess it is a possibility to work with ff and group instead of working with curve arithmetic in general. But it's probably better to have both options, so that users that need to assure the group is an elliptic curve, may. |
Any updates here? Still highly valuable for me |
#473 needs to land first |
@tarcieri Is there any plan for this currently?, I can help push this over the line. The consensus is to implement the |
Nobody is working on it to my knowledge. Feel free to open a PR. |
like it was done for P-521 ?
The text was updated successfully, but these errors were encountered: