2

Are there any libraries to get a public key from a signature in a smart contract? The ecrecover method returns an address, not a public key, and to do computations that need to derive a public key from a signature, where the public key is not known and not passed into the contract by other means, while the signature is known, it would be good to have a library that gets the public key from a signature.

Partial libraries would also be helpful here.

0

There's a library https://github.com/jbaylina/ecsol that implement some operations over elliptic curves in solidity.

I didn't try but it appears to have enough to implement public key recovery. But I'm not sure if the gas limit will allow such operation.

In any case the problem seems interesting, but it is equivalent to obtaining a preimage from keccak.

1

There isn't a built in way to do this in Solidity and I don't believe there exists a library to do it either. Out of curiosity, what is your reason for needing to get the public key instead of the address?

  • a third version of this bounty, etherscan.io/address/… where a symmetric key is passed into the contract instead of a public key, and the public key (used to solve another cipher) is derived from a signature of an account identifier – schnorr Feb 28 '18 at 14:02
  • a signature scheme using one-time keys, calling it "teikhos", from the Greek for "fortification", it hides the asymmetric cryptography behind an unbreakable symmetric cipher (only breakable by brute forcing all possible combinations) – schnorr Feb 28 '18 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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