Changeset View
Changeset View
Standalone View
Standalone View
src/pubkey.h
Show All 19 Lines | |||||
/** A reference to a CKey: the Hash160 of its serialized public key */ | /** A reference to a CKey: the Hash160 of its serialized public key */ | ||||
class CKeyID : public uint160 { | class CKeyID : public uint160 { | ||||
public: | public: | ||||
CKeyID() : uint160() {} | CKeyID() : uint160() {} | ||||
explicit CKeyID(const uint160 &in) : uint160(in) {} | explicit CKeyID(const uint160 &in) : uint160(in) {} | ||||
}; | }; | ||||
typedef uint256 ChainCode; | using ChainCode = uint256; | ||||
/** An encapsulated public key. */ | /** An encapsulated public key. */ | ||||
class CPubKey { | class CPubKey { | ||||
public: | public: | ||||
/** | /** | ||||
* secp256k1: | * secp256k1: | ||||
*/ | */ | ||||
static constexpr unsigned int SIZE = 65; | static constexpr unsigned int SIZE = 65; | ||||
static constexpr unsigned int COMPRESSED_SIZE = 33; | static constexpr unsigned int COMPRESSED_SIZE = 33; | ||||
static constexpr unsigned int SCHNORR_SIZE = 64; | |||||
static constexpr unsigned int SIGNATURE_SIZE = 72; | static constexpr unsigned int SIGNATURE_SIZE = 72; | ||||
static constexpr unsigned int COMPACT_SIGNATURE_SIZE = 65; | static constexpr unsigned int COMPACT_SIGNATURE_SIZE = 65; | ||||
/** | /** | ||||
* see www.keylength.com | * see www.keylength.com | ||||
* script supports up to 75 for single byte push | * script supports up to 75 for single byte push | ||||
*/ | */ | ||||
static_assert(SIZE >= COMPRESSED_SIZE, | static_assert(SIZE >= COMPRESSED_SIZE, | ||||
"COMPRESSED_SIZE is larger than SIZE"); | "COMPRESSED_SIZE is larger than SIZE"); | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | public: | ||||
bool VerifyECDSA(const uint256 &hash, | bool VerifyECDSA(const uint256 &hash, | ||||
const std::vector<uint8_t> &vchSig) const; | const std::vector<uint8_t> &vchSig) const; | ||||
/** | /** | ||||
* Verify a Schnorr signature (=64 bytes). | * Verify a Schnorr signature (=64 bytes). | ||||
* If this public key is not fully valid, the return value will be false. | * If this public key is not fully valid, the return value will be false. | ||||
*/ | */ | ||||
bool VerifySchnorr(const uint256 &hash, | bool VerifySchnorr(const uint256 &hash, | ||||
const std::array<uint8_t, SCHNORR_SIZE> &sig) const; | |||||
bool VerifySchnorr(const uint256 &hash, | |||||
const std::vector<uint8_t> &vchSig) const; | const std::vector<uint8_t> &vchSig) const; | ||||
/** | /** | ||||
* Check whether a DER-serialized ECDSA signature is normalized (lower-S). | * Check whether a DER-serialized ECDSA signature is normalized (lower-S). | ||||
*/ | */ | ||||
static bool | static bool | ||||
CheckLowS(const boost::sliced_range<const std::vector<uint8_t>> &vchSig); | CheckLowS(const boost::sliced_range<const std::vector<uint8_t>> &vchSig); | ||||
static bool CheckLowS(const std::vector<uint8_t> &vchSig) { | static bool CheckLowS(const std::vector<uint8_t> &vchSig) { | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |