 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
36 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CPrivKey;
50 unsigned char vch[32];
53 bool static Check(
const unsigned char*
vch);
78 memcmp(&a.
vch[0], &
b.vch[0], a.
size()) == 0;
83 void Set(
const T pbegin,
const T pend,
bool fCompressedIn)
85 if (pend - pbegin != 32) {
89 if (
Check(&pbegin[0])) {
90 memcpy(
vch, (
unsigned char*)&pbegin[0], 32);
134 bool Sign(
const uint256& hash, std::vector<unsigned char>& vchSig, uint32_t test_case = 0)
const;
146 bool Derive(
CKey& keyChild,
unsigned char ccChild[32],
unsigned int nChild,
const unsigned char cc[32])
const;
174 void Encode(
unsigned char code[74])
const;
175 void Decode(
const unsigned char code[74]);
178 void SetMaster(
const unsigned char* seed,
unsigned int nSeedLen);
184 #endif // BITCOIN_KEY_H
bool IsCompressed() const
Check whether the public key corresponding to this private key is (to be) compressed.
void UnlockObject(const T &t)
friend bool operator==(const CKey &a, const CKey &b)
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
bool SetPrivKey(const CPrivKey &vchPrivKey, bool fCompressed)
Initialize from a CPrivKey (serialized OpenSSL private key data).
bool Derive(CExtKey &out, unsigned int nChild) const
CPrivKey GetPrivKey() const
Convert the private key to a CPrivKey (serialized OpenSSL private key data).
unsigned char vchFingerprint[4]
bool Derive(CKey &keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const
Derive BIP32 child key.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
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 fCompressed
Whether the public key corresponding to this private key is (to be) compressed.
void * memcpy(void *a, const void *b, size_t c)
const unsigned char * end() const
CKey()
Construct an invalid private key.
friend bool operator==(const CExtKey &a, const CExtKey &b)
unsigned char vch[32]
The actual byte data.
const unsigned char * begin() const
CKey(const CKey &secret)
Copy constructor. This is necessary because of memlocking.
void Decode(const unsigned char code[74])
~CKey()
Destructor (again necessary because of memlocking).
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
Create a compact signature (65 bytes), which allows reconstructing the used public key.
void LockObject(const T &t)
bool IsValid() const
Check whether this private key is valid.
unsigned char vchChainCode[32]
256-bit unsigned big integer.
CPubKey GetPubKey() const
Compute the public key from a private key.
An encapsulated public key.
unsigned int size() const
Simple read-only vector-like interface.
bool Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck)
Load private key and check that public key matches.
An encapsulated private key.
bool VerifyPubKey(const CPubKey &vchPubKey) const
Verify thoroughly whether a private key and a public key match.
bool ECC_InitSanityCheck(void)
Check that required EC support is available at runtime.
bool Sign(const uint256 &hash, std::vector< unsigned char > &vchSig, uint32_t test_case=0) const
Create a DER-serialized signature.
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
Whether this private key is valid.
CExtPubKey Neuter() const
void Encode(unsigned char code[74]) const
static bool Check(const unsigned char *vch)
Check whether the 32-byte array pointed to be vch is valid keydata.
void SetMaster(const unsigned char *seed, unsigned int nSeedLen)