本文整理汇总了C++中OTASCIIArmor::LoadFromExactPath方法的典型用法代码示例。如果您正苦于以下问题:C++ OTASCIIArmor::LoadFromExactPath方法的具体用法?C++ OTASCIIArmor::LoadFromExactPath怎么用?C++ OTASCIIArmor::LoadFromExactPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTASCIIArmor
的用法示例。
在下文中一共展示了OTASCIIArmor::LoadFromExactPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FlatFile_RetrieveSecret
// static
bool OTKeyring::FlatFile_RetrieveSecret(const String& strUser,
OTPassword& thePassword,
const std::string& str_display)
{
OT_ASSERT(strUser.Exists());
const std::string str_pw_folder(OTKeyring::FlatFile_GetPasswordFolder());
if (!str_pw_folder.empty()) {
String strExactPath;
strExactPath.Format("%s%s%s", str_pw_folder.c_str(),
Log::PathSeparator(), strUser.Get());
const std::string str_ExactPath(strExactPath.Get());
// Get the password
//
OTASCIIArmor ascData;
if (!ascData.LoadFromExactPath(str_ExactPath))
otErr << "OTKeyring::FlatFile_RetrieveSecret: "
<< "Failed trying to decode secret from flat file contents."
<< "\n";
else {
OTData thePayload(ascData);
ascData.zeroMemory();
if (thePayload.IsEmpty())
otErr << __FUNCTION__ << ": Failed trying to decode secret "
"OTData from OTASCIIArmor from "
"flat file contents.\n";
else {
thePassword.setMemory(thePayload.GetPointer(),
thePayload.GetSize());
thePayload.zeroMemory(); // for security.
return true;
}
}
}
// Not an error: what if it just hasn't been set there yet?
//
otWarn << __FUNCTION__ << ": Unable to retrieve any derived key, since "
"password_folder not provided in config file.\n";
return false;
}