| 991 | } |
| 992 | |
| 993 | std::map<CKeyID, CKey> DescriptorScriptPubKeyMan::GetKeys() const |
| 994 | { |
| 995 | AssertLockHeld(cs_desc_man); |
| 996 | if (m_storage.HasEncryptionKeys() && !m_storage.IsLocked()) { |
| 997 | KeyMap keys; |
| 998 | for (const auto& key_pair : m_map_crypted_keys) { |
| 999 | const CPubKey& pubkey = key_pair.second.first; |
| 1000 | const std::vector<unsigned char>& crypted_secret = key_pair.second.second; |
| 1001 | CKey key; |
| 1002 | m_storage.WithEncryptionKey([&](const CKeyingMaterial& encryption_key) { |
| 1003 | return DecryptKey(encryption_key, crypted_secret, pubkey, key); |
| 1004 | }); |
| 1005 | keys[pubkey.GetID()] = key; |
| 1006 | } |
| 1007 | return keys; |
| 1008 | } |
| 1009 | return m_map_keys; |
| 1010 | } |
| 1011 | |
| 1012 | bool DescriptorScriptPubKeyMan::HasPrivKey(const CKeyID& keyid) const |
| 1013 | { |
no test coverage detected