Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentxs::ClientConnection Class Reference

#include <ClientConnection.hpp>

Public Member Functions

 ClientConnection ()
 
 ~ClientConnection ()
 
void SetPublicKey (const OTString &publicKey)
 
void SetPublicKey (const OTAsymmetricKey &publicKey)
 
bool SealMessageForRecipient (OTMessage &msg, OTEnvelope &envelope)
 

Detailed Description

Definition at line 144 of file ClientConnection.hpp.

Constructor & Destructor Documentation

opentxs::ClientConnection::ClientConnection ( )

Definition at line 191 of file ClientConnection.cpp.

192  : publicKey_(OTAsymmetricKey::KeyFactory())
193 {
194 }
static EXPORT OTAsymmetricKey * KeyFactory()
opentxs::ClientConnection::~ClientConnection ( )

Definition at line 196 of file ClientConnection.cpp.

197 {
198  if (nullptr != publicKey_) {
199  delete publicKey_;
200  publicKey_ = nullptr;
201  }
202 }

Member Function Documentation

bool opentxs::ClientConnection::SealMessageForRecipient ( OTMessage msg,
OTEnvelope envelope 
)

Definition at line 171 of file ClientConnection.cpp.

173 {
174  OT_ASSERT(nullptr != publicKey_);
175 
176  if (!(publicKey_->IsEmpty()) && publicKey_->IsPublic()) {
177  // Save the ready-to-go message into a string.
178  OTString strEnvelopeContents(msg);
179 
180  // Seal the string up into an encrypted Envelope.
181  if (strEnvelopeContents.Exists())
182  return envelope.Seal(*publicKey_, strEnvelopeContents);
183  }
184  else
185  OTLog::Error(
186  "ClientConnection::SealMessageForRecipient: "
187  "Unable to seal message, possibly a missing public key. \n");
188  return false;
189 }
static EXPORT void Error(const char *szError)
Definition: OTLog.cpp:831
#define OT_ASSERT(x)
Definition: Assert.hpp:150
void opentxs::ClientConnection::SetPublicKey ( const OTString publicKey)

Definition at line 147 of file ClientConnection.cpp.

148 {
149  OT_ASSERT(nullptr != publicKey_);
150 
151  // SetPublicKey takes the ascii-encoded text, including bookends, and
152  // processes it into the OTAssymeticKey object. If successful, the
153  // OTAssymetricKey is now fully functional for encrypting and verifying.
154  publicKey_->SetPublicKey(publicKey, true);
155 }
EXPORT bool SetPublicKey(const OTASCIIArmor &strKey)
#define OT_ASSERT(x)
Definition: Assert.hpp:150
void opentxs::ClientConnection::SetPublicKey ( const OTAsymmetricKey publicKey)

Definition at line 157 of file ClientConnection.cpp.

158 {
159  OT_ASSERT(nullptr != publicKey_);
160 
161  OTString strNymsPublicKey;
162 
163  publicKey.GetPublicKey(strNymsPublicKey, true);
164  publicKey_->SetPublicKey(strNymsPublicKey, true);
165 }
EXPORT bool SetPublicKey(const OTASCIIArmor &strKey)
#define OT_ASSERT(x)
Definition: Assert.hpp:150

The documentation for this class was generated from the following files: