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
11 #include <openssl/ec.h>
15 /** RAII Wrapper around OpenSSL's EC_KEY */
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);
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