Changeset View
Changeset View
Standalone View
Standalone View
src/key.h
Show All 15 Lines | |||||
/** | /** | ||||
* secure_allocator is defined in allocators.h | * secure_allocator is defined in allocators.h | ||||
* CPrivKey is a serialized private key, with all parameters included | * CPrivKey is a serialized private key, with all parameters included | ||||
* (SIZE bytes) | * (SIZE bytes) | ||||
*/ | */ | ||||
typedef std::vector<uint8_t, secure_allocator<uint8_t>> CPrivKey; | typedef std::vector<uint8_t, secure_allocator<uint8_t>> CPrivKey; | ||||
//! a Schnorr signature | |||||
using SchnorrSig = std::array<uint8_t, CPubKey::SCHNORR_SIZE>; | |||||
/** An encapsulated secp256k1 private key. */ | /** An encapsulated secp256k1 private key. */ | ||||
class CKey { | class CKey { | ||||
public: | public: | ||||
/** | /** | ||||
* secp256k1: | * secp256k1: | ||||
*/ | */ | ||||
static const unsigned int SIZE = 279; | static const unsigned int SIZE = 279; | ||||
static const unsigned int COMPRESSED_SIZE = 214; | static const unsigned int COMPRESSED_SIZE = 214; | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
bool SignECDSA(const uint256 &hash, std::vector<uint8_t> &vchSig, | bool SignECDSA(const uint256 &hash, std::vector<uint8_t> &vchSig, | ||||
bool grind = true, uint32_t test_case = 0) const; | bool grind = true, uint32_t test_case = 0) const; | ||||
/** | /** | ||||
* Create a Schnorr signature. | * Create a Schnorr signature. | ||||
* The test_case parameter tweaks the deterministic nonce. | * The test_case parameter tweaks the deterministic nonce. | ||||
*/ | */ | ||||
bool SignSchnorr(const uint256 &hash, | bool SignSchnorr(const uint256 &hash, SchnorrSig &sig, | ||||
std::array<uint8_t, CPubKey::SCHNORR_SIZE> &sig, | |||||
uint32_t test_case = 0) const; | uint32_t test_case = 0) const; | ||||
bool SignSchnorr(const uint256 &hash, std::vector<uint8_t> &vchSig, | bool SignSchnorr(const uint256 &hash, std::vector<uint8_t> &vchSig, | ||||
uint32_t test_case = 0) const; | uint32_t test_case = 0) const; | ||||
/** | /** | ||||
* Create a compact ECDSA signature (65 bytes), which allows reconstructing | * Create a compact ECDSA signature (65 bytes), which allows reconstructing | ||||
* the used public key. | * the used public key. | ||||
* The format is one header byte, followed by two times 32 bytes for the | * The format is one header byte, followed by two times 32 bytes for the | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |