25 #ifndef NDN_SECURITY_VALIDATOR_CONFIG_HPP 26 #define NDN_SECURITY_VALIDATOR_CONFIG_HPP 60 const size_t stepLimit = 10,
61 const size_t maxTrackedKeys = 1000,
69 const size_t stepLimit = 10,
70 const size_t maxTrackedKeys = 1000,
74 load(
const std::string& filename);
77 load(
const std::string& input,
const std::string& filename);
80 load(std::istream& input,
const std::string& filename);
84 const std::string& filename);
98 std::vector<shared_ptr<ValidationRequest>>& nextSteps)
override;
105 std::vector<shared_ptr<ValidationRequest>>& nextSteps)
override;
108 template<
class Packet,
class OnVal
idated,
class OnFailed>
110 checkSignature(
const Packet& packet,
113 const OnValidated& onValidated,
114 const OnFailed& onValidationFailed,
115 std::vector<shared_ptr<ValidationRequest>>& nextSteps);
118 checkTimestamp(
const shared_ptr<const Interest>& interest,
123 template<
class Packet,
class OnVal
idated,
class OnFailed>
125 onCertValidated(
const shared_ptr<const Data>& signCertificate,
126 const shared_ptr<const Packet>& packet,
127 const OnValidated& onValidated,
128 const OnFailed& onValidationFailed);
130 template<
class Packet,
class OnFailed>
132 onCertFailed(
const shared_ptr<const Data>& signCertificate,
133 const std::string& failureInfo,
134 const shared_ptr<const Packet>& packet,
135 const OnFailed& onValidationFailed);
139 const std::string& filename);
143 const std::string& filename);
146 getRefreshPeriod(std::string refreshString);
149 getDefaultRefreshPeriod();
157 class TrustAnchorContainer
160 const std::list<shared_ptr<v1::IdentityCertificate>>&
163 return m_certificates;
167 add(shared_ptr<v1::IdentityCertificate> certificate)
169 m_certificates.push_back(certificate);
173 std::list<shared_ptr<v1::IdentityCertificate>> m_certificates;
176 class DynamicTrustAnchorContainer :
public TrustAnchorContainer
179 DynamicTrustAnchorContainer(
const boost::filesystem::path& path,
bool isDir,
180 time::nanoseconds refreshPeriod)
183 , m_refreshPeriod(refreshPeriod)
190 m_lastRefresh = lastRefresh;
194 getLastRefresh()
const 196 return m_lastRefresh;
199 const time::nanoseconds&
200 getRefreshPeriod()
const 202 return m_refreshPeriod;
209 boost::filesystem::path m_path;
213 time::nanoseconds m_refreshPeriod;
217 compareDynamicContainer(
const DynamicTrustAnchorContainer& containerA,
218 const DynamicTrustAnchorContainer& containerB)
220 return (containerA.getLastRefresh() < containerB.getLastRefresh());
233 typedef std::map<Name, shared_ptr<v1::IdentityCertificate>>
AnchorList;
267 #endif // NDN_SECURITY_VALIDATOR_CONFIG_HPP std::vector< shared_ptr< InterestRule > > InterestRuleList
function< void(const shared_ptr< const Interest > &, const std::string &)> OnInterestValidationFailed
Callback to report a failed Interest validation.
Copyright (c) 2011-2015 Regents of the University of California.
InterestRuleList m_interestRules
void load(const std::string &filename)
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
time::milliseconds m_graceInterval
The validator which can be set up via a configuration file.
Error(const std::string &what)
represents an Interest packet
ValidatorConfig(Face *face=nullptr, const shared_ptr< CertificateCache > &certificateCache=DEFAULT_CERTIFICATE_CACHE, const time::milliseconds &graceInterval=DEFAULT_GRACE_INTERVAL, const size_t stepLimit=10, const size_t maxTrackedKeys=1000, const time::system_clock::Duration &keyTimestampTtl=DEFAULT_KEY_TIMESTAMP_TTL)
function< void(const shared_ptr< const Data > &, const std::string &)> OnDataValidationFailed
Callback to report a failed Data validation.
static const time::milliseconds DEFAULT_GRACE_INTERVAL
std::vector< shared_ptr< DataRule > > DataRuleList
security::conf::Rule< Data > DataRule
function< void(const shared_ptr< const Data > &)> OnDataValidated
Callback to report a successful Data validation.
TrustAnchorContainer m_staticContainer
function< void(const shared_ptr< const Interest > &)> OnInterestValidated
Callback to report a successful Interest validation.
DynamicContainers m_dynamicContainers
static const shared_ptr< CertificateCache > DEFAULT_CERTIFICATE_CACHE
shared_ptr< CertificateCache > m_certificateCache
std::list< shared_ptr< v1::IdentityCertificate > > CertificateList
provides the interfaces for packet validation.
Provide a communication channel with local or remote NDN forwarder.
Name abstraction to represent an absolute name.
virtual void checkPolicy(const Data &data, int nSteps, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest >> &nextSteps) override
Check the Data against policy and return the next validation step if necessary.
std::map< Name, time::system_clock::TimePoint > LastTimestampMap
const time::system_clock::Duration & m_keyTimestampTtl
boost::property_tree::ptree ConfigSection
static const time::system_clock::Duration DEFAULT_KEY_TIMESTAMP_TTL
std::list< DynamicTrustAnchorContainer > DynamicContainers
bool m_shouldValidate
gives whether validation should be preformed
std::map< Name, shared_ptr< v1::IdentityCertificate > > AnchorList
LastTimestampMap m_lastTimestamp
A Signature is storage for the signature-related information (info and value) in a Data packet...