#include <OTNymOrSymmetricKey.hpp>
Definition at line 150 of file OTNymOrSymmetricKey.hpp.
opentxs::OTNym_or_SymmetricKey::~OTNym_or_SymmetricKey |
( |
| ) |
|
Definition at line 166 of file OTNymOrSymmetricKey.cpp.
176 if (m_bCleanupPassword && (
nullptr != m_pPassword))
delete m_pPassword;
177 m_pPassword =
nullptr;
179 m_pstrDisplay =
nullptr;
Definition at line 192 of file OTNymOrSymmetricKey.cpp.
196 m_pPassword(
nullptr),
197 m_bCleanupPassword(
false),
198 m_pstrDisplay(rhs.m_pstrDisplay)
207 m_pPassword = rhs.m_pPassword;
opentxs::OTNym_or_SymmetricKey::OTNym_or_SymmetricKey |
( |
const OTPseudonym & |
theNym, |
|
|
const OTString * |
pstrDisplay = nullptr |
|
) |
| |
Definition at line 236 of file OTNymOrSymmetricKey.cpp.
239 : m_pNym(const_cast<OTPseudonym*>(&theNym)),
241 m_pPassword(
nullptr),
242 m_bCleanupPassword(
false),
243 m_pstrDisplay(pstrDisplay)
opentxs::OTNym_or_SymmetricKey::OTNym_or_SymmetricKey |
( |
const OTSymmetricKey & |
theKey, |
|
|
const OTString * |
pstrDisplay = nullptr |
|
) |
| |
Definition at line 247 of file OTNymOrSymmetricKey.cpp.
251 m_pKey(const_cast<OTSymmetricKey*>(&theKey)),
252 m_pPassword(
nullptr),
253 m_bCleanupPassword(
false),
254 m_pstrDisplay(pstrDisplay)
Definition at line 258 of file OTNymOrSymmetricKey.cpp.
263 , m_pKey(const_cast<OTSymmetricKey*>(&theKey))
264 , m_pPassword(const_cast<OTPassword*>(&thePassword))
265 , m_bCleanupPassword(
false)
266 , m_pstrDisplay(pstrDisplay)
Definition at line 327 of file OTNymOrSymmetricKey.cpp.
329 OTIdentifier idTHIS, idRHS;
332 rhs.GetIdentifier(idRHS);
334 return (idTHIS == idRHS);
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
void opentxs::OTNym_or_SymmetricKey::GetIdentifier |
( |
OTIdentifier & |
theIdentifier | ) |
const |
Definition at line 337 of file OTNymOrSymmetricKey.cpp.
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT bool IsNym() const
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT bool IsKey() const
void opentxs::OTNym_or_SymmetricKey::GetIdentifier |
( |
OTString & |
strIdentifier | ) |
const |
Definition at line 350 of file OTNymOrSymmetricKey.cpp.
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT bool IsNym() const
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT bool IsKey() const
EXPORT OTSymmetricKey* opentxs::OTNym_or_SymmetricKey::GetKey |
( |
| ) |
const |
|
inline |
EXPORT OTPseudonym* opentxs::OTNym_or_SymmetricKey::GetNym |
( |
| ) |
const |
|
inline |
EXPORT OTPassword* opentxs::OTNym_or_SymmetricKey::GetPassword |
( |
| ) |
const |
|
inline |
EXPORT bool opentxs::OTNym_or_SymmetricKey::HasPassword |
( |
| ) |
const |
|
inline |
EXPORT bool opentxs::OTNym_or_SymmetricKey::IsKey |
( |
| ) |
const |
|
inline |
EXPORT bool opentxs::OTNym_or_SymmetricKey::IsNym |
( |
| ) |
const |
|
inline |
bool opentxs::OTNym_or_SymmetricKey::Open_or_Decrypt |
( |
const OTEnvelope & |
inputEnvelope, |
|
|
OTString & |
strOutput, |
|
|
const OTString * |
pstrDisplay = nullptr |
|
) |
| |
Definition at line 369 of file OTNymOrSymmetricKey.cpp.
373 const char* szFunc =
"OTNym_or_SymmetricKey::Open_or_Decrypt";
375 bool bSuccess =
false;
376 bool bHadToInstantiatePassword =
false;
382 bSuccess = (
const_cast<OTEnvelope&
>(inputEnvelope))
383 .Open(*(
GetNym()), strOutput);
388 OTPassword* pPassword =
nullptr;
394 const OTString strDisplay(
395 (
nullptr == pstrDisplay) ? szFunc : pstrDisplay->Get());
401 (
nullptr == m_pstrDisplay)
409 <<
": Failed trying to retrieve passphrase for key. "
410 "Returning false.\n";
416 bHadToInstantiatePassword =
true;
419 bSuccess = (
const_cast<OTEnvelope&
>(inputEnvelope))
420 .Decrypt(strOutput, *(
GetKey()), *pPassword);
423 if (bHadToInstantiatePassword) {
425 m_bCleanupPassword =
true;
426 m_pPassword = pPassword;
OTLOG_IMPORT OTLogStream otOut
EXPORT OTPseudonym * GetNym() const
static EXPORT OTPassword * GetPassphraseFromUser(const OTString *pstrDisplay=nullptr, bool bAskTwice=false)
EXPORT OTSymmetricKey * GetKey() const
EXPORT OTPassword * GetPassword() const
EXPORT bool IsNym() const
EXPORT bool HasPassword() const
EXPORT bool IsKey() const
void opentxs::OTNym_or_SymmetricKey::Release |
( |
| ) |
|
void opentxs::OTNym_or_SymmetricKey::Release_Nym_or_SymmetricKey |
( |
| ) |
|
Definition at line 306 of file OTNymOrSymmetricKey.cpp.
308 if (
nullptr != m_pNym) {
313 if (
nullptr != m_pKey) m_pKey->
Release();
315 if (
nullptr != m_pPassword) {
318 if (m_bCleanupPassword)
322 m_pPassword =
nullptr;
virtual EXPORT void Release()
bool opentxs::OTNym_or_SymmetricKey::Seal_or_Encrypt |
( |
OTEnvelope & |
outputEnvelope, |
|
|
const OTString & |
strInput, |
|
|
const OTString * |
pstrDisplay = nullptr |
|
) |
| |
Definition at line 444 of file OTNymOrSymmetricKey.cpp.
448 const char* szFunc =
"OTNym_or_SymmetricKey::Seal_or_Encrypt";
450 bool bSuccess =
false;
451 bool bHadToInstantiatePassword =
false;
456 bSuccess = outputEnvelope.Seal(*(
GetNym()), strInput);
459 OTPassword* pPassword =
nullptr;
465 const OTString strDisplay(
466 (
nullptr == pstrDisplay) ? szFunc : pstrDisplay->Get());
472 (
nullptr == m_pstrDisplay)
480 <<
": Failed trying to retrieve passphrase for key. "
481 "Returning false.\n";
487 bHadToInstantiatePassword =
true;
490 bSuccess = outputEnvelope.Encrypt(strInput, *(
GetKey()), *pPassword);
493 if (bHadToInstantiatePassword) {
495 m_bCleanupPassword =
true;
496 m_pPassword = pPassword;
OTLOG_IMPORT OTLogStream otOut
EXPORT OTPseudonym * GetNym() const
static EXPORT OTPassword * GetPassphraseFromUser(const OTString *pstrDisplay=nullptr, bool bAskTwice=false)
EXPORT OTSymmetricKey * GetKey() const
EXPORT OTPassword * GetPassword() const
EXPORT bool IsNym() const
EXPORT bool HasPassword() const
EXPORT bool IsKey() const
Definition at line 270 of file OTNymOrSymmetricKey.cpp.
272 if (&other !=
this) {
273 std::swap(m_pNym, other.m_pNym);
274 std::swap(m_pKey, other.m_pKey);
275 std::swap(m_pPassword, other.m_pPassword);
276 std::swap(m_bCleanupPassword, other.m_bCleanupPassword);
277 std::swap(m_pstrDisplay, other.m_pstrDisplay);
The documentation for this class was generated from the following files: