bitcoin/bitcoin — pull request #2600 by sipa (2013-05-01 05:36:17+00:00)
Title: Refactor key.cpp/.h

This pull request changes a few things in key.h/key.cpp
* CKey is no longer a kitchen-sink for "anything ECDSA related", but just an object representing a private key.
* Operations that don't use a private key are moved to CPubKey (which is now a fully-featured object representing a public key).
* All actual OpenSSL-interaction code is moved to an internal class in key.cpp.
* Representation-wise, CKey now funcions as CSecret (which is gone) with an fCompressed built-in (so no keeping separate booleans necessary anymore).
* CKey and CPubKey simply encapsulate static byte arrays, and can be created/moved/copied cheaply.
* Practical upshot: no need to move key/pubkey data from/to CKey anymore before doing something useful with it.

The reason for writing this is preparing the code to more easily change ECDSA implementation (such as maybe my secp256k1 library at some point), but it seemed useful enough to try to get reviewed and perhaps merged independently of that.