]> Git Repo - VerusCoin.git/blob - src/ecwrapper.h
test
[VerusCoin.git] / src / ecwrapper.h
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.
4
5 #ifndef BITCOIN_ECWRAPPER_H
6 #define BITCOIN_ECWRAPPER_H
7
8 #include <cstddef>
9 #include <vector>
10
11 #include <openssl/ec.h>
12
13 class uint256;
14
15 /** RAII Wrapper around OpenSSL's EC_KEY */
16 class CECKey {
17 private:
18     EC_KEY *pkey;
19
20 public:
21     CECKey();
22     ~CECKey();
23
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);
27
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)
33      */
34     bool Recover(const uint256 &hash, const unsigned char *p64, int rec);
35
36     bool TweakPublic(const unsigned char vchTweak[32]);
37     static bool SanityCheck();
38 };
39
40 #endif // BITCOIN_ECWRAPPER_H
This page took 0.033393 seconds and 4 git commands to generate.