An encapsulated public key.
More...
#include <pubkey.h>
|
| CPubKey () |
| Construct an invalid public key.
|
|
template<typename T > |
void | Set (const T pbegin, const T pend) |
| Initialize a public key using begin/end iterators to byte data.
|
|
template<typename T > |
| CPubKey (const T pbegin, const T pend) |
| Construct a public key using begin/end iterators to byte data.
|
|
| CPubKey (Span< const uint8_t > _vch) |
| Construct a public key from a byte vector.
|
|
unsigned int | size () const |
| Simple read-only vector-like interface to the pubkey data.
|
|
const uint8_t * | data () const |
|
const uint8_t * | begin () const |
|
const uint8_t * | end () const |
|
const uint8_t & | operator[] (unsigned int pos) const |
|
template<typename Stream > |
void | Serialize (Stream &s) const |
| Implement serialization, as if this was a byte vector.
|
|
template<typename Stream > |
void | Unserialize (Stream &s) |
|
CKeyID | GetID () const |
| Get the KeyID of this public key (hash of its serialization)
|
|
uint256 | GetHash () const |
| Get the 256-bit hash of this public key.
|
|
bool | IsValid () const |
|
bool | IsFullyValid () const |
| fully validate whether this is a valid public key (more expensive than IsValid())
|
|
bool | IsCompressed () const |
| Check whether this is a compressed public key.
|
|
bool | VerifyECDSA (const uint256 &hash, const std::vector< uint8_t > &vchSig) const |
| Verify a DER-serialized ECDSA signature (~72 bytes).
|
|
bool | VerifySchnorr (const uint256 &hash, const std::array< uint8_t, SCHNORR_SIZE > &sig) const |
| Verify a Schnorr signature (=64 bytes).
|
|
bool | VerifySchnorr (const uint256 &hash, const std::vector< uint8_t > &vchSig) const |
|
bool | RecoverCompact (const uint256 &hash, const std::vector< uint8_t > &vchSig) |
| Recover a public key from a compact ECDSA signature.
|
|
bool | Decompress () |
| Turn this public key into an uncompressed public key.
|
|
bool | Derive (CPubKey &pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode &cc) const |
| Derive BIP32 child pubkey.
|
|
|
uint8_t | vch [SIZE] |
| see www.keylength.com script supports up to 75 for single byte push
|
|
An encapsulated public key.
Definition at line 31 of file pubkey.h.
◆ CPubKey() [1/3]
Construct an invalid public key.
Definition at line 75 of file pubkey.h.
◆ CPubKey() [2/3]
CPubKey::CPubKey |
( |
const T |
pbegin, |
|
|
const T |
pend |
|
) |
| |
|
inline |
Construct a public key using begin/end iterators to byte data.
Definition at line 88 of file pubkey.h.
◆ CPubKey() [3/3]
Construct a public key from a byte vector.
Definition at line 93 of file pubkey.h.
◆ begin()
const uint8_t * CPubKey::begin |
( |
| ) |
const |
|
inline |
◆ CheckLowS() [1/2]
bool CPubKey::CheckLowS |
( |
const boost::sliced_range< const std::vector< uint8_t > > & |
vchSig | ) |
|
|
static |
Check whether a DER-serialized ECDSA signature is normalized (lower-S).
Definition at line 341 of file pubkey.cpp.
◆ CheckLowS() [2/2]
◆ data()
const uint8_t * CPubKey::data |
( |
| ) |
const |
|
inline |
◆ Decompress()
bool CPubKey::Decompress |
( |
| ) |
|
Turn this public key into an uncompressed public key.
Definition at line 267 of file pubkey.cpp.
◆ Derive()
Derive BIP32 child pubkey.
Definition at line 286 of file pubkey.cpp.
◆ end()
const uint8_t * CPubKey::end |
( |
| ) |
const |
|
inline |
◆ GetHash()
Get the 256-bit hash of this public key.
Definition at line 140 of file pubkey.h.
◆ GetID()
CKeyID CPubKey::GetID |
( |
| ) |
const |
|
inline |
Get the KeyID of this public key (hash of its serialization)
Definition at line 137 of file pubkey.h.
◆ GetLen()
Compute the length of a pubkey with a given first byte.
Definition at line 56 of file pubkey.h.
◆ Invalidate()
void CPubKey::Invalidate |
( |
| ) |
|
|
inlineprivate |
Set this key data to be invalid.
Definition at line 67 of file pubkey.h.
◆ IsCompressed()
bool CPubKey::IsCompressed |
( |
| ) |
const |
|
inline |
Check whether this is a compressed public key.
Definition at line 154 of file pubkey.h.
◆ IsFullyValid()
bool CPubKey::IsFullyValid |
( |
| ) |
const |
fully validate whether this is a valid public key (more expensive than IsValid())
Definition at line 256 of file pubkey.cpp.
◆ IsValid()
bool CPubKey::IsValid |
( |
| ) |
const |
|
inline |
◆ operator[]()
◆ RecoverCompact()
bool CPubKey::RecoverCompact |
( |
const uint256 & |
hash, |
|
|
const std::vector< uint8_t > & |
vchSig |
|
) |
| |
Recover a public key from a compact ECDSA signature.
Definition at line 227 of file pubkey.cpp.
◆ Serialize()
Implement serialization, as if this was a byte vector.
Definition at line 117 of file pubkey.h.
◆ Set()
void CPubKey::Set |
( |
const T |
pbegin, |
|
|
const T |
pend |
|
) |
| |
|
inline |
Initialize a public key using begin/end iterators to byte data.
Definition at line 78 of file pubkey.h.
◆ size()
Simple read-only vector-like interface to the pubkey data.
Definition at line 98 of file pubkey.h.
◆ Unserialize()
◆ ValidSize()
◆ VerifyECDSA()
bool CPubKey::VerifyECDSA |
( |
const uint256 & |
hash, |
|
|
const std::vector< uint8_t > & |
vchSig |
|
) |
| const |
Verify a DER-serialized ECDSA signature (~72 bytes).
If this public key is not fully valid, the return value will be false.
libsecp256k1's ECDSA verification requires lower-S signatures, which have not historically been enforced in Bitcoin, so normalize them first.
Definition at line 172 of file pubkey.cpp.
◆ VerifySchnorr() [1/2]
Verify a Schnorr signature (=64 bytes).
If this public key is not fully valid, the return value will be false.
Definition at line 199 of file pubkey.cpp.
◆ VerifySchnorr() [2/2]
bool CPubKey::VerifySchnorr |
( |
const uint256 & |
hash, |
|
|
const std::vector< uint8_t > & |
vchSig |
|
) |
| const |
◆ operator!=
◆ operator<
◆ operator==
Comparator implementation.
Definition at line 105 of file pubkey.h.
◆ COMPACT_SIGNATURE_SIZE
◆ COMPRESSED_SIZE
◆ SCHNORR_SIZE
◆ SIGNATURE_SIZE
◆ SIZE
secp256k1:
Definition at line 36 of file pubkey.h.
◆ vch
see www.keylength.com script supports up to 75 for single byte push
Just store the serialized data. Its length can very cheaply be computed from the first byte.
Definition at line 53 of file pubkey.h.
The documentation for this class was generated from the following files: