| 115 | } |
| 116 | |
| 117 | bool DecryptSecret(const CKeyingMaterial& vMasterKey, const vector<unsigned char>& vchCiphertext, const uint256& nIV, |
| 118 | CKeyingMaterial& vchPlaintext) { |
| 119 | CCrypter cKeyCrypter; |
| 120 | vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE); |
| 121 | memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE); |
| 122 | if (!cKeyCrypter.SetKey(vMasterKey, chIV)) |
| 123 | return false; |
| 124 | return cKeyCrypter.Decrypt(vchCiphertext, *((CKeyingMaterial*)&vchPlaintext)); |
| 125 | } |
| 126 | |
| 127 | bool CCryptoKeyStore::SetCrypted() { |
| 128 | LOCK(cs_KeyStore); |