23 #ifndef NDN_VALIDATOR_FIXTURE_HPP
24 #define NDN_VALIDATOR_FIXTURE_HPP
26 #include <ndn-cpp/security/v2/validator.hpp>
27 #include <ndn-cpp/security/v2/certificate-fetcher-from-network.hpp>
28 #include "identity-management-fixture.hpp"
44 ValidatorFixture(
const ndn::ptr_lib::shared_ptr<ndn::ValidationPolicy>& policy);
52 typedef ndn::func_lib::function<void
74 ProcessInterest processInterest_;
75 std::vector<ndn::Interest> sentInterests_;
79 processInterestFromCache
85 ndn::ptr_lib::shared_ptr<ndn::ValidationPolicy> policy_;
92 (
const ndn::ptr_lib::shared_ptr<ndn::ValidationPolicy>& policy)
95 identity_ =
addIdentity(
"/Security/V2/ValidatorFixture");
96 subIdentity_ =
addSubCertificate(
"/Security/V2/ValidatorFixture/Sub1", identity_);
97 subSelfSignedIdentity_ =
addIdentity(
"/Security/V2/ValidatorFixture/Sub1/Sub2");
98 otherIdentity_ =
addIdentity(
"/Security/V2/OtherIdentity");
103 cache_.
insert(*identity_->getDefaultKey()->getDefaultCertificate());
104 cache_.
insert(*subIdentity_->getDefaultKey()->getDefaultCertificate());
105 cache_.
insert(*subSelfSignedIdentity_->getDefaultKey()->getDefaultCertificate());
106 cache_.
insert(*otherIdentity_->getDefaultKey()->getDefaultCertificate());
109 ndn::ptr_lib::shared_ptr<ndn::PibIdentity> identity_;
110 ndn::ptr_lib::shared_ptr<ndn::PibIdentity> subIdentity_;
111 ndn::ptr_lib::shared_ptr<ndn::PibIdentity> subSelfSignedIdentity_;
112 ndn::ptr_lib::shared_ptr<ndn::PibIdentity> otherIdentity_;
Copyright (C) 2017-2018 Regents of the University of California.
Definition: identity-management-fixture.hpp:29
Copyright (C) 2017-2018 Regents of the University of California.
Definition: validator-fixture.hpp:34
The Face class provides the main methods for NDN communication.
Definition: face.hpp:86
CertificateV2 represents a certificate following the certificate format naming convention.
Definition: certificate-v2.hpp:81
ndn::ptr_lib::shared_ptr< ndn::PibIdentity > addSubCertificate(const ndn::Name &subIdentityName, const ndn::ptr_lib::shared_ptr< ndn::PibIdentity > &issuer, const ndn::KeyParams ¶ms=ndn::KeyChain::getDefaultKeyParams())
Issue a certificate for subIdentityName signed by issuer.
Definition: identity-management-fixture.cpp:84
virtual uint64_t expressInterest(const ndn::Interest &interest, const ndn::OnData &onData, const ndn::OnTimeout &onTimeout, const ndn::OnNetworkNack &onNetworkNack, ndn::WireFormat &wireFormat=*ndn::WireFormat::getDefaultWireFormat())
If processInterest_ is not null, call processInterest_(interest, onData, onTimeout, onNetworkNack) which must call one of the callbacks to simulate the response.
Definition: validator-fixture.cpp:54
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest, const ptr_lib::shared_ptr< NetworkNack > &networkNack)> OnNetworkNack
An OnNetworkNack function object is used to pass a callback to expressInterest.
Definition: face.hpp:55
ValidatorFixture(const ndn::ptr_lib::shared_ptr< ndn::ValidationPolicy > &policy)
Create a ValidatorFixture to use the given policy.
Definition: validator-fixture.cpp:30
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest)> OnTimeout
An OnTimeout function object is used to pass a callback to expressInterest.
Definition: face.hpp:48
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:43
TestFace extends Face to instantly simulate a call to expressInterest.
Definition: validator-fixture.hpp:50
Face()
Create a new Face for communication with an NDN hub using a default connection as follows...
void insert(const CertificateV2 &certificate)
Insert the certificate into the cache.
Definition: certificate-cache-v2.cpp:42
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest, const ptr_lib::shared_ptr< Data > &data)> OnData
An OnData function object is used to pass a callback to expressInterest.
Definition: face.hpp:35
A CertificateCacheV2 holds other user's verified certificates in security v2 format CertificateV2...
Definition: certificate-cache-v2.hpp:38
Definition: validator-fixture.hpp:89
The Validator class provides an interface for validating data and interest packets.
Definition: validator.hpp:55
void loadAnchor(const std::string &groupId, const CertificateV2 &certificate)
Load a static trust anchor.
Definition: certificate-storage.hpp:100
ndn::ptr_lib::shared_ptr< ndn::PibIdentity > addIdentity(const ndn::Name &identityName, const ndn::KeyParams ¶ms=ndn::KeyChain::getDefaultKeyParams())
Add an identity for the identityName.
Definition: identity-management-fixture.cpp:60