32 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CPrivKey;
46 std::vector<unsigned char, secure_allocator<unsigned char> >
keydata;
49 bool static Check(
const unsigned char* vch);
73 void Set(
const T pbegin,
const T pend,
bool fCompressedIn)
75 if (
size_t(pend - pbegin) !=
keydata.size()) {
77 }
else if (
Check(&pbegin[0])) {
119 bool Sign(
const uint256& hash, std::vector<unsigned char>& vchSig, uint32_t test_case = 0)
const;
163 void SetMaster(
const unsigned char* seed,
unsigned int nSeedLen);
164 template <
typename Stream>
171 s.write((
const char *)&code[0], len);
173 template <
typename Stream>
178 s.read((
char *)&code[0], len);
An encapsulated private key.
bool Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck)
Load private key and check that public key matches.
friend bool operator==(const CKey &a, const CKey &b)
const unsigned char * end() const
unsigned int size() const
Simple read-only vector-like interface.
bool IsValid() const
Check whether this private key is valid.
~CKey()
Destructor (again necessary because of memlocking).
bool fValid
Whether this private key is valid.
CKey()
Construct an invalid private key.
CPrivKey GetPrivKey() const
Convert the private key to a CPrivKey (serialized OpenSSL private key data).
bool IsCompressed() const
Check whether the public key corresponding to this private key is (to be) compressed.
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
bool fCompressed
Whether the public key corresponding to this private key is (to be) compressed.
CPubKey GetPubKey() const
Compute the public key from a private key.
bool SetPrivKey(const CPrivKey &vchPrivKey, bool fCompressed)
Initialize from a CPrivKey (serialized OpenSSL private key data).
bool Sign(const uint256 &hash, std::vector< unsigned char > &vchSig, uint32_t test_case=0) const
Create a DER-serialized signature.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
const unsigned char * begin() const
std::vector< unsigned char, secure_allocator< unsigned char > > keydata
The actual byte data.
bool VerifyPubKey(const CPubKey &vchPubKey) const
Verify thoroughly whether a private key and a public key match.
static bool Check(const unsigned char *vch)
Check whether the 32-byte array pointed to be vch is valid keydata.
bool Derive(CKey &keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode &cc) const
Derive BIP32 child key.
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
Create a compact signature (65 bytes), which allows reconstructing the used public key.
An encapsulated public key.
void * memcpy(void *a, const void *b, size_t c)
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
secp256k1: const unsigned int PRIVATE_KEY_SIZE = 279; const unsigned int PUBLIC_KEY_SIZE = 65; const ...
bool ECC_InitSanityCheck(void)
Check that required EC support is available at runtime.
void ECC_Start(void)
Initialize the elliptic curve support.
void ECC_Stop(void)
Deinitialize the elliptic curve support.
const unsigned int BIP32_EXTKEY_SIZE
secp256k1: const unsigned int PRIVATE_KEY_SIZE = 279; const unsigned int PUBLIC_KEY_SIZE = 65; const ...
uint64_t ReadCompactSize(Stream &is)
void WriteCompactSize(CSizeComputer &os, uint64_t nSize)
unsigned char vchFingerprint[4]
CExtPubKey Neuter() const
bool Derive(CExtKey &out, unsigned int nChild) const
void SetMaster(const unsigned char *seed, unsigned int nSeedLen)
void Serialize(Stream &s) const
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE])
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const
friend bool operator==(const CExtKey &a, const CExtKey &b)
void Unserialize(Stream &s)