A validator that can be set up via a configuration file. More...
#include <validation-policy-config.hpp>
Public Member Functions | |
void | load (const std::string &filename) |
Load policy from file filename . More... | |
void | load (const std::string &input, const std::string &filename) |
Load policy from direct input . More... | |
void | load (std::istream &input, const std::string &filename) |
Load policy from direct input . More... | |
void | load (const ConfigSection &configSection, const std::string &filename) |
Load policy from configSection . More... | |
Public Member Functions inherited from ndn::security::v2::ValidationPolicy | |
virtual | ~ValidationPolicy ()=default |
void | setInnerPolicy (unique_ptr< ValidationPolicy > innerPolicy) |
Set inner policy. More... | |
bool | hasInnerPolicy () const |
Check if inner policy is set. More... | |
ValidationPolicy & | getInnerPolicy () |
Return the inner policy. More... | |
void | setValidator (Validator &validator) |
Set validator to which the policy is associated. More... | |
virtual void | checkPolicy (const Certificate &certificate, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) |
Check certificate against the policy. More... | |
Protected Member Functions | |
void | checkPolicy (const Data &data, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override |
Check data against the policy. More... | |
void | checkPolicy (const Interest &interest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation) override |
Check interest against the policy. More... | |
Additional Inherited Members | |
Public Types inherited from ndn::security::v2::ValidationPolicy | |
using | ValidationContinuation = std::function< void(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state)> |
Public Attributes inherited from ndn::security::v2::ValidationPolicy | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED | __pad0__: Validator* m_validator = nullptr |
unique_ptr< ValidationPolicy > | m_innerPolicy |
A validator that can be set up via a configuration file.
ValidationPolicyCommandInterest
, in order to guard against replay attacks. Definition at line 41 of file validation-policy-config.hpp.
void ndn::security::v2::validator_config::ValidationPolicyConfig::load | ( | const std::string & | filename | ) |
void ndn::security::v2::validator_config::ValidationPolicyConfig::load | ( | const std::string & | input, |
const std::string & | filename | ||
) |
Load policy from direct input
.
Definition at line 50 of file validation-policy-config.cpp.
References load().
void ndn::security::v2::validator_config::ValidationPolicyConfig::load | ( | std::istream & | input, |
const std::string & | filename | ||
) |
Load policy from direct input
.
Definition at line 57 of file validation-policy-config.cpp.
References load(), NDN_THROW, and ndn::to_string().
void ndn::security::v2::validator_config::ValidationPolicyConfig::load | ( | const ConfigSection & | configSection, |
const std::string & | filename | ||
) |
Load policy from configSection
.
Definition at line 71 of file validation-policy-config.cpp.
References ndn::security::v2::validator_config::Rule::create(), ndn::tlv::Data, ndn::tlv::Interest, nonstd::optional_lite::std11::move(), and NDN_THROW.
|
overrideprotectedvirtual |
Check data
against the policy.
Depending on implementation of the policy, this check can be done synchronously or asynchronously.
Semantics of checkPolicy has changed from v1::Validator
state->fail
with appropriate error code and error description.Implements ndn::security::v2::ValidationPolicy.
Definition at line 235 of file validation-policy-config.cpp.
References ndn::tlv::Data, ndn::security::v2::getKeyLocatorName(), ndn::Data::getName(), ndn::Data::getSignatureType(), ndn::security::v2::ValidationPolicy::hasInnerPolicy(), ndn::security::v2::ValidationError::POLICY_ERROR, and ndn::Name::toUri().
|
overrideprotectedvirtual |
Check interest
against the policy.
Depending on implementation of the policy, this check can be done synchronously or asynchronously.
Semantics of checkPolicy has changed from v1::Validator
state->fail
with appropriate error code and error description.Implements ndn::security::v2::ValidationPolicy.
Definition at line 265 of file validation-policy-config.cpp.
References ndn::Name::at(), ndn::Block::blockFromValue(), ndn::security::v2::getKeyLocatorName(), ndn::Interest::getName(), ndn::Interest::getSignatureInfo(), ndn::SignatureInfo::getSignatureType(), ndn::security::v2::ValidationPolicy::hasInnerPolicy(), ndn::tlv::Interest, ndn::security::v2::ValidationError::INVALID_KEY_LOCATOR, ndn::signed_interest::MIN_SIZE, ndn::security::v2::ValidationError::POLICY_ERROR, ndn::signed_interest::POS_SIG_INFO, ndn::Name::size(), ndn::Name::toUri(), ndn::security::V03, and ndn::SignatureInfo::wireDecode().