All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
sha256-with-rsa-signature.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_SHA256_WITH_RSA_SIGNATURE_HPP
23 #define NDN_SHA256_WITH_RSA_SIGNATURE_HPP
24 
25 #include "signature.hpp"
26 #include "key-locator.hpp"
27 #include "security/validity-period.hpp"
28 #include "util/change-counter.hpp"
29 
30 namespace ndn {
31 
37 public:
39  : changeCount_(0)
40  {
41  }
42 
46  virtual ptr_lib::shared_ptr<Signature>
47  clone() const;
48 
57  virtual void
58  get(SignatureLite& signatureLite) const;
59 
64  virtual void
65  set(const SignatureLite& signatureLite);
66 
71  virtual const Blob&
72  getSignature() const;
73 
74  const KeyLocator&
75  getKeyLocator() const { return keyLocator_.get(); }
76 
77  KeyLocator&
78  getKeyLocator() { return keyLocator_.get(); }
79 
84  const ValidityPeriod&
85  getValidityPeriod() const { return validityPeriod_.get(); }
86 
92  getValidityPeriod() { return validityPeriod_.get(); }
93 
98  virtual void
99  setSignature(const Blob& signature);
100 
101  void
102  setKeyLocator(const KeyLocator& keyLocator)
103  {
104  keyLocator_.set(keyLocator);
105  ++changeCount_;
106  }
107 
112  void
113  setValidityPeriod(const ValidityPeriod& validityPeriod)
114  {
115  validityPeriod_.set(validityPeriod);
116  ++changeCount_;
117  }
118 
122  void
124  {
125  signature_.reset();
126  keyLocator_.get().clear();
127  validityPeriod_.get().clear();
128  ++changeCount_;
129  }
130 
135  virtual uint64_t
136  getChangeCount() const;
137 
138 private:
139  Blob signature_;
140  ChangeCounter<KeyLocator> keyLocator_;
141  ChangeCounter<ValidityPeriod> validityPeriod_;
142  uint64_t changeCount_;
143 };
144 
145 }
146 
147 #endif
A Sha256WithRsaSignature extends Signature and holds the signature bits and other info representing a...
Definition: sha256-with-rsa-signature.hpp:36
const ValidityPeriod & getValidityPeriod() const
Get the validity period.
Definition: sha256-with-rsa-signature.hpp:85
ValidityPeriod & getValidityPeriod()
Get the validity period.
Definition: sha256-with-rsa-signature.hpp:92
void setValidityPeriod(const ValidityPeriod &validityPeriod)
Set the validity period to a copy of the given ValidityPeriod.
Definition: sha256-with-rsa-signature.hpp:113
A SignatureLite holds a signature type, a KeyLocatorLite, the signature bytes and other fields to rep...
Definition: signature-lite.hpp:37
virtual ptr_lib::shared_ptr< Signature > clone() const
Return a pointer to a new Sha256WithRsaSignature which is a copy of this signature.
Definition: sha256-with-rsa-signature.cpp:30
A ValidityPeriod is used in a Data packet's SignatureInfo and represents the begin and end times of a...
Definition: validity-period.hpp:37
A ChangeCounter keeps a target object whose change count is tracked by a local change count...
Definition: change-counter.hpp:37
virtual uint64_t getChangeCount() const
Get the change count, which is incremented each time this object (or a child object) is changed...
Definition: sha256-with-rsa-signature.cpp:70
void clear()
Clear all the fields.
Definition: sha256-with-rsa-signature.hpp:123
A Signature is an abstract base class providing methods to work with the signature information in a D...
Definition: signature.hpp:35
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
virtual const Blob & getSignature() const
Get the signature bytes.
Definition: sha256-with-rsa-signature.cpp:36
virtual void setSignature(const Blob &signature)
Set the signature bytes to the given value.
Definition: sha256-with-rsa-signature.cpp:42
Definition: key-locator.hpp:35
virtual void set(const SignatureLite &signatureLite)
Clear this signature, and set the values by copying from signatureLite.
Definition: sha256-with-rsa-signature.cpp:58