MCPcopy Create free account
hub / github.com/LUX-Core/lux / VerifyECDSA

Method VerifyECDSA

src/pubkey.cpp:161–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161bool CPubKey::VerifyECDSA(const uint256& hash, const std::vector<uint8_t>& vchSig) const
162{
163 if (!IsValid())
164 return false;
165 secp256k1_pubkey pubkey;
166 secp256k1_ecdsa_signature sig;
167 if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
168 return false;
169 }
170 if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) {
171 return false;
172 }
173 /* libsecp256k1's ECDSA verification requires lower-S signatures, which have
174 * not historically been enforced in Bitcoin, so normalize them first. */
175 secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, &sig, &sig);
176 return secp256k1_ecdsa_verify(secp256k1_context_verify, &sig, hash.begin(), &pubkey);
177}
178
179bool CPubKey::VerifySchnorr(const uint256 &hash,
180 const std::vector<uint8_t> &vchSig) const

Callers 4

CheckSignatureMethod · 0.80
VerifyPubKeyMethod · 0.80
VerifySignatureMethod · 0.80
CheckBlockSignatureMethod · 0.80

Calls 8

sizeFunction · 0.85
secp256k1_ecdsa_verifyFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected