1 // Copyright (c) 2009-2011 Satoshi Nakamoto & Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
4 #ifndef BITCOIN_KEYSTORE_H
5 #define BITCOIN_KEYSTORE_H
10 std::map<std::vector<unsigned char>, CPrivKey> mapKeys;
11 mutable CCriticalSection cs_mapKeys;
12 virtual bool AddKey(const CKey& key);
13 bool HaveKey(const std::vector<unsigned char> &vchPubKey) const
15 return (mapKeys.count(vchPubKey) > 0);
17 bool GetPrivKey(const std::vector<unsigned char> &vchPubKey, CPrivKey& keyOut) const
19 std::map<std::vector<unsigned char>, CPrivKey>::const_iterator mi = mapKeys.find(vchPubKey);
20 if (mi != mapKeys.end())
22 keyOut = (*mi).second;
27 std::vector<unsigned char> GenerateNewKey();