From 63179d028347bf3e32c7ea61386df4c44307b4a7 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 4 Oct 2017 14:41:40 +0100 Subject: Scope the ECDSA constant sizes to CPubKey / CKey classes --- src/key.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/key.h') diff --git a/src/key.h b/src/key.h index dc7b941f42..14024e6ec0 100644 --- a/src/key.h +++ b/src/key.h @@ -16,16 +16,6 @@ #include -/** - * 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 > 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. -- cgit v1.2.3