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 
93  virtual ptr_lib::shared_ptr<ValidationRequest>
95  (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed) = 0;
96 
115  virtual ptr_lib::shared_ptr<ValidationRequest>
117  (const ptr_lib::shared_ptr<Interest>& interest, int stepCount,
118  const OnVerifiedInterest& onVerified,
119  const OnVerifyInterestFailed& onVerifyFailed, WireFormat& wireFormat) = 0;
120 
127  virtual bool
128  checkSigningPolicy(const Name& dataName, const Name& certificateName) = 0;
129 
135  virtual Name
136  inferSigningIdentity(const Name& dataName) = 0;
137 
138 protected:
151  static bool
153  (const Signature* signature, const SignedBlob& signedBlob,
154  const Blob& publicKeyDer);
155 
165  static bool
167  (const Blob& signature, const SignedBlob& signedBlob,
168  const Blob& publicKeyDer);
169 
179  static bool
181  (const Blob& signature, const SignedBlob& signedBlob,
182  const Blob& publicKeyDer);
183 
191  static bool
193  (const Blob& signature, const SignedBlob& signedBlob);
194 };
195 
196 }
197 
198 #endif
func_lib::function< void(const ptr_lib::shared_ptr< Interest > &interest)> OnVerifyInterestFailed
An OnVerifyInterestFailed function object is used to pass a callback to verifyInterest to report a fa...
Definition: validation-request.hpp:52
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
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:45
static bool verifySha256WithEcdsaSignature(const Blob &signature, const SignedBlob &signedBlob, const Blob &publicKeyDer)
Verify the ECDSA signature on the SignedBlob using the given public key.
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
static bool verifyDigestSha256Signature(const Blob &signature, const SignedBlob &signedBlob)
Verify the DigestSha256 signature on the SignedBlob by verifying that the digest of SignedBlob equals...
Definition: policy-manager.cpp:117
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
static bool verifySha256WithRsaSignature(const Blob &signature, const SignedBlob &signedBlob, const Blob &publicKeyDer)
Verify the RSA signature on the SignedBlob using the given public key.
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:41
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 OnVerifyFailed &onVerifyFailed)=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< Data > &data)> OnVerifyFailed
An OnVerifyFailed function object is used to pass a callback to verifyData to report a failed verific...
Definition: validation-request.hpp:38
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