Specs
I am using the function recover_key
from the library crypto.h
at the following link: https://github.com/EOSIO/eos/blob/master/contracts/eosiolib/crypto.h
Code
int compressed_size = recover_key(&digest, (char *)signature, sizeof(signature),(char *)compressed, sizeof(compressed));
Error
I call the function multiple times but at a certain point, like the third time, the following function fails, with the following error:
2018-09-27T09:01:48.492 thread-0 main.cpp:3091 main ] Failed with error: Assert Exception (10) secp256k1_ecdsa_recover_compact( detail::_get_context(), (unsigned char*) digest.data(), (unsigned char*) c.begin() + 1, (unsigned char*) my->_key.begin(), (int*) &pk_len, 1, (*c.begin() - 27) & 3 ):
Additional Info
The problem is that when the function fails the parameters provided are exactly at the same format than the other two times.
What I want
How can I solve this issue? How can I make the key recovery work everytime?