8 #include <secp256k1_recovery.h> 13 : context_(secp256k1_context_create(SECP256K1_CONTEXT_SIGN
14 | SECP256K1_CONTEXT_VERIFY),
15 secp256k1_context_destroy) {}
17 outcome::result<secp256k1::UncompressedPublicKey>
23 size_t outputlen = pubkey_out.
size();
26 != secp256k1_ec_pubkey_serialize(
context_.get(),
30 SECP256K1_EC_UNCOMPRESSED)) {
37 outcome::result<secp256k1::CompressedPublicKey>
46 != secp256k1_ec_pubkey_serialize(
context_.get(),
50 SECP256K1_EC_COMPRESSED)) {
84 secp256k1_ecdsa_recoverable_signature sig_rec;
85 secp256k1_pubkey pubkey;
88 != secp256k1_ecdsa_recoverable_signature_parse_compact(
89 context_.get(), &sig_rec, signature.data(), rec_id)) {
94 != secp256k1_ecdsa_recover(
95 context_.get(), &pubkey, &sig_rec, message_hash.data())) {
107 return "invalid argument occured";
109 return "invalid V value of an RSV signature";
111 return "invalid R or S value of an RSV signature";
113 return "invalid RSV signature";
115 return "public key recovery operation failed";
117 return "unknown Secp256k1ProviderError error occured";
outcome::result< secp256k1_pubkey > recoverPublickey(const secp256k1::RSVSignature &signature, const secp256k1::MessageHash &message_hash) const
outcome::result< int > validateRecoveryId(int v)
OUTCOME_CPP_DEFINE_CATEGORY(kagome::crypto, Secp256k1ProviderError, e)
outcome::result< secp256k1::UncompressedPublicKey > recoverPublickeyUncompressed(const secp256k1::RSVSignature &signature, const secp256k1::MessageHash &message_hash) const override
recover public key in uncompressed form
std::unique_ptr< secp256k1_context, void(*)(secp256k1_context *)> context_
outcome::result< secp256k1::CompressedPublicKey > recoverPublickeyCompressed(const secp256k1::RSVSignature &signature, const secp256k1::MessageHash &message_hash) const override
recover public key in compressed form
static constexpr size_t size()