Changeset View
Changeset View
Standalone View
Standalone View
src/key.h
Show All 11 Lines | |||||
#include <uint256.h> | #include <uint256.h> | ||||
#include <stdexcept> | #include <stdexcept> | ||||
#include <vector> | #include <vector> | ||||
/** | /** | ||||
* 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 | ||||
* (PRIVATE_KEY_SIZE bytes) | * (SIZE bytes) | ||||
*/ | */ | ||||
typedef std::vector<uint8_t, secure_allocator<uint8_t>> CPrivKey; | typedef std::vector<uint8_t, secure_allocator<uint8_t>> CPrivKey; | ||||
/** An encapsulated secp256k1 private key. */ | /** An encapsulated secp256k1 private key. */ | ||||
class CKey { | class CKey { | ||||
public: | public: | ||||
/** | /** | ||||
* secp256k1: | * secp256k1: | ||||
*/ | */ | ||||
static const unsigned int PRIVATE_KEY_SIZE = 279; | static const unsigned int SIZE = 279; | ||||
static const unsigned int COMPRESSED_PRIVATE_KEY_SIZE = 214; | static const unsigned int COMPRESSED_SIZE = 214; | ||||
/** | /** | ||||
* see www.keylength.com | * see www.keylength.com | ||||
* script supports up to 75 for single byte push | * script supports up to 75 for single byte push | ||||
*/ | */ | ||||
static_assert( | static_assert(SIZE >= COMPRESSED_SIZE, | ||||
PRIVATE_KEY_SIZE >= COMPRESSED_PRIVATE_KEY_SIZE, | "COMPRESSED_SIZE is larger than SIZE"); | ||||
"COMPRESSED_PRIVATE_KEY_SIZE is larger than PRIVATE_KEY_SIZE"); | |||||
private: | private: | ||||
//! Whether this private key is valid. We check for correctness when | //! Whether this private key is valid. We check for correctness when | ||||
//! modifying the key data, so fValid should always correspond to the actual | //! modifying the key data, so fValid should always correspond to the actual | ||||
//! state. | //! state. | ||||
bool fValid; | bool fValid; | ||||
//! Whether the public key corresponding to this private key is (to be) | //! Whether the public key corresponding to this private key is (to be) | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |