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;
56 static bool Check(
const uint8_t *vch);
76 void Set(
const T pbegin,
const T pend,
bool fCompressedIn) {
77 if (
size_t(pend - pbegin) !=
keydata.size()) {
79 }
else if (
Check(&pbegin[0])) {
90 const std::byte *
data()
const {
91 return reinterpret_cast<const std::byte *
>(
keydata.data());
127 bool grind =
true, uint32_t test_case = 0)
const;
134 uint32_t test_case = 0)
const;
136 uint32_t test_case = 0)
const;
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.
const std::byte * data() const
An encapsulated public key.
A Span is an object that can refer to a contiguous sequence of objects.
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
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)
uint8_t vchFingerprint[4]
void SetSeed(Span< const std::byte > seed)