mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 02:25:53 +00:00
first
This commit is contained in:
36
keystore.cpp
Normal file
36
keystore.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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 <vector>
|
||||
|
||||
|
||||
//#include "crypter.h"
|
||||
|
||||
std::vector<unsigned char> 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<unsigned char> &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;
|
||||
}
|
||||
Reference in New Issue
Block a user