| 150 | } |
| 151 | |
| 152 | bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) { |
| 153 | { |
| 154 | LOCK(cs_KeyStore); |
| 155 | if (!SetCrypted()) |
| 156 | return false; |
| 157 | |
| 158 | CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin(); |
| 159 | for (; mi != mapCryptedKeys.end(); ++mi) { |
| 160 | const CPubKey& vchPubKey = (*mi).second.first; |
| 161 | const vector<unsigned char>& vchCryptedSecret = (*mi).second.second; |
| 162 | CKeyingMaterial vchSecret; |
| 163 | if (!DecryptSecret(vMasterKeyIn, vchCryptedSecret, vchPubKey.GetHash(), vchSecret)) |
| 164 | return false; |
| 165 | if (vchSecret.size() != 32) |
| 166 | return false; |
| 167 | CKey key; |
| 168 | key.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.IsCompressed()); |
| 169 | if (key.GetPubKey() == vchPubKey) |
| 170 | break; |
| 171 | return false; |
| 172 | } |
| 173 | vMasterKey = vMasterKeyIn; |
| 174 | } |
| 175 | |
| 176 | return true; |
| 177 | } |
| 178 | |
| 179 | bool CCryptoKeyStore::AddKeyCombi(const CKeyID& keyId, const CKeyCombi& keyCombi) { |
| 180 | { |
nothing calls this directly
no test coverage detected