Skip to content
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

recoverPublicKey support #237

Open
sc0Vu opened this issue Apr 15, 2018 · 3 comments
Open

recoverPublicKey support #237

sc0Vu opened this issue Apr 15, 2018 · 3 comments

Comments

@sc0Vu
Copy link

sc0Vu commented Apr 15, 2018

Recently I try to use phpecc to sign and verify signature.

It's good, but I just wondering how could I recover public key from signed signature like nodejs elliptic library (https://github.com/indutny/elliptic/blob/master/lib/elliptic/ec/index.js#L193)?

I cannot find function to do that, could anyone help me or I can add this function to the library.

@afk11
Copy link
Member

afk11 commented Apr 15, 2018

Hate to shill my own library when I contribute to both... but are you doing bitcoin stuff? or do you need other curves as well? if just bitcoin, this is probably what you want: https://github.com/Bit-Wasp/bitcoin-php
https://github.com/Bit-Wasp/bitcoin-php/blob/master/src/Crypto/EcAdapter/Adapter/EcAdapterInterface.php#L55 and check the sign/verify examples, and create the right message hash to use along with the signature. technically, you can get it to work with other curves from phpecc if you need!

@kornrunner
Copy link
Contributor

kornrunner commented Jun 4, 2018

Would there be any interest into merging this if I attempted to port it to phpecc and submit a PR?

Thank you!

EDIT: bitcoin-php needs to be compiled as extension, and depends on other libraries that need to be installed on target system. phpecc is pure PHP solution, thus I think this feature would be appreciated

@afk11
Copy link
Member

afk11 commented Jun 4, 2018

I think it could be a reasonable addition - I'd be happy to review it! Maybe you want to write the signer, so we can also produce recoverable signatures also?

Could you look around for test fixtures for it also? I think it'd be nice to have a SpecBasedCurveTest for this as we do with other major routines, and having coverage over several curves & fixtures would be great. The hardcoded fixtures are official or come from other implementations, but having just a few is OK anyway.

Aside: bitcoin-php doesn't need to be compiled as an extension though, just secp256k1 :)

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

No branches or pull requests

3 participants