Example #1
0
bool OTEnvelope::Seal(const Nym& theRecipient, const String& theInput)
{
    String strNymID;
    mapOfAsymmetricKeys theKeys;
    theRecipient.GetIdentifier(strNymID);
    theKeys.insert(std::pair<std::string, OTAsymmetricKey*>(
        strNymID.Get(),
        const_cast<OTAsymmetricKey*>(&(theRecipient.GetPublicEncrKey()))));

    return Seal(theKeys, theInput);
}
Example #2
0
bool OTEnvelope::Seal(setOfNyms& theRecipients, const String& theInput)
{
    mapOfAsymmetricKeys RecipPubKeys;

    // Loop through theRecipients, and add the public key of each one to a set
    // of keys.
    for (auto& it : theRecipients) {
        Nym* pNym = it;
        OT_ASSERT_MSG(nullptr != pNym,
                      "OTEnvelope::Seal: Assert: nullptr pseudonym pointer.");

        String strNymID;
        pNym->GetIdentifier(strNymID);
        RecipPubKeys.insert(std::pair<std::string, OTAsymmetricKey*>(
            strNymID.Get(),
            const_cast<OTAsymmetricKey*>(&(pNym->GetPublicEncrKey()))));
    }

    if (RecipPubKeys.empty()) return false;

    return Seal(RecipPubKeys, theInput);
}