bool OTEnvelope::SetFromBookendedString( const String& strArmorWithBookends, // input bool bEscaped) { OTASCIIArmor theArmoredText; const bool bLoaded = theArmoredText.LoadFromString( const_cast<String&>(strArmorWithBookends), bEscaped); // std::string str_override="-----BEGIN"); if (bLoaded) { // This function will base64 DECODE theArmoredText's string contents // and return them as binary in m_dataContents const bool bGotData = theArmoredText.GetData(m_dataContents, true); // bLineBreaks = true if (!bGotData) otErr << __FUNCTION__ << ": Failed while calling: " "theArmoredText.GetData\n"; else return true; } else otErr << __FUNCTION__ << ": Failed while calling: " "theArmoredText.LoadFromString\n"; return false; }
OTData::OTData(const OTASCIIArmor &theSource) : m_pData(NULL), m_lPosition(0), m_lSize(0) { if (theSource.Exists()) theSource.GetData(*this); // *********** }
// Should be called "Set This Envelope's binary ciphertext data, from an // ascii-armored input string." // // Let's say you just retrieved the ASCII-armored contents of an encrypted // envelope. // Perhaps someone sent it to you, and you just read it out of his message. // And let's say you want to get those contents back into binary form in an // Envelope object again, so that they can be decrypted and extracted back as // plaintext. Fear not, just call this function. // bool OTEnvelope::SetAsciiArmoredData(const OTASCIIArmor& theArmoredText, bool bLineBreaks) { return theArmoredText.GetData(m_dataContents, bLineBreaks); }
// Let's say you just retrieved the ASCII-armored contents of an encrypted envelope. // Perhaps someone sent it to you, and you just read it out of his message. // And let's say you want to get those contents back into binary form in an // Envelope object again, so that they can be decrypted and extracted back as // plaintext. Fear not, just call this function. // should be called "Set Via Ascii Armored Data" bool OTEnvelope::SetAsciiArmoredData(const OTASCIIArmor & theArmoredText) { return theArmoredText.GetData(m_dataContents); }
OTData::OTData(const OTASCIIArmor& source) { if (source.Exists()) { source.GetData(*this); } }