Add UpdatedBlockTip signal to CMainSignals and CValidationInterface
[bitcoinplatinum.git] / src / ecwrapper.h
blobefb6cd18a775f11420f305e116168b58e1c264e5
1 // Copyright (c) 2009-2014 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_ECWRAPPER_H
6 #define BITCOIN_ECWRAPPER_H
8 #include <cstddef>
9 #include <vector>
11 #include <openssl/ec.h>
13 class uint256;
15 /** RAII Wrapper around OpenSSL's EC_KEY */
16 class CECKey {
17 private:
18 EC_KEY *pkey;
20 public:
21 CECKey();
22 ~CECKey();
24 void GetPubKey(std::vector<unsigned char>& pubkey, bool fCompressed);
25 bool SetPubKey(const unsigned char* pubkey, size_t size);
26 bool Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig);
28 /**
29 * reconstruct public key from a compact signature
30 * This is only slightly more CPU intensive than just verifying it.
31 * If this function succeeds, the recovered public key is guaranteed to be valid
32 * (the signature is a valid signature of the given data for that key)
34 bool Recover(const uint256 &hash, const unsigned char *p64, int rec);
36 bool TweakPublic(const unsigned char vchTweak[32]);
37 static bool SanityCheck();
40 #endif // BITCOIN_ECWRAPPER_H