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


C++ OTPseudonym::GetPublicKey方法代码示例

本文整理汇总了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;
	
}
开发者ID:Hangman-65,项目名称:Open-Transactions,代码行数:62,代码来源:OTAssetContract.cpp

示例2: Seal

// RSA / AES
bool OTEnvelope::Seal(const OTPseudonym & theRecipient, const OTString & theContents)
{
	return Seal(theRecipient.GetPublicKey(), theContents);
}
开发者ID:Mindonaut,项目名称:Open-Transactions,代码行数:5,代码来源:OTEnvelope.cpp


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