本文整理汇总了C++中CKey::IsCompressed方法的典型用法代码示例。如果您正苦于以下问题:C++ CKey::IsCompressed方法的具体用法?C++ CKey::IsCompressed怎么用?C++ CKey::IsCompressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKey
的用法示例。
在下文中一共展示了CKey::IsCompressed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetKey
void CTransactcoinSecret::SetKey(const CKey& vchSecret)
{
assert(vchSecret.IsValid());
SetData(Params().Base58Prefix(CChainParams::SECRET_KEY), vchSecret.begin(), vchSecret.size());
if (vchSecret.IsCompressed())
vchData.push_back(1);
}
示例2: SetKey
void CBitcoinSecret::SetKey(const CKey& vchSecret,
std::vector<unsigned char> prefix) {
assert(vchSecret.IsValid());
SetData(prefix, vchSecret.begin(), vchSecret.size());
if (vchSecret.IsCompressed())
vchData.push_back(1);
}
示例3: EncodeSecret
std::string EncodeSecret(const CKey& key)
{
assert(key.IsValid());
std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::SECRET_KEY);
data.insert(data.end(), key.begin(), key.end());
if (key.IsCompressed()) {
data.push_back(1);
}
std::string ret = EncodeBase58Check(data);
memory_cleanse(data.data(), data.size());
return ret;
}
示例4: CreateSig
bool MutableTransactionSignatureCreator::CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode, SigVersion sigversion) const
{
CKey key;
if (!provider.GetKey(address, key))
return false;
// Signing with uncompressed keys is disabled in witness scripts
if (sigversion == SigVersion::WITNESS_V0 && !key.IsCompressed())
return false;
uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion);
if (!key.Sign(hash, vchSig))
return false;
vchSig.push_back((unsigned char)nHashType);
return true;
}
示例5: addr
void Bip38ToolDialog::on_encryptKeyButton_ENC_clicked()
{
if (!model)
return;
QString qstrPassphrase = ui->passphraseIn_ENC->text();
QString strInvalid;
if (!isValidPassphrase(qstrPassphrase, strInvalid)) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("The entered passphrase is invalid. ") + strInvalid + QString(" is not valid") + QString(" ") + tr("Allowed: 0-9,a-z,A-Z,") + specialChar);
return;
}
CBitcoinAddress addr(ui->addressIn_ENC->text().toStdString());
if (!addr.IsValid()) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID)) {
ui->addressIn_ENC->setValid(false);
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
WalletModel::UnlockContext ctx(model->requestUnlock(AskPassphraseDialog::Context::BIP_38, true));
if (!ctx.isValid()) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("Wallet unlock was cancelled."));
return;
}
CKey key;
if (!pwalletMain->GetKey(keyID, key)) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("Private key for the entered address is not available."));
return;
}
std::string encryptedKey = BIP38_Encrypt(addr.ToString(), qstrPassphrase.toStdString(), key.GetPrivKey_256(), key.IsCompressed());
ui->encryptedKeyOut_ENC->setText(QString::fromStdString(encryptedKey));
}
示例6: SetKey
void CSharkfundSecret::SetKey(const CKey& vchSecret) {
assert(vchSecret.IsValid());
SetData(SysCfg().Base58Prefix(CBaseParams::SECRET_KEY), vchSecret.begin(), vchSecret.size());
if (vchSecret.IsCompressed())
vchData.push_back(1);
}
示例7: HaveKey
bool HaveKey(const CKeyStore& store, const CKey& key)
{
CKey key2;
key2.Set(key.begin(), key.end(), !key.IsCompressed());
return store.HaveKey(key.GetPubKey().GetID()) || store.HaveKey(key2.GetPubKey().GetID());
}