本文整理汇总了C++中OTPseudonym::GetPublicKey方法的典型用法代码示例。如果您正苦于以下问题:C++ OTPseudonym::GetPublicKey方法的具体用法?C++ OTPseudonym::GetPublicKey怎么用?C++ OTPseudonym::GetPublicKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTPseudonym
的用法示例。
在下文中一共展示了OTPseudonym::GetPublicKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateBasket
// Normally, Asset Contracts do NOT update / rewrite their contents, since their
// primary goal is for the signature to continue to verify. But when first creating
// a basket contract, we have to rewrite the contents, which is done here.
bool OTAssetContract::CreateBasket(OTBasket & theBasket, OTPseudonym & theSigner)
{
Release();
// Grab a string copy of the basket information.
theBasket.SaveContractRaw(m_strBasketInfo);
// -------------------------------
// Insert the server's public key as the "contract" key for this basket currency.
OTString strPubKey, strKeyName("contract"); // todo stop hardcoding
theSigner.GetPublicKey().GetPublicKey(strPubKey);
InsertNym(strKeyName, strPubKey);
// todo check the above two return values.
OTASCIIArmor theBasketArmor(m_strBasketInfo);
// -------------------------------
m_xmlUnsigned.Concatenate("<?xml version=\"%s\"?>\n\n", "1.0");
m_xmlUnsigned.Concatenate("<basketContract version=\"%s\">\n\n", m_strVersion.Get());
m_xmlUnsigned.Concatenate("<basketInfo>\n%s</basketInfo>\n\n", theBasketArmor.Get());
m_xmlUnsigned.Concatenate("<key name=\"%s\">\n%s</key>\n\n", strKeyName.Get(), strPubKey.Get());
m_xmlUnsigned.Concatenate("</basketContract>\n");
// This function assumes that m_xmlUnsigned is ready to be processed.
// This function only processes that portion of the contract.
bool bLoaded = LoadContractXML();
if (bLoaded)
{
OTString strTemp;
SignContract(theSigner);
RewriteContract(strTemp); // this trims
// This is probably redundant...
// std::string str_Trim(strTemp.Get());
// std::string str_Trim2 = OTString::trim(str_Trim);
// strTemp.Set(str_Trim2.c_str());
// -----------------------------------
Release();
LoadContractFromString(strTemp);
SaveContract();
OTIdentifier NEW_ID;
CalculateContractID(NEW_ID);
m_ID = NEW_ID;
return true;
}
return false;
}
示例2: Seal
// RSA / AES
bool OTEnvelope::Seal(const OTPseudonym & theRecipient, const OTString & theContents)
{
return Seal(theRecipient.GetPublicKey(), theContents);
}