| 159 | } |
| 160 | |
| 161 | bool 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 | |
| 179 | bool CPubKey::VerifySchnorr(const uint256 &hash, |
| 180 | const std::vector<uint8_t> &vchSig) const |
no test coverage detected