All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
self-verify-policy-manager.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_SELF_VERIFY_POLICY_MANAGER_HPP
23 #define NDN_SELF_VERIFY_POLICY_MANAGER_HPP
24 
25 #include "policy-manager.hpp"
26 
27 namespace ndn {
28 
29 class IdentityStorage;
30 class PibImpl;
31 
39 public:
49  : identityStorage_(identityStorage), pibImpl_(0)
50  {
51  }
52 
62  : identityStorage_(0), pibImpl_(pibImpl)
63  {
64  }
65 
69  virtual
71 
77  virtual bool
78  skipVerifyAndTrust(const Data& data);
79 
85  virtual bool
86  skipVerifyAndTrust(const Interest& interest);
87 
93  virtual bool
94  requireVerify(const Data& data);
95 
102  virtual bool
103  requireVerify(const Interest& interest);
104 
123  virtual ptr_lib::shared_ptr<ValidationRequest>
125  (const ptr_lib::shared_ptr<Data>& data, int stepCount,
126  const OnVerified& onVerified,
127  const OnDataValidationFailed& onValidationFailed);
128 
149  virtual ptr_lib::shared_ptr<ValidationRequest>
151  (const ptr_lib::shared_ptr<Interest>& interest, int stepCount,
152  const OnVerifiedInterest& onVerified,
153  const OnInterestValidationFailed& onValidationFailed,
154  WireFormat& wireFormat);
155 
162  virtual bool
163  checkSigningPolicy(const Name& dataName, const Name& certificateName);
164 
170  virtual Name
171  inferSigningIdentity(const Name& dataName);
172 
173 private:
187  bool
188  verify
189  (const Signature* signatureInfo, const SignedBlob& signedBlob,
190  std::string& failureReason);
191 
201  Blob
202  getPublicKeyDer(const KeyLocator& keyLocator, std::string& failureReason);
203 
204  IdentityStorage* identityStorage_;
205  PibImpl* pibImpl_;
206 };
207 
208 }
209 
210 #endif
func_lib::function< void(const ptr_lib::shared_ptr< Interest > &interest)> OnVerifiedInterest
An OnVerifiedInterest function object is used to pass a callback to verifyInterest to report a succes...
Definition: validation-request.hpp:53
PibImpl is an abstract base class for the PIB implementation used by the Pib class.
Definition: pib-impl.hpp:37
Definition: data.hpp:37
A SelfVerifyPolicyManager implements a PolicyManager to look in the storage for the public key with t...
Definition: self-verify-policy-manager.hpp:38
virtual bool checkSigningPolicy(const Name &dataName, const Name &certificateName)
Override to always indicate that the signing certificate name and data name satisfy the signing polic...
Definition: self-verify-policy-manager.cpp:161
SelfVerifyPolicyManager(IdentityStorage *identityStorage=0)
Create a new SelfVerifyPolicyManager which will look up the public key in the given identityStorage...
Definition: self-verify-policy-manager.hpp:48
func_lib::function< void(const ptr_lib::shared_ptr< Data > &data)> OnVerified
An OnVerified function object is used to pass a callback to verifyData to report a successful verific...
Definition: validation-request.hpp:33
virtual ptr_lib::shared_ptr< ValidationRequest > checkVerificationPolicy(const ptr_lib::shared_ptr< Data > &data, int stepCount, const OnVerified &onVerified, const OnDataValidationFailed &onValidationFailed)
Look in the IdentityStorage or PibImpl for the public key with the name in the KeyLocator (if availab...
Definition: self-verify-policy-manager.cpp:66
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Signature is an abstract base class providing methods to work with the signature information in a D...
Definition: signature.hpp:35
IdentityStorage is a base class for the storage of identity, public keys and certificates.
Definition: identity-storage.hpp:39
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:43
virtual bool requireVerify(const Data &data)
Always return true to use the self-verification rule for the received data.
Definition: self-verify-policy-manager.cpp:53
SelfVerifyPolicyManager(PibImpl *pibImpl)
Create a new SelfVerifyPolicyManager which will look up the public key in the given pibImpl...
Definition: self-verify-policy-manager.hpp:61
func_lib::function< void(const ptr_lib::shared_ptr< Interest > &interest, const std::string &reason)> OnInterestValidationFailed
An OnInterestValidationFailed function object is used to pass a callback to verifyInterest to report ...
Definition: validation-request.hpp:61
virtual bool skipVerifyAndTrust(const Data &data)
Never skip verification.
Definition: self-verify-policy-manager.cpp:41
A SignedBlob extends Blob to keep the offsets of a signed portion (e.g., the bytes of Data packet)...
Definition: signed-blob.hpp:34
Definition: wire-format.hpp:39
virtual Name inferSigningIdentity(const Name &dataName)
Override to indicate that the signing identity cannot be inferred.
Definition: self-verify-policy-manager.cpp:167
virtual ~SelfVerifyPolicyManager()
The virtual destructor.
Definition: self-verify-policy-manager.cpp:36
Definition: key-locator.hpp:35
A PolicyManager is an abstract base class to represent the policy for verifying data packets...
Definition: policy-manager.hpp:37
func_lib::function< void(const ptr_lib::shared_ptr< Data > &data, const std::string &reason)> OnDataValidationFailed
An OnDataValidationFailed function object is used to pass a callback to verifyData to report a failed...
Definition: validation-request.hpp:41