So I'm trying to find a way to sign a message with a certain private key, and then to be able to recover it's corresponding public key/address on both Ethereum and EOS. The thing is I'm having some trouble understanding how signatures are constructed in EOS. How are EOS's signatures different than Ethereum's other than:
- being base58 encoded, rather than a hexadecimal.
- being prefixed with 'SIG_K1_'
So far I've tried recovering public keys using Ethereum's ecrecover function, and using this piece of code on EOS:
ACTION DaVerifier::ecverify(std::string data, const capi_signature &sig)
{
capi_checksum256 digest;
sha256(&data[0], data.size(), &digest);
uint8_t pub[34];
auto res = recover_key(&digest, (char *)&sig, sizeof(sig), (char*)pub, 34);
printhex(pub, sizeof(pub));
}
Any help?