![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#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 * | begin () const |
const unsigned char * | end () const |
const unsigned char & | operator[] (unsigned int pos) const |
unsigned int | GetSerializeSize (int nType, int nVersion) const |
Implement serialization, as if this was a byte vector. More... | |
template<typename Stream > | |
void | Serialize (Stream &s, int nType, int nVersion) const |
template<typename Stream > | |
void | Unserialize (Stream &s, int nType, int nVersion) |
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 | CheckLowS (const std::vector< unsigned char > &vchSig) |
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 [65] |
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) |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 96 of file pubkey.h.
Referenced by CScriptCompressor::Decompress(), CKey::Derive(), Derive(), CExtPubKey::Encode(), GetScriptForRawPubKey(), and CWalletDB::WriteKey().
|
static |
Check whether a signature is normalized (lower-S).
Definition at line 275 of file pubkey.cpp.
Referenced by IsLowDERSignature().
bool CPubKey::Decompress | ( | ) |
Turn this public key into an uncompressed public key.
Definition at line 214 of file pubkey.cpp.
Referenced by CScriptCompressor::Decompress().
bool CPubKey::Derive | ( | CPubKey & | pubkeyChild, |
ChainCode & | ccChild, | ||
unsigned int | nChild, | ||
const ChainCode & | cc | ||
) | const |
Derive BIP32 child pubkey.
Definition at line 228 of file pubkey.cpp.
Referenced by CExtPubKey::Derive().
|
inline |
Definition at line 97 of file pubkey.h.
Referenced by CKey::Derive(), Derive(), GetScriptForRawPubKey(), and CWalletDB::WriteKey().
|
inline |
Get the 256-bit hash of this public key.
Definition at line 150 of file pubkey.h.
Referenced by CCryptoKeyStore::AddKeyPubKey(), DecryptKey(), CCryptoKeyStore::EncryptKeys(), and gobject().
|
inline |
Get the KeyID of this public key (hash of its serialization)
Definition at line 144 of file pubkey.h.
Referenced by CCryptoKeyStore::AddCryptedKey(), CWallet::AddCryptedKey(), CWallet::AddHDPubKey(), CBasicKeyStore::AddKeyPubKey(), CWallet::AddKeyPubKey(), AddressTableModel::addRow(), CBasicKeyStore::AddWatchOnly(), AppInit2(), CMasternodeBroadcast::CheckSignature(), CMasternodeBroadcast::Create(), CWallet::CreateCollateralTransaction(), CWallet::CreateTransaction(), CExtKey::Derive(), CExtPubKey::Derive(), CWallet::DeriveNewChildKey(), ExtractDestination(), ExtractDestinations(), PaymentServer::fetchPaymentACK(), CMasternodePayments::FillBlockPayee(), CWallet::GenerateNewKey(), GetAccountAddress(), getnewaddress(), getrawchangeaddress(), CKeyHolder::GetScriptForDestination(), HaveKeys(), importelectrumwallet(), importprivkey(), importwallet(), CMasternode::IsInputAssociatedWithPubkey(), IsMine(), CMasternodePayments::IsScheduled(), CGovernanceObject::IsValidLocally(), CWallet::LoadHDPubKey(), CWallet::LoadKeyMetadata(), CPrivateSendClient::MakeCollateralAmounts(), CActiveMasternode::ManageStateRemote(), masternode(), masternodebroadcast(), masternodelist(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CMasternodePayments::ProcessBlock(), CBasicKeyStore::RemoveWatchOnly(), CGovernanceObject::Sign(), CMasternodeBroadcast::Sign(), SignN(), SignStep(), CMasternodeBroadcast::SimpleCheck(), CMasternode::UpdateLastPaid(), MasternodeList::updateMyMasternodeInfo(), MasternodeList::updateNodeList(), CHashSigner::VerifyHash(), and verifymessage().
|
inlinestaticprivate |
|
inline |
|
inlineprivate |
Set this key data to be invalid.
Definition at line 58 of file pubkey.h.
Referenced by CPubKey(), Set(), and Unserialize().
|
inline |
Check whether this is a compressed public key.
Definition at line 169 of file pubkey.h.
Referenced by DecryptKey(), CKey::Load(), CoinControlDialog::updateLabels(), and CKey::VerifyPubKey().
bool CPubKey::IsFullyValid | ( | ) | const |
fully validate whether this is a valid public key (more expensive than IsValid())
Definition at line 207 of file pubkey.cpp.
Referenced by _createmultisig_redeemScript(), ExtractPubKey(), and CScriptCompressor::IsToPubKey().
|
inline |
Definition at line 160 of file pubkey.h.
Referenced by TransactionSignatureChecker::CheckSig(), Decompress(), Derive(), ExtractDestination(), ExtractDestinations(), GetAccountAddress(), IsFullyValid(), and Verify().
|
inline |
bool CPubKey::RecoverCompact | ( | const uint256 & | hash, |
const std::vector< unsigned char > & | vchSig | ||
) |
Recover a public key from a compact signature.
Definition at line 187 of file pubkey.cpp.
Referenced by SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CHashSigner::VerifyHash(), and verifymessage().
|
inline |
|
inline |
Initialize a public key using begin/end iterators to byte data.
Definition at line 72 of file pubkey.h.
Referenced by CPubKey(), CExtPubKey::Decode(), Decompress(), Derive(), CScriptCompressor::IsToPubKey(), and RecoverCompact().
|
inline |
Simple read-only vector-like interface to the pubkey data.
Definition at line 95 of file pubkey.h.
Referenced by CScriptCompressor::Decompress(), Decompress(), Derive(), CExtPubKey::Encode(), end(), GetHash(), GetID(), GetSerializeSize(), IsCompressed(), IsFullyValid(), IsValid(), Serialize(), Verify(), and CWalletDB::WriteKey().
|
inline |
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.
Definition at line 167 of file pubkey.cpp.
Referenced by CKey::VerifyPubKey(), and TransactionSignatureChecker::VerifySignature().
|
private |
Just store the serialized data. Its length can very cheaply be computed from the first byte.
Definition at line 45 of file pubkey.h.
Referenced by begin(), CPubKey(), end(), GetHash(), GetID(), Invalidate(), operator[](), Serialize(), Set(), size(), and Unserialize().