Bitcoin ABC  0.24.7
P2P Digital Currency
Typedefs | Functions
sigencoding.cpp File Reference
#include <script/sigencoding.h>
#include <pubkey.h>
#include <script/script_flags.h>
#include <boost/range/adaptor/sliced.hpp>
Include dependency graph for sigencoding.cpp:

Go to the source code of this file.

Typedefs

typedef boost::sliced_range< const valtypeslicedvaltype
 

Functions

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 not negative (their first byte has its highest bit not set), and not excessively padded (do not start with a 0 byte, unless an otherwise negative number follows, in which case a single 0 byte is necessary and even required). More...
 
static bool IsSchnorrSig (const slicedvaltype &sig)
 
static bool CheckRawECDSASignatureEncoding (const slicedvaltype &sig, uint32_t flags, ScriptError *serror)
 
static bool CheckRawSchnorrSignatureEncoding (const slicedvaltype &sig, uint32_t flags, ScriptError *serror)
 
static bool CheckRawSignatureEncoding (const slicedvaltype &sig, uint32_t flags, ScriptError *serror)
 
bool CheckDataSignatureEncoding (const valtype &vchSig, uint32_t flags, ScriptError *serror)
 Check that the signature provided on some data is properly encoded. More...
 
static bool CheckSighashEncoding (const valtype &vchSig, uint32_t flags, ScriptError *serror)
 
template<typename F >
static bool CheckTransactionSignatureEncodingImpl (const valtype &vchSig, uint32_t flags, ScriptError *serror, F fun)
 
bool CheckTransactionSignatureEncoding (const valtype &vchSig, uint32_t flags, ScriptError *serror)
 Check that the signature provided to authentify a transaction is properly encoded. More...
 
bool CheckTransactionECDSASignatureEncoding (const valtype &vchSig, uint32_t flags, ScriptError *serror)
 Check that the signature provided to authentify a transaction is properly encoded ECDSA signature. More...
 
bool CheckTransactionSchnorrSignatureEncoding (const valtype &vchSig, uint32_t flags, ScriptError *serror)
 Check that the signature provided to authentify a transaction is properly encoded Schnorr signature (or null). More...
 
static bool IsCompressedOrUncompressedPubKey (const valtype &vchPubKey)
 
bool CheckPubKeyEncoding (const valtype &vchPubKey, uint32_t flags, ScriptError *serror)
 Check that a public key is encoded properly. More...
 

Typedef Documentation

◆ slicedvaltype

typedef boost::sliced_range<const valtype> slicedvaltype

Definition at line 14 of file sigencoding.cpp.

Function Documentation

◆ CheckDataSignatureEncoding()

bool CheckDataSignatureEncoding ( const valtype vchSig,
uint32_t  flags,
ScriptError serror 
)

Check that the signature provided on some data is properly encoded.

Signatures passed to OP_CHECKDATASIG and its verify variant must be checked using this function.

Definition at line 202 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckPubKeyEncoding()

bool CheckPubKeyEncoding ( const valtype vchPubKey,
uint32_t  flags,
ScriptError serror 
)

Check that a public key is encoded properly.

Definition at line 305 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckRawECDSASignatureEncoding()

static bool CheckRawECDSASignatureEncoding ( const slicedvaltype sig,
uint32_t  flags,
ScriptError serror 
)
static

Definition at line 160 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckRawSchnorrSignatureEncoding()

static bool CheckRawSchnorrSignatureEncoding ( const slicedvaltype sig,
uint32_t  flags,
ScriptError serror 
)
static

Definition at line 183 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckRawSignatureEncoding()

static bool CheckRawSignatureEncoding ( const slicedvaltype sig,
uint32_t  flags,
ScriptError serror 
)
static

Definition at line 192 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckSighashEncoding()

static bool CheckSighashEncoding ( const valtype vchSig,
uint32_t  flags,
ScriptError serror 
)
static

Definition at line 214 of file sigencoding.cpp.

Here is the caller graph for this function:

◆ CheckTransactionECDSASignatureEncoding()

bool CheckTransactionECDSASignatureEncoding ( const valtype vchSig,
uint32_t  flags,
ScriptError serror 
)

Check that the signature provided to authentify a transaction is properly encoded ECDSA signature.

Signatures passed to OP_CHECKMULTISIG and its verify variant must be checked using this function.

Definition at line 265 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckTransactionSchnorrSignatureEncoding()

bool CheckTransactionSchnorrSignatureEncoding ( const valtype vchSig,
uint32_t  flags,
ScriptError serror 
)

Check that the signature provided to authentify a transaction is properly encoded Schnorr signature (or null).

Signatures passed to the new-mode OP_CHECKMULTISIG and its verify variant must be checked using this function.

Definition at line 277 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckTransactionSignatureEncoding()

bool CheckTransactionSignatureEncoding ( const valtype vchSig,
uint32_t  flags,
ScriptError serror 
)

Check that the signature provided to authentify a transaction is properly encoded.

Signatures passed to OP_CHECKSIG and its verify variant must be checked using this function.

Definition at line 254 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckTransactionSignatureEncodingImpl()

template<typename F >
static bool CheckTransactionSignatureEncodingImpl ( const valtype vchSig,
uint32_t  flags,
ScriptError serror,
fun 
)
static

Definition at line 236 of file sigencoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsCompressedOrUncompressedPubKey()

static bool IsCompressedOrUncompressedPubKey ( const valtype vchPubKey)
static

Definition at line 289 of file sigencoding.cpp.

Here is the caller graph for this function:

◆ IsSchnorrSig()

static bool IsSchnorrSig ( const slicedvaltype sig)
static

Definition at line 156 of file sigencoding.cpp.

Here is the caller graph for this function:

◆ IsValidDERSignatureEncoding()

static bool IsValidDERSignatureEncoding ( const slicedvaltype sig)
static

A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> , where R and S are not negative (their first byte has its highest bit not set), and not excessively padded (do not start with a 0 byte, unless an otherwise negative number follows, in which case a single 0 byte is necessary and even required).

See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623

This function is consensus-critical since BIP66.

Definition at line 27 of file sigencoding.cpp.

Here is the caller graph for this function: