mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Scope the ECDSA constant sizes to CPubKey / CKey classes
This commit is contained in:
24
src/key.h
24
src/key.h
@@ -16,16 +16,6 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
/**
|
||||
* secp256k1:
|
||||
*/
|
||||
const unsigned int PRIVATE_KEY_SIZE = 279;
|
||||
const unsigned int COMPRESSED_PRIVATE_KEY_SIZE = 214;
|
||||
/**
|
||||
* see www.keylength.com
|
||||
* script supports up to 75 for single byte push
|
||||
*/
|
||||
|
||||
/**
|
||||
* secure_allocator is defined in allocators.h
|
||||
* CPrivKey is a serialized private key, with all parameters included
|
||||
@@ -36,6 +26,20 @@ typedef std::vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
|
||||
/** An encapsulated private key. */
|
||||
class CKey
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* secp256k1:
|
||||
*/
|
||||
static const unsigned int PRIVATE_KEY_SIZE = 279;
|
||||
static const unsigned int COMPRESSED_PRIVATE_KEY_SIZE = 214;
|
||||
/**
|
||||
* see www.keylength.com
|
||||
* script supports up to 75 for single byte push
|
||||
*/
|
||||
static_assert(
|
||||
PRIVATE_KEY_SIZE >= COMPRESSED_PRIVATE_KEY_SIZE,
|
||||
"COMPRESSED_PRIVATE_KEY_SIZE is larger than PRIVATE_KEY_SIZE");
|
||||
|
||||
private:
|
||||
//! Whether this private key is valid. We check for correctness when modifying the key
|
||||
//! data, so fValid should always correspond to the actual state.
|
||||
|
||||
Reference in New Issue
Block a user