Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
CKey Class Reference

An encapsulated private key. More...

#include <key.h>

+ Collaboration diagram for CKey:

Public Member Functions

 CKey ()
 
 CKey (const CKey &secret)
 
 ~CKey ()
 
template<typename T >
void Set (const T pbegin, const T pend, bool fCompressedIn)
 
unsigned int size () const
 
const unsigned char * begin () const
 
const unsigned char * end () const
 
bool IsValid () const
 
bool IsCompressed () const
 
bool SetPrivKey (const CPrivKey &vchPrivKey, bool fCompressed)
 
void MakeNewKey (bool fCompressed)
 
CPrivKey GetPrivKey () const
 
CPubKey GetPubKey () const
 
bool Sign (const uint256 &hash, std::vector< unsigned char > &vchSig) const
 
bool SignCompact (const uint256 &hash, std::vector< unsigned char > &vchSig) const
 
bool Derive (CKey &keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const
 
bool Load (CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck)
 

Static Private Member Functions

static bool Check (const unsigned char *vch)
 

Private Attributes

bool fValid
 
bool fCompressed
 
unsigned char vch [32]
 

Friends

bool operator== (const CKey &a, const CKey &b)
 

Detailed Description

An encapsulated private key.

Definition at line 179 of file key.h.

Constructor & Destructor Documentation

CKey::CKey ( )
inline

Definition at line 196 of file key.h.

References LockObject().

+ Here is the call graph for this function:

CKey::CKey ( const CKey secret)
inline

Definition at line 201 of file key.h.

References LockObject(), memcpy(), and vch.

+ Here is the call graph for this function:

CKey::~CKey ( )
inline

Definition at line 207 of file key.h.

References UnlockObject().

+ Here is the call graph for this function:

Member Function Documentation

const unsigned char* CKey::begin ( ) const
inline

Definition at line 234 of file key.h.

References vch.

Referenced by CCryptoKeyStore::AddKeyPubKey(), Derive(), CExtKey::Encode(), CCryptoKeyStore::EncryptKeys(), and CBitcoinSecret::SetKey().

+ Here is the caller graph for this function:

bool CKey::Check ( const unsigned char *  vch)
staticprivate

Definition at line 337 of file key.cpp.

Referenced by MakeNewKey(), and Set().

+ Here is the caller graph for this function:

bool CKey::Derive ( CKey keyChild,
unsigned char  ccChild[32],
unsigned int  nChild,
const unsigned char  cc[32] 
) const

Definition at line 506 of file key.cpp.

References CPubKey::begin(), begin(), BIP32Hash(), CPubKey::end(), end(), fCompressed, fValid, GetPubKey(), IsCompressed(), IsValid(), LockObject(), memcpy(), and UnlockObject().

Referenced by CExtKey::Derive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const unsigned char* CKey::end ( ) const
inline

Definition at line 235 of file key.h.

References size().

Referenced by CCryptoKeyStore::AddKeyPubKey(), Derive(), and CCryptoKeyStore::EncryptKeys().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CPrivKey CKey::GetPrivKey ( ) const

Definition at line 379 of file key.cpp.

References fValid, and vch.

Referenced by CWallet::AddKeyPubKey().

+ Here is the caller graph for this function:

CPubKey CKey::GetPubKey ( ) const

Definition at line 388 of file key.cpp.

References fValid, and vch.

Referenced by CKeyStore::AddKey(), Derive(), CExtKey::Derive(), CCryptoKeyStore::EncryptKeys(), CWallet::GenerateNewKey(), CKeyStore::GetPubKey(), importprivkey(), importwallet(), Load(), CExtKey::Neuter(), and CCryptoKeyStore::Unlock().

+ Here is the caller graph for this function:

bool CKey::IsCompressed ( ) const
inline

Definition at line 241 of file key.h.

References fCompressed.

Referenced by Derive(), and CBitcoinSecret::SetKey().

+ Here is the caller graph for this function:

bool CKey::IsValid ( ) const
inline

Definition at line 238 of file key.h.

References fValid.

Referenced by Derive(), importprivkey(), and CBitcoinSecret::SetKey().

+ Here is the caller graph for this function:

bool CKey::Load ( CPrivKey privkey,
CPubKey vchPubKey,
bool  fSkipCheck = false 
)

Definition at line 419 of file key.cpp.

References fValid, GetPubKey(), CPubKey::IsCompressed(), and vch.

Referenced by ReadKeyValue().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CKey::MakeNewKey ( bool  fCompressed)

Definition at line 361 of file key.cpp.

References Check(), fValid, and vch.

Referenced by CWallet::GenerateNewKey().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void CKey::Set ( const T  pbegin,
const T  pend,
bool  fCompressedIn 
)
inline

Definition at line 218 of file key.h.

References Check(), and memcpy().

Referenced by CExtKey::Decode(), CBitcoinSecret::GetKey(), CCryptoKeyStore::GetKey(), CExtKey::SetMaster(), and CCryptoKeyStore::Unlock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CKey::SetPrivKey ( const CPrivKey vchPrivKey,
bool  fCompressed 
)

Definition at line 369 of file key.cpp.

References fValid, and vch.

bool CKey::Sign ( const uint256 hash,
std::vector< unsigned char > &  vchSig 
) const

Definition at line 397 of file key.cpp.

References fValid, and vch.

Referenced by Sign1().

+ Here is the caller graph for this function:

bool CKey::SignCompact ( const uint256 hash,
std::vector< unsigned char > &  vchSig 
) const

Definition at line 405 of file key.cpp.

References fValid, and vch.

Referenced by SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), and signmessage().

+ Here is the caller graph for this function:

unsigned int CKey::size ( ) const
inline

Definition at line 233 of file key.h.

Referenced by CExtKey::Encode(), end(), and CBitcoinSecret::SetKey().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

bool operator== ( const CKey a,
const CKey b 
)
friend

Definition at line 211 of file key.h.

Member Data Documentation

bool CKey::fCompressed
private

Definition at line 186 of file key.h.

Referenced by Derive(), and IsCompressed().

bool CKey::fValid
private

Definition at line 183 of file key.h.

Referenced by Derive(), GetPrivKey(), GetPubKey(), IsValid(), Load(), MakeNewKey(), SetPrivKey(), Sign(), and SignCompact().

unsigned char CKey::vch[32]
private

Definition at line 189 of file key.h.

Referenced by begin(), CKey(), GetPrivKey(), GetPubKey(), Load(), MakeNewKey(), SetPrivKey(), Sign(), and SignCompact().


The documentation for this class was generated from the following files: