// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #include "keystore.h" #include "BitcoinUtil.h" #include //#include "crypter.h" std::vector CKeyStore::GenerateNewKey() { RandAddSeedPerfmon(); CKey key; key.MakeNewKey(); if (!AddKey(key)) throw std::runtime_error("CKeyStore::GenerateNewKey() : AddKey failed"); return key.GetPubKey(); } bool CKeyStore::GetPubKey(const NewcoinAddress& address, std::vector& vchPubKeyOut) const { CKey key; if (!GetKey(address, key)) return false; vchPubKeyOut = key.GetPubKey(); return true; } bool CBasicKeyStore::AddKey(const CKey& key) { mapKeys[key.GetAddress()] = key.GetSecret(); return true; }