Ejemplo n.º 1
0
bool db_wallet::write_key(
    const key_public & pub_key, const key::private_t & pri_key
    )
{
    m_wallet_updated++;
    
    return write(
        std::make_pair(std::string("key"), pub_key.bytes()), pri_key, false
    );
}
Ejemplo n.º 2
0
bool key::set_public_key(const key_public & value)
{
    const auto * ptr = &value.bytes()[0];
    
    if (o2i_ECPublicKey(&m_EC_KEY, &ptr, value.bytes().size()))
    {
        m_set = true;
        
        if (value.bytes().size() == 33)
        {
            set_compressed_public_key();
        }
        
        return true;
    }
    
    m_EC_KEY = 0;
    
    reset();
    
    return false;
}
Ejemplo n.º 3
0
bool db_wallet::write_crypted_key(
    const key_public & pub_key,
    const std::vector<std::uint8_t> & crypted_secret,
    const bool & erase_unencrypted_key
    )
{
    m_wallet_updated++;
    
    if (
        write(std::make_pair(std::string("ckey"), pub_key.bytes()),
        crypted_secret, false) == false
        )
    {
        return false;
    }

    if (erase_unencrypted_key)
    {
        erase(std::make_pair(std::string("key"), pub_key.bytes()));
        erase(std::make_pair(std::string("wkey"), pub_key.bytes()));
    }

    return true;
}
Ejemplo n.º 4
0
bool key_store_crypto::add_crypted_key(
    const key_public & public_key,
    const std::vector<std::uint8_t> & crypted_secret
)
{
    std::lock_guard<std::recursive_mutex> l1(mutex_);

    if (set_crypted() == false)
    {
        return false;
    }

    m_crypted_keys[public_key.get_id()] =
        std::make_pair(public_key, crypted_secret)
        ;

    return true;
}
Ejemplo n.º 5
0
incentive_vote::incentive_vote(
    const std::uint32_t & block_height, const sha256 & hash_block,
    const std::string & addr, const key_public & public_key
    )
    : m_version(current_version)
    , m_block_height(block_height)
    , m_hash_block(hash_block)
    , m_hash_nonce(
        hash_block ^ sha256::from_digest(&hash::sha256d(
        reinterpret_cast<const std::uint8_t *> (
        addr.data()), addr.size())[0]) ^ public_key.get_hash()
    )
    , m_address(addr)
    , m_public_key(public_key)
    , m_score(-1)
{
    // ...
}
Ejemplo n.º 6
0
bool db_wallet::write_defaultkey(const key_public & value)
{
    m_wallet_updated++;
    
    return write(std::string("defaultkey"), value.bytes());
}