MCPcopy Create free account
hub / github.com/ElementsProject/elements / CheckECDSASignature

Method CheckECDSASignature

src/script/generic.hpp:22–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21 SimpleSignatureChecker(const uint256& hashIn, bool sighash_byte_in) : hash(hashIn), sighash_byte(sighash_byte_in) {};
22 bool CheckECDSASignature(const std::vector<unsigned char>& vchSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode, SigVersion sigversion, unsigned int flags) const override
23 {
24 std::vector<unsigned char> vchSigCopy(vchSig);
25 CPubKey pubkey(vchPubKey);
26 if (!pubkey.IsValid())
27 return false;
28 if (vchSig.empty())
29 return false;
30 // Get rid of sighash byte before verifying hash
31 // Note: We only accept SIGHASH_ALL!
32 if (sighash_byte) {
33 const unsigned char popped_byte = vchSigCopy.back();
34 vchSigCopy.pop_back();
35 if (popped_byte != SIGHASH_ALL) {
36 return false;
37 }
38 }
39 return pubkey.Verify(hash, vchSig);
40 }
41};
42
43class SimpleSignatureCreator : public BaseSignatureCreator

Callers

nothing calls this directly

Calls 4

IsValidMethod · 0.45
emptyMethod · 0.45
pop_backMethod · 0.45
VerifyMethod · 0.45

Tested by

no test coverage detected