MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / Verify

Method Verify

src/pubkey.cpp:169–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
170 if (!IsValid())
171 return false;
172 secp256k1_pubkey pubkey;
173 secp256k1_ecdsa_signature sig;
174 if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, vch, size())) {
175 return false;
176 }
177 if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) {
178 return false;
179 }
180 /* libsecp256k1's ECDSA verification requires lower-S signatures, which have
181 * not historically been enforced in Bitcoin, so normalize them first. */
182 secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, &sig, &sig);
183 return secp256k1_ecdsa_verify(secp256k1_context_verify, &sig, hash.begin(), &pubkey);
184}
185
186bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned char>& vchSig) {
187 if (vchSig.size() != COMPACT_SIGNATURE_SIZE)

Callers 1

VerifyPubKeyMethod · 0.45

Calls 7

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

Tested by

no test coverage detected