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 
38 public:
49  : identityStorage_(identityStorage)
50  {
51  }
52 
56  virtual
58 
64  virtual bool
65  skipVerifyAndTrust(const Data& data);
66 
72  virtual bool
73  skipVerifyAndTrust(const Interest& interest);
74 
80  virtual bool
81  requireVerify(const Data& data);
82 
89  virtual bool
90  requireVerify(const Interest& interest);
91 
103  virtual ptr_lib::shared_ptr<ValidationRequest>
105  (const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed);
106 
121  virtual ptr_lib::shared_ptr<ValidationRequest>
123  (const ptr_lib::shared_ptr<Interest>& interest, int stepCount,
124  const OnVerifiedInterest& onVerified,
125  const OnVerifyInterestFailed& onVerifyFailed, WireFormat& wireFormat);
126 
133  virtual bool
134  checkSigningPolicy(const Name& dataName, const Name& certificateName);
135 
141  virtual Name
142  inferSigningIdentity(const Name& dataName);
143 
144 private:
157  bool
158  verify(const Signature* signatureInfo, const SignedBlob& signedBlob);
159 
167  Blob
168  getPublicKeyDer(const KeyLocator& keyLocator);
169 
170  IdentityStorage* identityStorage_;
171 };
172 
173 }
174 
175 #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-2015 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
Definition: data.hpp:36
A SelfVerifyPolicyManager implements a PolicyManager to use the public key DER in the data packet's K...
Definition: self-verify-policy-manager.hpp:37
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:97
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 OnVerifyFailed &onVerifyFailed)
Use the public key DER in the data packet's KeyLocator (if available) or look in the IdentityStorage ...
Definition: self-verify-policy-manager.cpp:62
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:42
A Signature is an abstract base class providing methods to work with the signature information in a D...
Definition: signature.hpp:36
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.
Definition: blob.hpp:42
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:41
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:49
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 bool skipVerifyAndTrust(const Data &data)
Never skip verification.
Definition: self-verify-policy-manager.cpp:37
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:37
virtual Name inferSigningIdentity(const Name &dataName)
Override to indicate that the signing identity cannot be inferred.
Definition: self-verify-policy-manager.cpp:103
virtual ~SelfVerifyPolicyManager()
The virtual destructor.
Definition: self-verify-policy-manager.cpp:32
Definition: key-locator.hpp:36
A PolicyManager is an abstract base class to represent the policy for verifying data packets...
Definition: policy-manager.hpp:37