policy-manager.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_POLICY_MANAGER_HPP
24 #define NDN_POLICY_MANAGER_HPP
25 
26 #include "../../data.hpp"
27 #include "../key-chain.hpp"
28 
29 namespace ndn {
30 
31 class ValidationRequest;
32 
38 public:
42  virtual
44 
50  virtual bool
51  skipVerifyAndTrust(const Data& data) = 0;
52 
59  virtual bool
60  skipVerifyAndTrust(const Interest& interest) = 0;
61 
67  virtual bool
68  requireVerify(const Data& data) = 0;
69 
76  virtual bool
77  requireVerify(const Interest& interest) = 0;
78 
94  virtual ptr_lib::shared_ptr<ValidationRequest>
96  (const ptr_lib::shared_ptr<Data>& data, int stepCount,
97  const OnVerified& onVerified,
98  const OnDataValidationFailed& onValidationFailed) = 0;
99 
118  virtual ptr_lib::shared_ptr<ValidationRequest>
120  (const ptr_lib::shared_ptr<Interest>& interest, int stepCount,
121  const OnVerifiedInterest& onVerified,
122  const OnInterestValidationFailed& onValidationFailed,
123  WireFormat& wireFormat) = 0;
124 
131  virtual bool
132  checkSigningPolicy(const Name& dataName, const Name& certificateName) = 0;
133 
139  virtual Name
140  inferSigningIdentity(const Name& dataName) = 0;
141 
142 protected:
155  static bool
157  (const Signature* signature, const SignedBlob& signedBlob,
158  const Blob& publicKeyDer);
159 };
160 
161 }
162 
163 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
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
Definition: data.hpp:37
static bool verifySignature(const Signature *signature, const SignedBlob &signedBlob, const Blob &publicKeyDer)
Check the type of signature and use the publicKeyDer to verify the signedBlob using the appropriate s...
Definition: policy-manager.cpp:39
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
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
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:42
virtual Name inferSigningIdentity(const Name &dataName)=0
Infer the signing identity name according to the policy.
virtual ptr_lib::shared_ptr< ValidationRequest > checkVerificationPolicy(const ptr_lib::shared_ptr< Data > &data, int stepCount, const OnVerified &onVerified, const OnDataValidationFailed &onValidationFailed)=0
Check whether the received data packet complies with the verification policy, and get the indication ...
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 ~PolicyManager()
The virtual destructor.
Definition: policy-manager.hpp:43
virtual bool checkSigningPolicy(const Name &dataName, const Name &certificateName)=0
Check if the signing certificate name and data name satisfy the signing policy.
virtual bool requireVerify(const Data &data)=0
Check if this PolicyManager has a verification rule for the received data.
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 bool skipVerifyAndTrust(const Data &data)=0
Check if the received data packet can escape from verification and be trusted as valid.
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