当前位置: 首页>>代码示例>>C++>>正文


C++ CKeyingMaterial::data方法代码示例

本文整理汇总了C++中CKeyingMaterial::data方法的典型用法代码示例。如果您正苦于以下问题:C++ CKeyingMaterial::data方法的具体用法?C++ CKeyingMaterial::data怎么用?C++ CKeyingMaterial::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKeyingMaterial的用法示例。


在下文中一共展示了CKeyingMaterial::data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Unlock

bool CHDSeed::Unlock(const CKeyingMaterial& vMasterKeyIn)
{

    assert(sizeof(m_UUID) == WALLET_CRYPTO_IV_SIZE);
    CKeyingMaterial vchMnemonic;
    if (!DecryptSecret(vMasterKeyIn, encryptedMnemonic, std::vector<unsigned char>(m_UUID.begin(), m_UUID.end()), vchMnemonic))
        return false;
    unencryptedMnemonic = SecureString(vchMnemonic.begin(), vchMnemonic.end());

    CKeyingMaterial vchMasterKeyPrivEncoded;
    if (!DecryptSecret(vMasterKeyIn, masterKeyPrivEncrypted, masterKeyPub.pubkey.GetHash(), vchMasterKeyPrivEncoded))
        return false;
    masterKeyPriv.Decode(vchMasterKeyPrivEncoded.data());

    CKeyingMaterial vchPurposeKeyPrivEncoded;
    if (!DecryptSecret(vMasterKeyIn, purposeKeyPrivEncrypted, purposeKeyPub.pubkey.GetHash(), vchPurposeKeyPrivEncoded))
        return false;
    purposeKeyPriv.Decode(vchPurposeKeyPrivEncoded.data());

    CKeyingMaterial vchCoinTypeKeyPrivEncoded;
    if (!DecryptSecret(vMasterKeyIn, cointypeKeyPrivEncrypted, cointypeKeyPub.pubkey.GetHash(), vchCoinTypeKeyPrivEncoded))
        return false;
    cointypeKeyPriv.Decode(vchCoinTypeKeyPrivEncoded.data());

    vMasterKey = vMasterKeyIn;

    return true;
}
开发者ID:Gulden,项目名称:gulden-official,代码行数:28,代码来源:account.cpp

示例2: Unlock

bool CAccountHD::Unlock(const CKeyingMaterial& vMasterKeyIn, bool& needsWriteToDisk)
{
    needsWriteToDisk = false;
    assert(sizeof(accountUUID) == WALLET_CRYPTO_IV_SIZE);

    // NB! We don't encrypt the keystores for HD accounts - as they only contain public keys.
    // So we don't need to unlock the underlying keystore.
    if (IsReadOnly())
        return true;

    // Decrypt account key
    CKeyingMaterial vchAccountKeyPrivEncoded;
    if (!DecryptSecret(vMasterKeyIn, accountKeyPrivEncrypted, std::vector<unsigned char>(accountUUID.begin(), accountUUID.end()), vchAccountKeyPrivEncoded))
        return false;
    accountKeyPriv.Decode(vchAccountKeyPrivEncoded.data());

    // Decrypt primary chain key
    CKeyingMaterial vchPrimaryChainKeyPrivEncoded;
    if (!DecryptSecret(vMasterKeyIn, primaryChainKeyEncrypted, primaryChainKeyPub.pubkey.GetHash(), vchPrimaryChainKeyPrivEncoded))
        return false;
    primaryChainKeyPriv.Decode(vchPrimaryChainKeyPrivEncoded.data());

    // Decrypt change chain key
    CKeyingMaterial vchChangeChainKeyPrivEncoded;
    if (!DecryptSecret(vMasterKeyIn, changeChainKeyEncrypted, changeChainKeyPub.pubkey.GetHash(), vchChangeChainKeyPrivEncoded))
        return false;
    changeChainKeyPriv.Decode(vchChangeChainKeyPrivEncoded.data());

    vMasterKey = vMasterKeyIn;

    return true;
}
开发者ID:ALEX196969,项目名称:gulden-official,代码行数:32,代码来源:account.cpp

示例3: SetKey

bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigned char>& chNewIV)
{
    if (chNewKey.size() != WALLET_CRYPTO_KEY_SIZE || chNewIV.size() != WALLET_CRYPTO_IV_SIZE)
        return false;

    memcpy(vchKey.data(), chNewKey.data(), chNewKey.size());
    memcpy(vchIV.data(), chNewIV.data(), chNewIV.size());

    fKeySet = true;
    return true;
}
开发者ID:CryptoRekt,项目名称:VERGE,代码行数:11,代码来源:crypter.cpp


注:本文中的CKeyingMaterial::data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。