22typedef std::vector<uint8_t, secure_allocator<uint8_t>>
CPrivKey;
25using SchnorrSig = std::array<uint8_t, CPubKey::SCHNORR_SIZE>;
33 static const unsigned int SIZE = 279;
40 "COMPRESSED_SIZE is larger than SIZE");
53 std::vector<uint8_t, secure_allocator<uint8_t>>
keydata;
70 return a.fCompressed ==
b.fCompressed &&
a.size() ==
b.size() &&
71 memcmp(
a.keydata.data(),
b.keydata.data(),
a.size()) == 0;
172 return a.nDepth ==
b.nDepth &&
173 memcmp(
a.vchFingerprint,
b.vchFingerprint,
175 a.nChild ==
b.nChild &&
a.chaincode ==
b.chaincode &&
An encapsulated secp256k1 private key.
static bool Check(const uint8_t *vch)
Check whether the 32-byte array pointed to by vch is valid keydata.
bool Negate()
Negate private key.
static const unsigned int SIZE
secp256k1:
friend bool operator==(const CKey &a, const CKey &b)
bool SignCompact(const uint256 &hash, std::vector< uint8_t > &vchSig) const
Create a compact ECDSA signature (65 bytes), which allows reconstructing the used public key.
unsigned int size() const
Simple read-only vector-like interface.
bool IsValid() const
Check whether this private key is valid.
static CKey MakeCompressedKey()
Produce a valid compressed key.
bool SignECDSA(const uint256 &hash, std::vector< uint8_t > &vchSig, bool grind=true, uint32_t test_case=0) const
Create a DER-serialized ECDSA signature.
bool fValid
see www.keylength.com script supports up to 75 for single byte push
static CKey MakeUncompressedKey()
Produce a valid uncompressed key.
const uint8_t * begin() const
CKey()
Construct an invalid private key.
CPrivKey GetPrivKey() const
Convert the private key to a CPrivKey (serialized OpenSSL private key data).
static const unsigned int COMPRESSED_SIZE
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.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
bool SignSchnorr(const uint256 &hash, SchnorrSig &sig, uint32_t test_case=0) const
Create a Schnorr signature.
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.
const uint8_t * end() const
bool Derive(CKey &keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode &cc) const
Derive BIP32 child key.
std::vector< uint8_t, secure_allocator< uint8_t > > keydata
The actual byte data.
An encapsulated public key.
std::array< uint8_t, CPubKey::SCHNORR_SIZE > SchnorrSig
a Schnorr signature
std::vector< uint8_t, secure_allocator< uint8_t > > CPrivKey
secure_allocator is defined in allocators.h CPrivKey is a serialized private key, with all parameters...
bool ECC_InitSanityCheck()
Check that required EC support is available at runtime.
void ECC_Start()
Initialize the elliptic curve support.
void ECC_Stop()
Deinitialize the elliptic curve support.
const unsigned int BIP32_EXTKEY_SIZE
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
void Encode(uint8_t code[BIP32_EXTKEY_SIZE]) const
CExtPubKey Neuter() const
bool Derive(CExtKey &out, unsigned int nChild) const
void Decode(const uint8_t code[BIP32_EXTKEY_SIZE])
friend bool operator==(const CExtKey &a, const CExtKey &b)
void SetSeed(const uint8_t *seed, unsigned int nSeedLen)
uint8_t vchFingerprint[4]