MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / VerifyECDSA

Method VerifyECDSA

src/pubkey.cpp:182–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182bool CPubKey::VerifyECDSA(const uint256 &hash,
183 const std::vector<uint8_t> &vchSig) const {
184 if (!IsValid()) {
185 return false;
186 }
187
188 secp256k1_pubkey pubkey;
189 secp256k1_ecdsa_signature sig;
190 if (!secp256k1_ec_pubkey_parse(secp256k1_context_static, &pubkey, vch,
191 size())) {
192 return false;
193 }
194 if (!ecdsa_signature_parse_der_lax(&sig, vchSig.data(), vchSig.size())) {
195 return false;
196 }
197 /**
198 * libsecp256k1's ECDSA verification requires lower-S signatures, which have
199 * not historically been enforced in Bitcoin, so normalize them first.
200 */
201 secp256k1_ecdsa_signature_normalize(secp256k1_context_static, &sig, &sig);
202 return secp256k1_ecdsa_verify(secp256k1_context_static, &sig, hash.begin(),
203 &pubkey);
204}
205
206bool CPubKey::VerifySchnorr(
207 const uint256 &hash, const std::array<uint8_t, SCHNORR_SIZE> &sig) const {

Callers 4

VerifyPubKeyMethod · 0.80
VerifySignatureMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
FUZZ_TARGET_INITFunction · 0.80

Calls 8

sizeFunction · 0.70
secp256k1_ecdsa_verifyFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
FUZZ_TARGET_INITFunction · 0.64