X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fwallet.cpp;h=a1fe81d297f07be0f10898b9a92c3128f2306b01;hp=87ffe936f9701a1f62e77b2bf0a366348955dfaf;hb=9e58e0a8ca28b15a4bfa677f5b23891972db40fd;hpb=d4796a3a3259173f173a6b8c4832549f039de8da diff --git a/src/wallet.cpp b/src/wallet.cpp index 87ffe93..a1fe81d 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -12,6 +12,7 @@ #include "kernel.h" #include "coincontrol.h" #include +#include #include "main.h" @@ -516,6 +517,19 @@ bool CWallet::DecryptWallet(const SecureString& strWalletPassphrase) return true; } +bool CWallet::GetPEM(const CKeyID &keyID, const std::string &fileName, const SecureString &strPassKey) const +{ + BIO *pemOut = BIO_new_file(fileName.c_str(), "w"); + if (pemOut == NULL) + return error("GetPEM() : failed to create file %s\n", fileName.c_str()); + CKey key; + if (!GetKey(keyID, key)) + return error("GetPEM() : failed to get key for address=%s\n", CBitcoinAddress(keyID).ToString().c_str()); + bool result = key.WritePEM(pemOut, strPassKey); + BIO_free(pemOut); + return result; +} + int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb) { int64_t nRet = nOrderPosNext++;