Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OTContract.hpp
Go to the documentation of this file.
1 /************************************************************
2  *
3  * OTContract.hpp
4  *
5  */
6 
7 /************************************************************
8  -----BEGIN PGP SIGNED MESSAGE-----
9  Hash: SHA1
10 
11  * OPEN TRANSACTIONS
12  *
13  * Financial Cryptography and Digital Cash
14  * Library, Protocol, API, Server, CLI, GUI
15  *
16  * -- Anonymous Numbered Accounts.
17  * -- Untraceable Digital Cash.
18  * -- Triple-Signed Receipts.
19  * -- Cheques, Vouchers, Transfers, Inboxes.
20  * -- Basket Currencies, Markets, Payment Plans.
21  * -- Signed, XML, Ricardian-style Contracts.
22  * -- Scripted smart contracts.
23  *
24  * Copyright (C) 2010-2013 by "Fellow Traveler" (A pseudonym)
25  *
26  * EMAIL:
28  *
29  * BITCOIN: 1NtTPVVjDsUfDWybS4BwvHpG2pdS9RnYyQ
30  *
31  * KEY FINGERPRINT (PGP Key in license file):
32  * 9DD5 90EB 9292 4B48 0484 7910 0308 00ED F951 BB8E
33  *
34  * OFFICIAL PROJECT WIKI(s):
35  * https://github.com/FellowTraveler/Moneychanger
36  * https://github.com/FellowTraveler/Open-Transactions/wiki
37  *
38  * WEBSITE:
39  * http://www.OpenTransactions.org/
40  *
41  * Components and licensing:
42  * -- Moneychanger..A Java client GUI.....LICENSE:.....GPLv3
43  * -- otlib.........A class library.......LICENSE:...LAGPLv3
44  * -- otapi.........A client API..........LICENSE:...LAGPLv3
45  * -- opentxs/ot....Command-line client...LICENSE:...LAGPLv3
46  * -- otserver......Server Application....LICENSE:....AGPLv3
47  * Github.com/FellowTraveler/Open-Transactions/wiki/Components
48  *
49  * All of the above OT components were designed and written by
50  * Fellow Traveler, with the exception of Moneychanger, which
51  * was contracted out to Vicky C ([email protected]).
52  * The open-source community has since actively contributed.
53  *
54  * -----------------------------------------------------
55  *
56  * LICENSE:
57  * This program is free software: you can redistribute it
58  * and/or modify it under the terms of the GNU Affero
59  * General Public License as published by the Free Software
60  * Foundation, either version 3 of the License, or (at your
61  * option) any later version.
62  *
63  * ADDITIONAL PERMISSION under the GNU Affero GPL version 3
64  * section 7: (This paragraph applies only to the LAGPLv3
65  * components listed above.) If you modify this Program, or
66  * any covered work, by linking or combining it with other
67  * code, such other code is not for that reason alone subject
68  * to any of the requirements of the GNU Affero GPL version 3.
69  * (==> This means if you are only using the OT API, then you
70  * don't have to open-source your code--only your changes to
71  * Open-Transactions itself must be open source. Similar to
72  * LGPLv3, except it applies to software-as-a-service, not
73  * just to distributing binaries.)
74  *
75  * Extra WAIVER for OpenSSL, Lucre, and all other libraries
76  * used by Open Transactions: This program is released under
77  * the AGPL with the additional exemption that compiling,
78  * linking, and/or using OpenSSL is allowed. The same is true
79  * for any other open source libraries included in this
80  * project: complete waiver from the AGPL is hereby granted to
81  * compile, link, and/or use them with Open-Transactions,
82  * according to their own terms, as long as the rest of the
83  * Open-Transactions terms remain respected, with regard to
84  * the Open-Transactions code itself.
85  *
86  * Lucre License:
87  * This code is also "dual-license", meaning that Ben Lau-
88  * rie's license must also be included and respected, since
89  * the code for Lucre is also included with Open Transactions.
90  * See Open-Transactions/src/otlib/lucre/LUCRE_LICENSE.txt
91  * The Laurie requirements are light, but if there is any
92  * problem with his license, simply remove the Lucre code.
93  * Although there are no other blind token algorithms in Open
94  * Transactions (yet. credlib is coming), the other functions
95  * will continue to operate.
96  * See Lucre on Github: https://github.com/benlaurie/lucre
97  * -----------------------------------------------------
98  * You should have received a copy of the GNU Affero General
99  * Public License along with this program. If not, see:
100  * http://www.gnu.org/licenses/
101  *
102  * If you would like to use this software outside of the free
103  * software license, please contact FellowTraveler.
104  * (Unfortunately many will run anonymously and untraceably,
105  * so who could really stop them?)
106  *
107  * DISCLAIMER:
108  * This program is distributed in the hope that it will be
109  * useful, but WITHOUT ANY WARRANTY; without even the implied
110  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
111  * PURPOSE. See the GNU Affero General Public License for
112  * more details.
113 
114  -----BEGIN PGP SIGNATURE-----
115  Version: GnuPG v1.4.9 (Darwin)
116 
117  iQIcBAEBAgAGBQJRSsfJAAoJEAMIAO35UbuOQT8P/RJbka8etf7wbxdHQNAY+2cC
118  vDf8J3X8VI+pwMqv6wgTVy17venMZJa4I4ikXD/MRyWV1XbTG0mBXk/7AZk7Rexk
119  KTvL/U1kWiez6+8XXLye+k2JNM6v7eej8xMrqEcO0ZArh/DsLoIn1y8p8qjBI7+m
120  aE7lhstDiD0z8mwRRLKFLN2IH5rAFaZZUvj5ERJaoYUKdn4c+RcQVei2YOl4T0FU
121  LWND3YLoH8naqJXkaOKEN4UfJINCwxhe5Ke9wyfLWLUO7NamRkWD2T7CJ0xocnD1
122  sjAzlVGNgaFDRflfIF4QhBx1Ddl6wwhJfw+d08bjqblSq8aXDkmFA7HeunSFKkdn
123  oIEOEgyj+veuOMRJC5pnBJ9vV+7qRdDKQWaCKotynt4sWJDGQ9kWGWm74SsNaduN
124  TPMyr9kNmGsfR69Q2Zq/FLcLX/j8ESxU+HYUB4vaARw2xEOu2xwDDv6jt0j3Vqsg
125  x7rWv4S/Eh18FDNDkVRChiNoOIilLYLL6c38uMf1pnItBuxP3uhgY6COm59kVaRh
126  nyGTYCDYD2TK+fI9o89F1297uDCwEJ62U0Q7iTDp5QuXCoxkPfv8/kX6lS6T3y9G
127  M9mqIoLbIQ1EDntFv7/t6fUTS2+46uCrdZWbQ5RjYXdrzjij02nDmJAm2BngnZvd
128  kamH0Y/n11lCvo1oQxM+
129  =uSzz
130  -----END PGP SIGNATURE-----
131  **************************************************************/
132 
133 #ifndef OPENTXS_CORE_OTCONTRACT_HPP
134 #define OPENTXS_CORE_OTCONTRACT_HPP
135 
136 #include "OTIdentifier.hpp"
137 #include "OTStringXML.hpp"
138 #include "util/Common.hpp" // TODO: remove this when feasible
139 
140 namespace irr
141 {
142 namespace io
143 {
144 template <class char_type, class super_class>
146 class IFileReadCallBack;
147 class IXMLBase;
148 
150 } // namespace io
151 } // namespace irr
152 
153 namespace opentxs
154 {
155 
156 class OTAsymmetricKey;
157 class OTPasswordData;
159 
160 typedef std::list<OTSignature*> listOfSignatures;
161 typedef std::map<std::string, OTPseudonym*> mapOfNyms;
162 
164 {
165  friend class OTPayload;
166 
167 protected:
168  OTString m_strName; // Contract name as shown in the wallet.
169  OTString m_strFoldername; // Foldername for this contract (nyms, contracts,
170  // accounts, etc)
171  OTString m_strFilename; // Filename for this contract (usually an ID.)
172  OTIdentifier m_ID; // Hash of the contract, including signatures. (the "raw
173  // file")
174  OTStringXML m_xmlUnsigned; // The Unsigned Clear Text (XML contents without
175  // signatures.)
176  OTString m_strRawFile; // The complete raw file including signatures.
177  OTString m_strSigHashType; // The Hash algorithm used for the signature
178  OTString m_strContractType; // CONTRACT, MESSAGE, TRANSACTION, LEDGER,
179  // TRANSACTION ITEM
180 
181  mapOfNyms m_mapNyms; // The default behavior for a contract, though
182  // occasionally overridden,
183  // is to contain its own public keys internally, located on standard XML
184  // tags.
185  //
186  // So when we load a contract, we find its public key, and we verify its
187  // signature with it. (It self-verifies!) I could be talking about an x509
188  // as well, since people will need these to be revokable.
189  //
190  // The Issuer/Server/etc URL will also be located within the contract, on a
191  // standard tag, so by merely loading a contract, a wallet will know how to
192  // connect to the relevant server, and the wallet will be able to encrypt
193  // messages meant for that server to its public key without the normally
194  // requisite
195  // key exchange. ==> THE TRADER HAS ASSURANCE THAT, IF HIS OUT-MESSAGE IS
196  // ENCRYPTED,
197  // HE KNOWS THE MESSAGE CAN ONLY BE DECRYPTED BY THE SAME PERSON WHO SIGNED
198  // THAT CONTRACT.
199  listOfSignatures m_listSignatures; // The PGP signatures at the bottom of
200  // the XML file.
201  OTString m_strVersion; // The version of this Contract file, in case the
202  // format changes in the future.
203  // todo: perhaps move these to a common ancestor for OTServerContract and
204  // OTAssetContract.
205  // Maybe call it OTHardContract (since it should never change.)
206  //
210  OTString::Map m_mapConditions; // The legal conditions, usually
211  // human-readable, on a contract.
212  bool LoadContractXML(); // The XML file is in m_xmlUnsigned. Load it from
213  // there into members here.
214  // return -1 if error, 0 if nothing, and 1 if the node was processed.
215  EXPORT virtual int32_t ProcessXMLNode(irr::io::IrrXMLReader*& xml);
216  // virtual bool SignContract(const EVP_PKEY* pkey, OTSignature&
217  // theSignature, const OTString& strHashType);
218  // bool VerifySignature(const EVP_PKEY* pkey, const OTSignature&
219  // theSignature,
220  // const OTString& strHashType) const;
221  // The default hash scheme involves combining 2 other hashes
222  // If a hash with one of the special names comes through, it will
223  // be processed here instead of the normal code. The above two functions
224  // will call these two when appropriate.
225  // NOTE: Moved to OTCrypto
226  //
227  // bool SignContractDefaultHash (const EVP_PKEY* pkey, OTSignature&
228  // theSignature);
229  // bool VerifyContractDefaultHash(const EVP_PKEY* pkey, const
230  // OTSignature& theSignature) const;
231 public:
232  // Used by OTTransactionType::Factory and OTToken::Factory.
233  // In both cases, it takes the input string, trims it, and if it's
234  // armored, it unarmors it, with the result going into strOutput.
235  // On success, bool is returned, and strFirstLine contains the first line
236  // from strOutput.
237  //
238  EXPORT static bool DearmorAndTrim(const OTString& strInput,
239  OTString& strOutput,
240  OTString& strFirstLine);
241 
242  // The Method "RewriteContract" calls this. I put the meat into a static
243  // method so I could use it from outside OTContract as well.
244  //
245  static bool AddBookendsAroundContent(
246  OTString& strOutput, const OTString& strContents,
247  const OTString& strContractType, const OTString& strHashType,
248  const listOfSignatures& listSignatures);
249 
250  EXPORT static bool LoadEncodedTextField(irr::io::IrrXMLReader*& xml,
251  OTASCIIArmor& ascOutput);
252  EXPORT static bool LoadEncodedTextField(irr::io::IrrXMLReader*& xml,
253  OTString& strOutput);
254 
255  static bool LoadEncodedTextFieldByName(
256  irr::io::IrrXMLReader*& xml, OTASCIIArmor& ascOutput,
257  const char*& szName, OTString::Map* pmapExtraVars = nullptr);
258  static bool LoadEncodedTextFieldByName(
259  irr::io::IrrXMLReader*& xml, OTString& strOutput, const char*& szName,
260  OTString::Map* pmapExtraVars = nullptr);
261  static bool SkipToElement(irr::io::IrrXMLReader*& xml);
262  static bool SkipToTextField(irr::io::IrrXMLReader*& xml);
263  static bool SkipAfterLoadingField(irr::io::IrrXMLReader*& xml);
264  inline const char* GetHashType() const
265  {
266  return m_strSigHashType.Get();
267  }
268  inline void SetIdentifier(const OTIdentifier& theID)
269  {
270  m_ID = theID;
271  }
272  EXPORT OTContract();
273  EXPORT OTContract(const OTString& name, const OTString& foldername,
274  const OTString& filename, const OTString& strID);
275  EXPORT OTContract(const OTString& strID);
276  EXPORT OTContract(const OTIdentifier& theID);
277  void Initialize();
278 
279  // TODO: a contract needs to have certain required fields in order to be
280  // accepted for notarization.
281  // One of those should be a URL where anyone can see a list of the approved
282  // e-notary servers, signed
283  // by the issuer.
284  //
285  // Why is this important?
286  //
287  // Because when the issuer connects to the e-notary to issue the currency,
288  // he must upload the
289  // asset contract as part of that process. During the same process, the
290  // e-notary connects to that
291  // standard URL and downloads a RECORD, signed by the ISSUER, showing the
292  // e-notary on the accepted
293  // list of transaction providers.
294  //
295  // Now the e-notary can make THAT record available to its clients (most
296  // likely demanded by their
297  // wallet software) as proof that the issuer has, in fact, issued digital
298  // assets on the e-notary
299  // server in question. This provides proof that the issuer is, in fact,
300  // legally on the line for
301  // whatever assets they have actually issued through that e-notary. The
302  // issuer can make the total
303  // outstanding units available publicly, which wallets can cross-reference
304  // with the public records
305  // on the transaction servers. (The figures concerning total issued currency
306  // should match.)
307  //
308  // Of course, the transaction server could still lie, and publish a
309  // falsified number instead of
310  // the actual total issued currency for a given digital asset. Only systems
311  // can prevent that,
312  // based around separation of powers. People will be more likely to trust
313  // the transaction provider
314  // who has good accounting and code audit processes, with code fingerprints,
315  // multiple passwords
316  // across neutral and bonded 3rd parties, insured, etc. Ultimately these
317  // practices will be
318  // governed by the cost of insurance.
319  //
320  // But there WILL be winners who arise because they implement systems that
321  // provide trust.
322  // And trust is a currency.
323  //
324  // (Currently the code loads the key FROM the contract itself, which won't
325  // be possible when
326  // the issuer and transaction provider are two separate entities. So this
327  // sort of protocol
328  // becomes necessary.)
329 
330  EXPORT virtual ~OTContract();
331  EXPORT virtual void Release();
332  EXPORT void Release_Contract();
333  EXPORT void ReleaseSignatures();
334 
335  // This function is for those times when you already have the unsigned
336  // version
337  // of the contract, and you have the signer, and you just want to sign it
338  // and
339  // calculate its new ID from the finished result.
340  EXPORT virtual bool CreateContract(const OTString& strContract,
341  const OTPseudonym& theSigner);
342 
343  // CreateContract is great if you already know what kind of contract to
344  // instantiate
345  // and have already done so. Otherwise this function will take ANY flat text
346  // and use
347  // a generic OTContract instance to sign it and then write it to strOutput.
348  // This is
349  // due to the fact that OT was never really designed for signing flat text,
350  // only contracts.
351  //
352  EXPORT static bool SignFlatText(
353  OTString& strFlatText,
354  const OTString& strContractType, // "LEDGER" or "PURSE" etc.
355  const OTPseudonym& theSigner, OTString& strOutput);
356 
357  EXPORT bool InsertNym(const OTString& strKeyName,
358  const OTString& strKeyValue);
359 
360  EXPORT inline void GetName(OTString& strName) const
361  {
362  strName = m_strName;
363  }
364  EXPORT inline void SetName(const OTString& strName)
365  {
366  m_strName = strName;
367  }
368 
369  // This function calls VerifyContractID, and if that checks out, then it
370  // looks up the official
371  // "contract" key inside the contract by calling GetContractPublicKey, and
372  // uses it to verify the
373  // signature on the contract. So the contract is self-verifying. Right now
374  // only public keys are
375  // supported, but soon contracts will also support x509 certs.
376  EXPORT virtual bool VerifyContract();
377 
378  // Only overriden in OTOffer so far.
379  //
380  EXPORT virtual void GetIdentifier(OTIdentifier& theIdentifier) const; // You
381  // can
382  // get it
383  // in string or
384  // binary form.
385  EXPORT virtual void GetIdentifier(
386  OTString& theIdentifier) const; // The Contract
387  // ID is a hash
388  // of the
389  // contract raw
390  // file.
391 
392  EXPORT void GetFilename(OTString& strFilename) const;
393  EXPORT void GetFoldername(OTString& strFoldername) const;
394 
395  // assumes m_strFilename is already set. Then it reads that file into a
396  // string.
397  // Then it parses that string into the object.
398  EXPORT virtual bool LoadContract();
399  EXPORT bool LoadContract(const char* szFoldername, const char* szFilename);
400 
401  EXPORT bool LoadContractFromString(const OTString& theStr); // Just like it
402  // says. If you
403  // have a
404  // contract in
405  // string form, pass it in here to import it.
406  bool LoadContractRawFile(); // fopens m_strFilename and reads it off the
407  // disk into m_strRawFile
408  EXPORT bool ParseRawFile(); // parses m_strRawFile into the various member
409  // variables.
410  // Separating these into two steps allows us to load contracts
411  // from other sources besides files.
412 
413  EXPORT bool SaveToContractFolder(); // data_folder/contracts/Contract-ID
414 
415  EXPORT bool SaveContractRaw(OTString& strOutput) const; // Saves the raw
416  // (pre-existing)
417  // contract text to
418  // any string you
419  // want to pass in.
420  EXPORT bool RewriteContract(OTString& strOutput) const; // Takes the
421  // pre-existing
422  // XML contents (WITHOUT
423  // signatures) and
424  // re-writes the Raw data,
425  // adding the pre-existing
426  // signatures along with
427  // new signature bookends.
428 
429  EXPORT bool SaveContract(); // This saves the Contract to its own internal
430  // member string, m_strRawFile (and does
431  // NOT actually save it to a file.)
432  // bool SaveContract(OTString& strContract); // Saves the contract to
433  // any string you want to pass in.
434  EXPORT bool SaveContract(const char* szFoldername,
435  const char* szFilename); // Saves the contract to a
436  // specific filename
437 
438  // Update the internal unsigned contents based on the member variables
439  EXPORT virtual void UpdateContents(); // default behavior does nothing.
440  EXPORT virtual void CreateContents(); // Only used when first generating an
441  // asset
442  // or server contract. Meant for contracts
443  // which never change after that point.
444  // Otherwise does the same thing as
445  // UpdateContents. (But meant for a different
446  // purpose.)
447 
448  EXPORT void CreateInnerContents(); // Overrides of CreateContents call this
449  // in
450  // order to add some common internals.
451 
452  // Save the internal contents (m_xmlUnsigned) to an already-open file
453  EXPORT virtual bool SaveContents(std::ofstream& ofs) const;
454 
455  // Saves the entire contract to a file that's already open (like a wallet).
456  virtual bool SaveContractWallet(std::ofstream& ofs) const = 0;
457  EXPORT virtual bool SaveContractWallet(OTString& strContents) const;
458 
459  EXPORT virtual bool DisplayStatistics(OTString& strContents) const;
460 
461  // Save m_xmlUnsigned to a string that's passed in
462  EXPORT virtual bool SaveContents(OTString& strContents) const;
463  EXPORT virtual bool SignContract(const OTPseudonym& theNym,
464  const OTPasswordData* pPWData = nullptr);
465  EXPORT bool SignContractAuthent(const OTPseudonym& theNym,
466  const OTPasswordData* pPWData = nullptr);
467  EXPORT bool SignWithKey(const OTAsymmetricKey& theKey,
468  const OTPasswordData* pPWData = nullptr);
469  EXPORT bool SignContract(const OTPseudonym& theNym,
470  OTSignature& theSignature,
471  const OTPasswordData* pPWData = nullptr);
472  EXPORT bool SignContractAuthent(const OTPseudonym& theNym, // Uses
473  // authentication
474  // key instead of
475  // signing key.
476  OTSignature& theSignature,
477  const OTPasswordData* pPWData = nullptr);
478  EXPORT bool SignContract(const OTAsymmetricKey& theKey,
479  OTSignature& theSignature,
480  const OTString& strHashType,
481  const OTPasswordData* pPWData = nullptr);
482 
483  EXPORT bool SignContract(
484  const char* szFoldername,
485  const char* szFilename, // for Cert.
486  OTSignature& theSignature, // output
487  const OTPasswordData* pPWData = nullptr); // optional in/out
488 
489  // Calculates a hash of m_strRawFile (the xml portion of the contract plus
490  // the signatures)
491  // and compares to m_ID (supposedly the same. The ID is calculated by
492  // hashing the file.)
493  //
494  // Be careful here--asset contracts and server contracts can have this ID.
495  // But a class such as OTAccount will change in its datafile as the balance
496  // changes. Thus, the account must have a Unique ID that is NOT a hash of
497  // its file.
498  //
499  // This means it's important to have the ID function overridable for
500  // OTAccount...
501  // This also means that my wallet MUST be signed, and these files should
502  // have
503  // and encryption option also. Because if someone changes my account ID in
504  // the file,
505  // I have no way of re-calculating it from the account file, which changes!
506  // So my
507  // copies of the account file and wallet file are the only records of that
508  // account ID
509  // which is a giant int64_t number.
510  EXPORT virtual bool VerifyContractID() const;
511  EXPORT virtual void CalculateContractID(OTIdentifier& newID) const;
512 
513  // So far not overridden anywhere (used to be OTTrade.)
514  EXPORT virtual bool VerifySignature(
515  const OTPseudonym& theNym,
516  const OTPasswordData* pPWData = nullptr) const;
517  EXPORT virtual bool VerifySigAuthent(
518  const OTPseudonym& theNym,
519  const OTPasswordData* pPWData = nullptr) const;
520 
521  EXPORT bool VerifyWithKey(const OTAsymmetricKey& theKey,
522  const OTPasswordData* pPWData = nullptr) const;
523 
524  EXPORT bool VerifySignature(const OTPseudonym& theNym,
525  const OTSignature& theSignature,
526  const OTPasswordData* pPWData = nullptr) const;
527 
528  EXPORT bool VerifySigAuthent(const OTPseudonym& theNym, // Uses
529  // authentication
530  // key
531  // instead of signing key.
532  const OTSignature& theSignature,
533  const OTPasswordData* pPWData = nullptr) const;
534 
535  EXPORT bool VerifySignature(const OTAsymmetricKey& theKey,
536  const OTSignature& theSignature,
537  const OTString& strHashType,
538  const OTPasswordData* pPWData = nullptr) const;
539 
540  EXPORT bool VerifySignature(
541  const char* szFoldername,
542  const char* szFilename, // for Cert.
543  const OTSignature& theSignature,
544  const OTPasswordData* pPWData = nullptr) const; // optional in/out
545 
546  // bool VerifySignatures(); // This function verifies the signatures
547  // on the contract.
548  // If true, it proves that certain entities really did sign
549  // it, and that the contract hasn't been tampered with since
550  // it was signed.
551  EXPORT const OTAsymmetricKey* GetContractPublicKey() const;
552  EXPORT const OTPseudonym* GetContractPublicNym() const;
553 };
554 
555 } // namespace opentxs
556 
557 #endif // OPENTXS_CORE_OTCONTRACT_HPP
virtual EXPORT void CreateContents()
std::map< std::string, std::string > Map
Definition: OTString.hpp:162
IIrrXMLReader< char, IXMLBase > IrrXMLReader
Definition: OTContract.hpp:147
EXPORT void CreateInnerContents()
static EXPORT bool DearmorAndTrim(const OTString &strInput, OTString &strOutput, OTString &strFirstLine)
Definition: OTContract.cpp:158
virtual EXPORT bool VerifyContractID() const
Definition: OTContract.cpp:379
virtual EXPORT bool DisplayStatistics(OTString &strContents) const
Definition: OTContract.cpp:999
EXPORT bool SaveContract()
EXPORT void GetFilename(OTString &strFilename) const
Definition: OTContract.cpp:307
EXPORT bool ParseRawFile()
EXPORT void GetName(OTString &strName) const
Definition: OTContract.hpp:360
virtual EXPORT bool CreateContract(const OTString &strContract, const OTPseudonym &theSigner)
std::map< std::string, OTPseudonym * > mapOfNyms
Definition: OTWallet.hpp:161
EXPORT bool SaveContractRaw(OTString &strOutput) const
EXPORT bool VerifyWithKey(const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr) const
Definition: OTContract.cpp:848
EXPORT void Release_Contract()
Definition: OTContract.cpp:249
EXPORT void ReleaseSignatures()
Definition: OTContract.cpp:989
EXPORT bool SignWithKey(const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr)
Definition: OTContract.cpp:561
listOfSignatures m_listSignatures
Definition: OTContract.hpp:199
EXPORT const OTPseudonym * GetContractPublicNym() const
Definition: OTContract.cpp:413
void SetIdentifier(const OTIdentifier &theID)
Definition: OTContract.hpp:268
OTString::Map m_mapConditions
Definition: OTContract.hpp:210
OTString m_strSigHashType
Definition: OTContract.hpp:177
OTString m_strEntityShortName
Definition: OTContract.hpp:207
static EXPORT bool LoadEncodedTextField(irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
static bool AddBookendsAroundContent(OTString &strOutput, const OTString &strContents, const OTString &strContractType, const OTString &strHashType, const listOfSignatures &listSignatures)
EXPORT bool SignContractAuthent(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
Definition: OTContract.cpp:508
OTString m_strContractType
Definition: OTContract.hpp:178
virtual EXPORT bool LoadContract()
virtual EXPORT ~OTContract()
Definition: OTContract.cpp:285
static bool SkipToTextField(irr::io::IrrXMLReader *&xml)
OTIdentifier m_ID
Definition: OTContract.hpp:172
virtual EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
Definition: OTContract.cpp:317
OTString m_strEntityLongName
Definition: OTContract.hpp:208
virtual EXPORT void UpdateContents()
OTStringXML m_xmlUnsigned
Definition: OTContract.hpp:174
EXPORT const char * Get() const
Definition: OTString.cpp:1045
virtual EXPORT bool SignContract(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
Definition: OTContract.cpp:484
static bool SkipAfterLoadingField(irr::io::IrrXMLReader *&xml)
static bool SkipToElement(irr::io::IrrXMLReader *&xml)
virtual EXPORT int32_t ProcessXMLNode(irr::io::IrrXMLReader *&xml)
EXPORT const OTAsymmetricKey * GetContractPublicKey() const
Definition: OTContract.cpp:444
EXPORT void GetFoldername(OTString &strFoldername) const
Definition: OTContract.cpp:312
EXPORT bool InsertNym(const OTString &strKeyName, const OTString &strKeyValue)
virtual EXPORT void Release()
Definition: OTContract.cpp:277
virtual EXPORT bool VerifySignature(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
Definition: OTContract.cpp:818
virtual EXPORT bool VerifyContract()
Definition: OTContract.cpp:330
OTString m_strEntityEmail
Definition: OTContract.hpp:209
virtual EXPORT bool VerifySigAuthent(const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
Definition: OTContract.cpp:788
EXPORT bool LoadContractFromString(const OTString &theStr)
virtual EXPORT bool SaveContents(std::ofstream &ofs) const
virtual EXPORT void CalculateContractID(OTIdentifier &newID) const
Definition: OTContract.cpp:367
const char * GetHashType() const
Definition: OTContract.hpp:264
static EXPORT bool SignFlatText(OTString &strFlatText, const OTString &strContractType, const OTPseudonym &theSigner, OTString &strOutput)
EXPORT bool SaveToContractFolder()
Definition: OTContract.cpp:291
std::list< OTSignature * > listOfSignatures
Definition: OTContract.hpp:158
virtual bool SaveContractWallet(std::ofstream &ofs) const =0
OTString m_strFoldername
Definition: OTContract.hpp:169
EXPORT void SetName(const OTString &strName)
Definition: OTContract.hpp:364
EXPORT bool RewriteContract(OTString &strOutput) const
static bool LoadEncodedTextFieldByName(irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)