Skip to content

Conversation

@aumetra
Copy link
Contributor

@aumetra aumetra commented Nov 1, 2022

Adds an initial implementation of Ethereum-style recoverable signatures that's generic over the underlying curve.
This is mostly a port of the code in the k256 crate adapted to work generically.

"Marked ready for review" checklist:

  • Implementation of the algorithm to recover verifying keys
  • Implementation of SignatureEncoding for the recoverable signature
  • More granular cfg flags
  • Implementation of the signer and verifier traits on the key types for the new RecoverySignature
  • Update the internal ECDSA logic to actually emit a RecoveryId (instead of always returning None)

Trial recovery was tested with P256 and P384 and their respective preferred digest

Closes #525

@tarcieri
Copy link
Member

tarcieri commented Nov 1, 2022

@aumetra I was just about to take a look at implementing something like this

I'd prefer not to define a separate Signature type, but adding the relevant methods to Signature and VerifyingKey itself

@aumetra
Copy link
Contributor Author

aumetra commented Nov 1, 2022

Sure, the implementation shouldn't be too difficult to move to the existing Signature type. How would we handle serialisation?

Should the SignatureEncoding implementation just emit the recovery ID byte or should it only be included via a special associated method like a theoretical to_bytes_recoverable?

@tarcieri
Copy link
Member

tarcieri commented Nov 1, 2022

@aumetra that was my plan, yes.

I was planning on working on it this weekend, as part of a larger effort to move to signature 2.0

@aumetra
Copy link
Contributor Author

aumetra commented Nov 1, 2022

Oh I see, if you feel more comfortable doing it yourself you can just take whatever I implemented so far (if it's of any use to you) and base it off of that, I don't mind

@tarcieri
Copy link
Member

tarcieri commented Nov 2, 2022

Closing in favor of #576

@tarcieri tarcieri closed this Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ecdsa: VerifyingKey recovery support

2 participants