mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
37 lines
881 B
C++
37 lines
881 B
C++
// 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 <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;
|
|
}
|