26 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CPrivKey;
43 "COMPRESSED_PRIVATE_KEY_SIZE is larger than PRIVATE_KEY_SIZE");
54 std::vector<unsigned char, secure_allocator<unsigned char> >
keydata;
57 bool static Check(
const unsigned char* vch);
76 void Set(
const T pbegin,
const T pend,
bool fCompressedIn)
78 if (
size_t(pend - pbegin) !=
keydata.size()) {
80 }
else if (
Check(&pbegin[0])) {
121 bool Sign(
const uint256& hash, std::vector<unsigned char>& vchSig, uint32_t test_case = 0)
const;
168 void SetSeed(
const unsigned char* seed,
unsigned int nSeedLen);
An encapsulated private key.
static const unsigned int COMPRESSED_PRIVATE_KEY_SIZE
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.
static bool CheckSignatureElement(const unsigned char *vch, int len, bool half)
Check whether an element of a signature (r or s) is valid.
bool fValid
see www.keylength.com script supports up to 75 for single byte push
CKey()
Construct an invalid private key.
CPrivKey GetPrivKey() const
Convert the private key to a CPrivKey (serialized secp256k1 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 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.
bool Load(const CPrivKey &privkey, const CPubKey &vchPubKey, bool fSkipCheck)
Load private key and check that public key matches.
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.
static const unsigned int PRIVATE_KEY_SIZE
secp256k1:
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)
#define T(expected, seed, data)
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
CPrivKey is a serialized private key, with all parameters included (PRIVATE_KEY_SIZE bytes)
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
unsigned char vchFingerprint[4]
CExtPubKey Neuter() const
bool Derive(CExtKey &out, unsigned int nChild) const
void SetSeed(const unsigned char *seed, unsigned int nSeedLen)
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)