Bitcoin
|
#include <pubkey.h>
Public Member Functions | |
CPubKey () | |
Construct an invalid public key. More... | |
template<typename T > | |
void | Set (const T pbegin, const T pend) |
Initialize a public key using begin/end iterators to byte data. More... | |
template<typename T > | |
CPubKey (const T pbegin, const T pend) | |
Construct a public key using begin/end iterators to byte data. More... | |
CPubKey (const std::vector< unsigned char > &_vch) | |
Construct a public key from a byte vector. More... | |
unsigned int | size () const |
Simple read-only vector-like interface to the pubkey data. More... | |
const unsigned char * | data () const |
const unsigned char * | begin () const |
const unsigned char * | end () const |
const unsigned char & | operator[] (unsigned int pos) const |
template<typename Stream > | |
void | Serialize (Stream &s) const |
Implement serialization, as if this was a byte vector. More... | |
template<typename Stream > | |
void | Unserialize (Stream &s) |
CKeyID | GetID () const |
Get the KeyID of this public key (hash of its serialization) More... | |
uint256 | GetHash () const |
Get the 256-bit hash of this public key. More... | |
bool | IsValid () const |
bool | IsFullyValid () const |
fully validate whether this is a valid public key (more expensive than IsValid()) More... | |
bool | IsCompressed () const |
Check whether this is a compressed public key. More... | |
bool | Verify (const uint256 &hash, const std::vector< unsigned char > &vchSig) const |
bool | RecoverCompact (const uint256 &hash, const std::vector< unsigned char > &vchSig) |
Recover a public key from a compact signature. More... | |
bool | Decompress () |
Turn this public key into an uncompressed public key. More... | |
bool | Derive (CPubKey &pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode &cc) const |
Derive BIP32 child pubkey. More... | |
Static Public Member Functions | |
static bool | ValidSize (const std::vector< unsigned char > &vch) |
static bool | CheckLowS (const std::vector< unsigned char > &vchSig) |
Static Public Attributes | |
static constexpr unsigned int | PUBLIC_KEY_SIZE = 65 |
static constexpr unsigned int | COMPRESSED_PUBLIC_KEY_SIZE = 33 |
static constexpr unsigned int | SIGNATURE_SIZE = 72 |
static constexpr unsigned int | COMPACT_SIGNATURE_SIZE = 65 |
Private Member Functions | |
void | Invalidate () |
Set this key data to be invalid. More... | |
Static Private Member Functions | |
unsigned static int | GetLen (unsigned char chHeader) |
Compute the length of a pubkey with a given first byte. More... | |
Private Attributes | |
unsigned char | vch [PUBLIC_KEY_SIZE] |
Friends | |
bool | operator== (const CPubKey &a, const CPubKey &b) |
Comparator implementation. More... | |
bool | operator!= (const CPubKey &a, const CPubKey &b) |
bool | operator< (const CPubKey &a, const CPubKey &b) |
An encapsulated public key.
|
inline |
Construct an invalid public key.
|
inline |
Construct a public key using begin/end iterators to byte data.
|
inlineexplicit |
Construct a public key from a byte vector.
|
inline |
|
static |
Check whether a signature is normalized (lower-S).
|
inline |
bool CPubKey::Decompress | ( | ) |
Turn this public key into an uncompressed public key.
bool CPubKey::Derive | ( | CPubKey & | pubkeyChild, |
ChainCode & | ccChild, | ||
unsigned int | nChild, | ||
const ChainCode & | cc | ||
) | const |
Derive BIP32 child pubkey.
|
inline |
|
inline |
Get the 256-bit hash of this public key.
|
inline |
Get the KeyID of this public key (hash of its serialization)
|
inlinestaticprivate |
Compute the length of a pubkey with a given first byte.
|
inlineprivate |
Set this key data to be invalid.
|
inline |
Check whether this is a compressed public key.
bool CPubKey::IsFullyValid | ( | ) | const |
fully validate whether this is a valid public key (more expensive than IsValid())
|
inline |
|
inline |
bool CPubKey::RecoverCompact | ( | const uint256 & | hash, |
const std::vector< unsigned char > & | vchSig | ||
) |
Recover a public key from a compact signature.
|
inline |
Implement serialization, as if this was a byte vector.
|
inline |
Initialize a public key using begin/end iterators to byte data.
|
inline |
Simple read-only vector-like interface to the pubkey data.
|
inline |
|
inlinestatic |
bool CPubKey::Verify | ( | const uint256 & | hash, |
const std::vector< unsigned char > & | vchSig | ||
) | const |
Verify a DER signature (~72 bytes). If this public key is not fully valid, the return value will be false.
|
static |
|
static |
|
static |
secp256k1:
|
static |
|
private |
see www.keylength.com script supports up to 75 for single byte pushJust store the serialized data. Its length can very cheaply be computed from the first byte.