esp8266ndn
NDN Arduino library for ESP8266 and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
null.hpp
Go to the documentation of this file.
1 #ifndef NDNPH_PORT_EC_NULL_HPP
2 #define NDNPH_PORT_EC_NULL_HPP
3 
4 #include "../../core/common.hpp"
5 
6 namespace ndnph {
7 namespace port_ec_null {
8 
10 class Ec {
11 public:
13  struct Curve {
15  using PvtLen = std::integral_constant<size_t, 32>;
16 
18  using PubLen = std::integral_constant<size_t, 65>;
19 
21  using MaxSigLen = std::integral_constant<size_t, 73>;
22  };
23 
25  class PrivateKey {
26  public:
31  bool import(const uint8_t[Curve::PubLen::value]) {
32  return false;
33  }
34 
39  ssize_t sign(const uint8_t digest[NDNPH_SHA256_LEN],
40  uint8_t sig[Curve::MaxSigLen::value]) const {
41  (void)digest;
42  (void)sig;
43  return -1;
44  }
45  };
46 
48  class PublicKey {
49  public:
54  bool import(const uint8_t[Curve::PubLen::value]) {
55  return false;
56  }
57 
62  bool verify(const uint8_t digest[NDNPH_SHA256_LEN], const uint8_t* sig, size_t sigLen) const {
63  (void)digest;
64  (void)sig;
65  (void)sigLen;
66  return false;
67  }
68  };
69 
76  static bool generateKey(uint8_t pvt[Curve::PvtLen::value], uint8_t pub[Curve::PubLen::value]) {
77  (void)pvt;
78  (void)pub;
79  return false;
80  }
81 };
82 
83 } // namespace port_ec_null
84 
85 #ifdef NDNPH_PORT_EC_NULL
86 namespace port {
87 using Ec = port_ec_null::Ec;
88 } // namespace port
89 #endif
90 
91 } // namespace ndnph
92 
93 #endif // NDNPH_PORT_EC_NULL_HPP
Private key.
Definition: null.hpp:25
ssize_t sign(const uint8_t digest[NDNPH_SHA256_LEN], uint8_t sig[Curve::MaxSigLen::value]) const
Perform signing on a SHA256 digest.
Definition: null.hpp:39
Public key.
Definition: null.hpp:48
bool verify(const uint8_t digest[NDNPH_SHA256_LEN], const uint8_t *sig, size_t sigLen) const
Perform verification on a SHA256 digest against a given signature.
Definition: null.hpp:62
Stub ECDSA algorithm implementation.
Definition: null.hpp:10
static bool generateKey(uint8_t pvt[Curve::PvtLen::value], uint8_t pub[Curve::PubLen::value])
Generate key pair.
Definition: null.hpp:76
#define NDNPH_SHA256_LEN
SHA256 digest length.
Definition: common.hpp:34
Definition: fs.hpp:33
Give information about the curve.
Definition: null.hpp:13
std::integral_constant< size_t, 65 > PubLen
Public key length.
Definition: null.hpp:18
std::integral_constant< size_t, 32 > PvtLen
Private key length.
Definition: null.hpp:15
std::integral_constant< size_t, 73 > MaxSigLen
Maximum signature length.
Definition: null.hpp:21