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

#include <OTSignatureMetadata.hpp>

Public Member Functions

 OTSignatureMetadata ()
 
bool operator== (const OTSignatureMetadata &rhs) const
 
bool operator!= (const OTSignatureMetadata &rhs) const
 
bool SetMetadata (char metaKeyType, char metaNymID, char metaMasterCredID, char metaSubCredID)
 
bool HasMetadata () const
 
char GetKeyType () const
 
char FirstCharNymID () const
 
char FirstCharMasterCredID () const
 
char FirstCharSubCredID () const
 

Detailed Description

Definition at line 139 of file OTSignatureMetadata.hpp.

Constructor & Destructor Documentation

opentxs::OTSignatureMetadata::OTSignatureMetadata ( )

Definition at line 185 of file OTSignatureMetadata.cpp.

186  : hasMetadata_(false)
187  , metaKeyType_(0)
188  , metaNymID_(0)
189  , metaMasterCredID_(0)
190  , metaSubCredID_(0)
191 {
192 }

Member Function Documentation

char opentxs::OTSignatureMetadata::FirstCharMasterCredID ( ) const
inline

Definition at line 169 of file OTSignatureMetadata.hpp.

170  {
171  return metaMasterCredID_;
172  }
char opentxs::OTSignatureMetadata::FirstCharNymID ( ) const
inline

Definition at line 164 of file OTSignatureMetadata.hpp.

165  {
166  return metaNymID_;
167  }
char opentxs::OTSignatureMetadata::FirstCharSubCredID ( ) const
inline

Definition at line 174 of file OTSignatureMetadata.hpp.

175  {
176  return metaSubCredID_;
177  }
char opentxs::OTSignatureMetadata::GetKeyType ( ) const
inline

Definition at line 159 of file OTSignatureMetadata.hpp.

160  {
161  return metaKeyType_;
162  }
bool opentxs::OTSignatureMetadata::HasMetadata ( ) const
inline

Definition at line 154 of file OTSignatureMetadata.hpp.

155  {
156  return hasMetadata_;
157  }
bool opentxs::OTSignatureMetadata::operator!= ( const OTSignatureMetadata rhs) const
inline

Definition at line 146 of file OTSignatureMetadata.hpp.

147  {
148  return !(operator==(rhs));
149  }
bool operator==(const OTSignatureMetadata &rhs) const
bool opentxs::OTSignatureMetadata::operator== ( const OTSignatureMetadata rhs) const

Definition at line 194 of file OTSignatureMetadata.cpp.

195 {
196  return ((HasMetadata() == rhs.HasMetadata()) &&
197  (GetKeyType() == rhs.GetKeyType()) &&
198  (FirstCharNymID() == rhs.FirstCharNymID()) &&
199  (FirstCharMasterCredID() == rhs.FirstCharMasterCredID()) &&
200  (FirstCharSubCredID() == rhs.FirstCharSubCredID()));
201 }
bool opentxs::OTSignatureMetadata::SetMetadata ( char  metaKeyType,
char  metaNymID,
char  metaMasterCredID,
char  metaSubCredID 
)

Definition at line 143 of file OTSignatureMetadata.cpp.

145 {
146  switch (metaKeyType) {
147  // authentication (used for signing transmissions and stored files.)
148  case 'A':
149  // encryption (unusual BTW, to see this in a signature. Should
150  // never actually happen, or at least should be rare and strange
151  // when it does.)
152  case 'E':
153  // signing (a "legal signature.")
154  case 'S':
155  break;
156  default:
157  otErr << __FUNCTION__
158  << ": Expected key type of A, E, or S, but instead found: "
159  << metaKeyType << " (bad data or error)\n";
160  return false;
161  }
162 
163  std::string str_verify_base62;
164 
165  str_verify_base62 += metaNymID;
166  str_verify_base62 += metaMasterCredID;
167  str_verify_base62 += metaSubCredID;
168 
169  if (!OTCrypto::It()->IsBase62(str_verify_base62)) {
170  otErr << __FUNCTION__
171  << ": Metadata for signature failed base62 validation: "
172  << str_verify_base62 << "\n";
173  return false;
174  }
175 
176  metaKeyType_ = metaKeyType;
177  metaNymID_ = metaNymID;
178  metaMasterCredID_ = metaMasterCredID;
179  metaSubCredID_ = metaSubCredID;
180  hasMetadata_ = true;
181 
182  return true;
183 }
static EXPORT OTCrypto * It()
Definition: OTCrypto.cpp:630
OTLOG_IMPORT OTLogStream otErr

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