Bitcoin ABC  0.29.2
P2P Digital Currency
sigencoding.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Copyright (c) 2017-2019 The Bitcoin developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef BITCOIN_SCRIPT_SIGENCODING_H
8 #define BITCOIN_SCRIPT_SIGENCODING_H
9 
10 #include <script/script_error.h>
11 #include <script/sighashtype.h>
12 
13 #include <cstdint>
14 #include <vector>
15 
16 typedef std::vector<uint8_t> valtype;
17 
18 namespace {
19 
20 inline SigHashType GetHashType(const valtype &vchSig) {
21  if (vchSig.size() == 0) {
22  return SigHashType(0);
23  }
24 
25  return SigHashType(vchSig[vchSig.size() - 1]);
26 }
27 
28 } // namespace
29 
35 bool CheckDataSignatureEncoding(const valtype &vchSig, uint32_t flags,
36  ScriptError *serror);
37 
43 bool CheckTransactionSignatureEncoding(const valtype &vchSig, uint32_t flags,
44  ScriptError *serror);
45 
52  uint32_t flags,
53  ScriptError *serror);
54 
61  uint32_t flags,
62  ScriptError *serror);
63 
67 bool CheckPubKeyEncoding(const valtype &vchPubKey, uint32_t flags,
68  ScriptError *serror);
69 
70 #endif // BITCOIN_SCRIPT_SIGENCODING_H
int flags
Definition: bitcoin-tx.cpp:533
Signature hash type wrapper class.
Definition: sighashtype.h:37
ScriptError
Definition: script_error.h:11
bool CheckTransactionSchnorrSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded Schnorr signature (...
std::vector< uint8_t > valtype
Definition: sigencoding.h:16
bool CheckDataSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided on some data is properly encoded.
bool CheckTransactionECDSASignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded ECDSA signature.
bool CheckTransactionSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded.
bool CheckPubKeyEncoding(const valtype &vchPubKey, uint32_t flags, ScriptError *serror)
Check that a public key is encoded properly.