diff options
Diffstat (limited to 'src/main.h')
| -rw-r--r-- | src/main.h | 40 |
1 files changed, 40 insertions, 0 deletions
| @@ -129,6 +129,46 @@ FILE* AppendBlockFile(unsigned int& nFileRet); | |||
| 129 | bool AddKey(const CKey& key); | 129 | bool AddKey(const CKey& key); |
| 130 | vector<unsigned char> GenerateNewKey(); | 130 | vector<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. | ||
| 137 | typedef vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial; | ||
| 138 | extern map<vector<unsigned char>, vector<unsigned char> > mapCryptedKeys; | ||
| 139 | extern map<unsigned int, CWalletMasterKey> mapMasterKeys; | ||
| 140 | extern unsigned int nWalletMasterKeyMaxID; | ||
| 141 | extern CKeyingMaterial vWalletMasterKey; | ||
| 142 | extern vector<unsigned char> vchCryptedHDMaster; | ||
| 143 | extern vector<unsigned char> vchCryptedHDChainCode; | ||
| 144 | extern bool fWalletEncrypted; | ||
| 145 | extern bool fWalletLocked; | ||
| 146 | bool IsWalletEncrypted(); | ||
| 147 | bool IsWalletLocked(); | ||
| 148 | void LockWallet(); | ||
| 149 | bool UnlockWallet(const string& strPassphrase, string& strErrorRet); | ||
| 150 | bool DeriveWalletPassphraseKey(const string& strPassphrase, | ||
| 151 | const vector<unsigned char>& vchSalt, | ||
| 152 | unsigned int nDeriveIterations, | ||
| 153 | CKeyingMaterial& vchKeyRet, | ||
| 154 | vector<unsigned char>& vchIVRet); | ||
| 155 | bool EncryptSecret(const CKeyingMaterial& vchKey, | ||
| 156 | const vector<unsigned char>& vchPlaintext, | ||
| 157 | const vector<unsigned char>& vchIV, | ||
| 158 | vector<unsigned char>& vchCiphertextRet); | ||
| 159 | bool DecryptSecret(const CKeyingMaterial& vchKey, | ||
| 160 | const vector<unsigned char>& vchCiphertext, | ||
| 161 | const vector<unsigned char>& vchIV, | ||
| 162 | vector<unsigned char>& vchPlaintextRet); | ||
| 163 | vector<unsigned char> WalletKeyIV(const vector<unsigned char>& vchPubKey); | ||
| 164 | vector<unsigned char> WalletSecretIV(const string& strLabel); | ||
| 165 | bool AddCryptedKey(const vector<unsigned char>& vchPubKey, | ||
| 166 | const vector<unsigned char>& vchCryptedSecret); | ||
| 167 | bool WalletCanSpendKey(const vector<unsigned char>& vchPubKey); | ||
| 168 | bool 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 |