plebble
signed_data.h
Go to the documentation of this file.
1 /*
2 -------------------------------------------------------------------------------
3  PLEBBLE
4 -------------------------------------------------------------------------------
5  Copyright (C) 2019-2020 KATLAS Technology. (http://katlastechnology.com)
6  Copyright (C) 2017-2020 Marcos Mayorga. (mm@mm-studios.com)
7 
8  This file is part of our Plebble(R) Platform.
9 
10  The code below cannot be copied, used for any purpose other than the one
11  agreed and/or distributed without the express permission of
12  KATLAS Technology.
13 -------------------------------------------------------------------------------
14 
15 
16 */
17 #ifndef USGOV_7e890654e98bf7c2878b37b6916dcb394f32fdcde3e1c8e0ac04dfd8d224f02c
18 #define USGOV_7e890654e98bf7c2878b37b6916dcb394f32fdcde3e1c8e0ac04dfd8d224f02c
19 
20 #include <us/gov/crypto/hash.h>
21 #include <us/gov/crypto/ec.h>
23 #include <string>
24 
25 namespace us { namespace gov {
26 namespace engine {
27  using namespace std;
28 
29  struct signed_data {
34 
35  virtual ~signed_data() {}
36  virtual void hash_data_to_sign(sigmsg_hasher_t&) const=0;
37  virtual void hash_data(ripemd160&) const=0;
38  virtual void to_stream(ostream&) const;
39  virtual bool verify(ostream&) const;
40  virtual void write_pretty(ostream& os) const;
41  virtual bool from_stream2(istream&) { return false; }
42 
43 
44  void sign(const crypto::ec::keys&);
46 
47  static void from_stream(signed_data&, istream&);
48  static void from_stream_prev(signed_data&, istream&);
49  static void skip(istream&);
50 
52  string signature;
53  };
54 
55 }}
56 }
57 
58 #endif
59 
us::gov::engine::signed_data::pubkey
pubkey_t pubkey
Definition: signed_data.h:51
us::gov::engine::signed_data::to_stream
virtual void to_stream(ostream &) const
us::gov::engine::signed_data::skip
static void skip(istream &)
us::gov::crypto::ripemd160::finalize
void finalize(unsigned char hash[output_size])
us
Definition: daemon.h:22
us::gov::engine::signed_data::ripemd160
us::gov::crypto::ripemd160 ripemd160
Definition: signed_data.h:32
us::gov::crypto::ripemd160::value_type
Definition: ripemd160.h:38
us::gov::engine::signed_data::sign
void sign(const crypto::ec::keys &)
c
us::gov::engine::signed_data c
Definition: signed_data.cpp:28
us::gov::crypto::ec::keys::pub_t
Definition: ec.h:44
us::gov::crypto::sha256
Definition: sha256.h:33
us::gov::crypto::ec::instance
static ec instance
Definition: ec.h:143
us::gov::engine::signed_data::verify
virtual bool verify(ostream &) const
us::gov::engine::signed_data::hash_data
virtual void hash_data(ripemd160 &) const =0
us::gov::crypto::b58::decode
std::vector< unsigned char > decode(const std::string &s)
Definition: base58.cpp:54
us::gov::engine::signed_data::sigmsg_hasher_t
crypto::ec::sigmsg_hasher_t sigmsg_hasher_t
Definition: signed_data.h:33
us::gov::engine::signed_data::signature
string signature
Definition: signed_data.h:52
us::gov::crypto::ripemd160
Definition: ripemd160.h:34
ripemd160.h
us::gov::engine::signed_data
Definition: signed_data.h:29
signed_data.h
us::gov::cash::keys
crypto::ec::keys keys
Definition: app.h:52
us::gov::engine::signed_data::pubkey_t
keys::pub_t pubkey_t
Definition: signed_data.h:31
us::gov::engine
Definition: hmi.h:32
std
Definition: app.h:380
us::gov::engine::signed_data::from_stream_prev
static void from_stream_prev(signed_data &, istream &)
us::gov::crypto::b58::encode
std::string encode(const std::string &s)
Definition: base58.cpp:62
us::gov::crypto::ec::sign
ko sign(const keys::priv_t &pk, const string &text, sig_t &signature) const
hash.h
us::gov::crypto::ec::keys::pub_t::hash
const hash_t & hash() const
Definition: ec.cpp:105
us::gov::engine::signed_data::hash_data_to_sign
virtual void hash_data_to_sign(sigmsg_hasher_t &) const =0
us::gov::crypto::ec::keys
Definition: ec.h:43
us::gov::engine::signed_data::hash
ripemd160::value_type hash() const
base58.h
us::gov::crypto::ec::verify
bool verify(const keys::pub_t &pk, const string &text, const sig_t &signature_der) const
us::gov::engine::signed_data::write_pretty
virtual void write_pretty(ostream &os) const
us::gov::engine::signed_data::from_stream2
virtual bool from_stream2(istream &)
Definition: signed_data.h:41
us::gov::engine::signed_data::from_stream
static void from_stream(signed_data &, istream &)
gov.h
ec.h
us::gov::engine::signed_data::~signed_data
virtual ~signed_data()
Definition: signed_data.h:35
log
#define log
Definition: gov.h:83
us::gov::engine::signed_data::keys
crypto::ec::keys keys
Definition: signed_data.h:30