axelarnetwork / tofn

A threshold cryptography library in Rust
Apache License 2.0
107 stars 22 forks source link

Use k256 native serde support #197

Open ggutoski opened 2 years ago

ggutoski commented 2 years ago

The next release of k256 will support serde. https://github.com/RustCrypto/elliptic-curves/pull/464 With that we can delete our k256_serde module! 🥳

tarcieri commented 2 years ago

k256 v0.10.0 is out with native serde support:

thor314 commented 2 years ago

We've forked this library, and updated dependencies. Would you accept a pull request updating them? @ggutoski https://github.com/Entropyxyz/tofn

ggutoski commented 2 years ago

Sure! Happy to take a look. Updating dependencies has been on the to-do list for a while.

thor314 commented 2 years ago

alright. Need to clean up a bit, and a pull is on the way.

thor314 commented 2 years ago

pull is here https://github.com/axelarnetwork/tofn/pull/203

tarcieri commented 2 years ago

Let me know if you encounter any issues with this. We've had some problems with various serde format implementations.

FWIW we'll be migrating to this in a forthcoming update to the elliptic-curve crate (i.e. v0.12, which will probably be out in the next few months):

https://github.com/RustCrypto/formats/tree/master/serdect

thor314 commented 2 years ago

@tarcieri, looks like k256 supports serialization for AffinePoint, Scalar, and VerifyingKey, but not ProjectivePoint. Why is that?

tarcieri commented 2 years ago

@thor314 probably an oversight, although FWIW the implementation would be converting the ProjectivePoint to an AffinePoint and serializing that.

ProjectivePoint is a convenient representation for arithmetic, whereas AffinePoint is more of the "serialization type"

thor314 commented 2 years ago

@tarcieri, simple enough. Would it be helpful if I submitted a pull to k256 with that feature?

tarcieri commented 2 years ago

sure, that's fine. however master has the v0.11.0-pre branch of k256 and we don't have separate branches for older versions, so it won't get into k256 until the next release

thor314 commented 2 years ago

@tarcieri what branch should I submit the k256 feature to?

tarcieri commented 2 years ago

master