YPC  0.2.0
allowance.h
1 #pragma once
2 #include "ypc/common/crypto_prefix.h"
3 #include "ypc/stbox/stx_status.h"
4 
5 namespace ypc {
6 
7 template <typename Crypto> struct allowance {
8  typedef Crypto ecc;
9 
10  template <typename BytesType>
11  static uint32_t check(const BytesType &private_key, const BytesType &msg,
12  const BytesType &allowance) {
13  //check(private_key, to_check_data, allow);
14  BytesType pkey;
15  auto ret = ecc::generate_pkey_from_skey(private_key, pkey);
16  if (ret) {
17  return ret;
18  }
19  ret = ecc::verify_signature(msg, allowance, pkey);
20  return ret;
21  }
22 
23  template <typename BytesType>
24  static uint32_t generate(const BytesType &private_key, const BytesType &msg,
25  BytesType &allowance) {
26  uint32_t ret = ecc::sign_message(private_key, msg, allowance);
27  return ret;
28  }
29 };
30 
31 } // namespace ypc
ypc::crypto::crypto_pack
Definition: crypto_pack.h:14
ypc::allowance
Definition: allowance.h:7