本文整理汇总了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;
}
示例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;
}
示例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;
}