Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
KeyPair Class Reference

KeyPair. More...

#include <key.h>

Public Member Functions

 KeyPair () noexcept=default
 KeyPair (KeyPair &&) noexcept=default
KeyPairoperator= (KeyPair &&) noexcept=default
KeyPairoperator= (const KeyPair &other)
 KeyPair (const KeyPair &other)
bool SignSchnorr (const uint256 &hash, std::span< unsigned char > sig, const uint256 &aux) const
bool IsValid () const
 Check whether this keypair is valid.

Private Types

using KeyType = std::array<unsigned char, 96>

Private Member Functions

 KeyPair (const CKey &key, const uint256 *merkle_root)
void MakeKeyPairData ()
void ClearKeyPairData ()

Private Attributes

secure_unique_ptr< KeyTypem_keypair

Friends

KeyPair CKey::ComputeKeyPair (const uint256 *merkle_root) const

Detailed Description

KeyPair.

Wraps a secp256k1_keypair type, an opaque data structure for holding a secret and public key. This is intended for BIP340 keys and allows us to easily determine if the secret key needs to be negated by checking the parity of the public key. This class primarily intended for passing secret keys to libsecp256k1 functions expecting a secp256k1_keypair. For all other cases, CKey should be preferred.

A KeyPair can be created from a CKey with an optional merkle_root tweak (per BIP342). See CKey::ComputeKeyPair for more details.

Definition at line 271 of file key.h.

Member Typedef Documentation

◆ KeyType

using KeyPair::KeyType = std::array<unsigned char, 96>
private

Definition at line 301 of file key.h.

Constructor & Destructor Documentation

◆ KeyPair() [1/4]

KeyPair::KeyPair ( )
defaultnoexcept
Here is the caller graph for this function:

◆ KeyPair() [2/4]

KeyPair::KeyPair ( KeyPair && )
defaultnoexcept
Here is the call graph for this function:

◆ KeyPair() [3/4]

KeyPair::KeyPair ( const KeyPair & other)
inline

Definition at line 290 of file key.h.

Here is the call graph for this function:

◆ KeyPair() [4/4]

KeyPair::KeyPair ( const CKey & key,
const uint256 * merkle_root )
private

Definition at line 532 of file key.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ ClearKeyPairData()

void KeyPair::ClearKeyPairData ( )
inlineprivate

Definition at line 309 of file key.h.

Here is the caller graph for this function:

◆ IsValid()

bool KeyPair::IsValid ( ) const
inline

Check whether this keypair is valid.

Definition at line 296 of file key.h.

Here is the caller graph for this function:

◆ MakeKeyPairData()

void KeyPair::MakeKeyPairData ( )
inlineprivate

Definition at line 304 of file key.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

KeyPair & KeyPair::operator= ( const KeyPair & other)
inline

Definition at line 277 of file key.h.

Here is the call graph for this function:

◆ operator=() [2/2]

KeyPair & KeyPair::operator= ( KeyPair && )
defaultnoexcept
Here is the call graph for this function:

◆ SignSchnorr()

bool KeyPair::SignSchnorr ( const uint256 & hash,
std::span< unsigned char > sig,
const uint256 & aux ) const
nodiscard

Definition at line 549 of file key.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CKey::ComputeKeyPair

KeyPair CKey::ComputeKeyPair ( const uint256 * merkle_root) const
friend

Member Data Documentation

◆ m_keypair

secure_unique_ptr<KeyType> KeyPair::m_keypair
private

Definition at line 302 of file key.h.


The documentation for this class was generated from the following files: