3

I'm just starting with solidity and I would like to know if it can be used to verify a ECDSA signature. I saw topics about secp256r1 but I was curious to know if it would work on other curves (prime256v1 to be precise).

Let's say I have the public key used, the signature and the input used for the signature; is there a way with solidity to compute all this to know if the signature corresponds ?

Thanks for your responses !

2 Answers 2

3

Unfortunately, the precompile that allows for ECDSA signature verification only works for the secp256k1 curve. There is no practical way to do EC operations on other curves, like prime256v1, except to build the operations yourself, which would likely be quite expensive.

1

If you are still interested in working with SECP256R1 signatures for Ethereum, check out https://github.com/tdrerup/elliptic-curve-solidity; The repo contains a pure Solidity implementation of curve SECP256R1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.