12#include <boost/range/adaptor/sliced.hpp>
40 if (
sig.size() < 8 ||
sig.size() > 72) {
57 if (
sig[1] !=
sig.size() - 2) {
101 if (
lenR > 1 && (
sig[4] == 0x00) && !(
sig[5] & 0x80)) {
157 return sig.size() == 64;
290 switch (vchPubKey.size()) {
293 return vchPubKey[0] == 0x02 || vchPubKey[0] == 0x03;
297 return vchPubKey[0] == 0x04;
static constexpr unsigned int COMPRESSED_SIZE
static constexpr unsigned int SIZE
secp256k1:
static bool CheckLowS(const boost::sliced_range< const std::vector< uint8_t > > &vchSig)
Check whether a DER-serialized ECDSA signature is normalized (lower-S).
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
@ SCRIPT_VERIFY_STRICTENC
@ SCRIPT_ENABLE_SIGHASH_FORKID
bool CheckTransactionSchnorrSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded Schnorr signature (...
bool CheckDataSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided on some data is properly encoded.
static bool CheckTransactionSignatureEncodingImpl(const valtype &vchSig, uint32_t flags, ScriptError *serror, F fun)
static bool CheckRawSignatureEncoding(const slicedvaltype &sig, uint32_t flags, ScriptError *serror)
bool CheckTransactionECDSASignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded ECDSA signature.
static bool IsValidDERSignatureEncoding(const slicedvaltype &sig)
A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> , where R and S are n...
static bool CheckRawECDSASignatureEncoding(const slicedvaltype &sig, uint32_t flags, ScriptError *serror)
static bool IsCompressedOrUncompressedPubKey(const valtype &vchPubKey)
static bool IsSchnorrSig(const slicedvaltype &sig)
bool CheckTransactionSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded.
static bool CheckSighashEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
bool CheckPubKeyEncoding(const valtype &vchPubKey, uint32_t flags, ScriptError *serror)
Check that a public key is encoded properly.
boost::sliced_range< const valtype > slicedvaltype
static bool CheckRawSchnorrSignatureEncoding(const slicedvaltype &sig, uint32_t flags, ScriptError *serror)
std::vector< uint8_t > valtype