hdac SDK
SDK for hdac blockchain development
Public 멤버 함수 | 정적 Public 멤버 함수 | Friends | 모든 멤버 목록
CKey 클래스 참조

#include <key.h>

Public 멤버 함수

 CKey ()
 Construct an invalid private key.
 
 CKey (const CKey &secret)
 Copy constructor. This is necessary because of memlocking.
 
 ~CKey ()
 Destructor (again necessary because of memlocking).
 
template<typename T >
void Set (const T pbegin, const T pend, bool fCompressedIn)
 Initialize using begin and end iterators to byte data.
 
unsigned int size () const
 Simple read-only vector-like interface.
 
const unsigned char * begin () const
 
const unsigned char * end () const
 
bool IsValid () const
 Check whether this private key is valid.
 
bool IsCompressed () const
 Check whether the public key corresponding to this private key is (to be) compressed.
 
bool SetPrivKey (const CPrivKey &vchPrivKey, bool fCompressed)
 Initialize from a CPrivKey (serialized OpenSSL private key data).
 
void MakeNewKey (bool fCompressed)
 Generate a new private key using a cryptographic PRNG.
 
CPrivKey GetPrivKey () const
 
CPubKey GetPubKey () const
 
bool Sign (const uint256 &hash, std::vector< unsigned char > &vchSig, uint32_t test_case=0) const
 
bool SignCompact (const uint256 &hash, std::vector< unsigned char > &vchSig) const
 
bool Derive (CKey &keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode &cc) const
 Derive BIP32 child key.
 
bool VerifyPubKey (const CPubKey &vchPubKey) const
 
bool Load (CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck)
 Load private key and check that public key matches.
 

정적 Public 멤버 함수

static bool CheckSignatureElement (const unsigned char *vch, int len, bool half)
 Check whether an element of a signature (r or s) is valid.
 

Friends

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

상세한 설명

An encapsulated private key.

멤버 함수 문서화

CPrivKey CKey::GetPrivKey ( ) const

Convert the private key to a CPrivKey (serialized OpenSSL private key data). This is expensive.

CPubKey CKey::GetPubKey ( ) const

Compute the public key from a private key. This is expensive.

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

Create a DER-serialized signature. The test_case parameter tweaks the deterministic nonce.

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

Create a compact signature (65 bytes), which allows reconstructing the used public key. The format is one header byte, followed by two times 32 bytes for the serialized r and s values. The header byte: 0x1B = first key with even y, 0x1C = first key with odd y, 0x1D = second key with even y, 0x1E = second key with odd y, add 0x04 for compressed keys.

bool CKey::VerifyPubKey ( const CPubKey vchPubKey) const

Verify thoroughly whether a private key and a public key match. This is done using a different mechanism than just regenerating it.


이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: