bool key_store_crypto::get_key( const types::id_key_t & address, key & key_out ) const { std::lock_guard<std::recursive_mutex> l1(mutex_); if (is_crypted() == false) { return key_store_basic::get_key(address, key_out); } auto it = m_crypted_keys.find(address); if (it != m_crypted_keys.end()) { const auto & pub_key = it->second.first; const auto & crypted_secret = it->second.second; key::secret_t s; /** * Decrypt the secret. */ if ( crypter::decrypt_secret(m_master_key, crypted_secret, pub_key.get_hash(), s) == false ) { return false; } if (s.size() != 32) { return false; } /** * Set the public key. */ key_out.set_public_key(pub_key); /** * Set the secret. */ key_out.set_secret(s); return true; } return false; }