upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main.h b/src/main.h
index cca2cad..c458412 100644
--- a/src/main.h
+++ b/src/main.h
@@ -129,6 +129,46 @@ FILE* AppendBlockFile(unsigned int& nFileRet);
129bool AddKey(const CKey& key); 129bool AddKey(const CKey& key);
130vector<unsigned char> GenerateNewKey(); 130vector<unsigned char> GenerateNewKey();
131 131
132// --- Wallet encryption ----------------------------------------------------
133//
134// Plain wallets keep private keys in mapKeys. Encrypted wallets keep public
135// keys visible so balances can still be recognized while locked, and decrypt
136// private keys only after an unlock passphrase has supplied the master key.
137typedef vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
138extern map<vector<unsigned char>, vector<unsigned char> > mapCryptedKeys;
139extern map<unsigned int, CWalletMasterKey> mapMasterKeys;
140extern unsigned int nWalletMasterKeyMaxID;
141extern CKeyingMaterial vWalletMasterKey;
142extern vector<unsigned char> vchCryptedHDMaster;
143extern vector<unsigned char> vchCryptedHDChainCode;
144extern bool fWalletEncrypted;
145extern bool fWalletLocked;
146bool IsWalletEncrypted();
147bool IsWalletLocked();
148void LockWallet();
149bool UnlockWallet(const string& strPassphrase, string& strErrorRet);
150bool DeriveWalletPassphraseKey(const string& strPassphrase,
151 const vector<unsigned char>& vchSalt,
152 unsigned int nDeriveIterations,
153 CKeyingMaterial& vchKeyRet,
154 vector<unsigned char>& vchIVRet);
155bool EncryptSecret(const CKeyingMaterial& vchKey,
156 const vector<unsigned char>& vchPlaintext,
157 const vector<unsigned char>& vchIV,
158 vector<unsigned char>& vchCiphertextRet);
159bool DecryptSecret(const CKeyingMaterial& vchKey,
160 const vector<unsigned char>& vchCiphertext,
161 const vector<unsigned char>& vchIV,
162 vector<unsigned char>& vchPlaintextRet);
163vector<unsigned char> WalletKeyIV(const vector<unsigned char>& vchPubKey);
164vector<unsigned char> WalletSecretIV(const string& strLabel);
165bool AddCryptedKey(const vector<unsigned char>& vchPubKey,
166 const vector<unsigned char>& vchCryptedSecret);
167bool WalletCanSpendKey(const vector<unsigned char>& vchPubKey);
168bool GetWalletPrivKey(const vector<unsigned char>& vchPubKey,
169 CPrivKey& vchPrivKeyRet,
170 string& strErrorRet);
171
132// --- Key pool ------------------------------------------------------------- 172// --- Key pool -------------------------------------------------------------
133// 173//
134// A backup of this wallet only ever contained the keys that existed the moment 174// A backup of this wallet only ever contained the keys that existed the moment