24 #include "../verification-helpers.hpp"    33 #define NDN_LOG_DEBUG_DEPTH(x) NDN_LOG_DEBUG(std::string(this->getDepth() + 1, '>') << " " << x)    34 #define NDN_LOG_TRACE_DEPTH(x) NDN_LOG_TRACE(std::string(this->getDepth() + 1, '>') << " " << x)    37   : m_outcome(
boost::logic::indeterminate)
    44   BOOST_ASSERT(!boost::logic::indeterminate(
m_outcome));
    50   return m_certificateChain.size();
    56   return !m_seenCertificateNames.insert(certName).second;
    62   m_certificateChain.push_front(cert);
    66 ValidationState::verifyCertificateChain(
const Certificate& trustedCert)
    69   for (
auto it = m_certificateChain.begin(); it != m_certificateChain.end(); ++it) {
    70     const auto& certToValidate = *it;
    73       this->
fail({ValidationError::Code::INVALID_SIGNATURE, 
"Invalid signature of certificate `" +
    74                   certToValidate.getName().toUri() + 
"`"});
    75       m_certificateChain.erase(it, m_certificateChain.end());
    80       validatedCert = &certToValidate;
    92   , m_successCb(successCb)
    93   , m_failureCb(failureCb)
    95   BOOST_ASSERT(m_successCb != 
nullptr);
    96   BOOST_ASSERT(m_failureCb != 
nullptr);
   101   if (boost::logic::indeterminate(
m_outcome)) {
   102     this->
fail({ValidationError::Code::IMPLEMENTATION_ERROR,
   103                 "Validator/policy did not invoke success or failure callback"});
   108 DataValidationState::verifyOriginalPacket(
const Certificate& trustedCert)
   113     BOOST_ASSERT(boost::logic::indeterminate(
m_outcome));
   117     this->
fail({ValidationError::Code::INVALID_SIGNATURE, 
"Invalid signature of data `" +
   123 DataValidationState::bypassValidation()
   127   BOOST_ASSERT(boost::logic::indeterminate(
m_outcome));
   135   m_failureCb(m_data, error);
   136   BOOST_ASSERT(boost::logic::indeterminate(
m_outcome));
   151   : m_interest(interest)
   152   , m_failureCb(failureCb)
   155   BOOST_ASSERT(successCb != 
nullptr);
   156   BOOST_ASSERT(m_failureCb != 
nullptr);
   161   if (boost::logic::indeterminate(
m_outcome)) {
   162     this->
fail({ValidationError::Code::IMPLEMENTATION_ERROR,
   163                 "Validator/policy did not invoke success or failure callback"});
   168 InterestValidationState::verifyOriginalPacket(
const Certificate& trustedCert)
   173     BOOST_ASSERT(boost::logic::indeterminate(
m_outcome));
   177     this->
fail({ValidationError::Code::INVALID_SIGNATURE, 
"Invalid signature of interest `" +
   183 InterestValidationState::bypassValidation()
   187   BOOST_ASSERT(boost::logic::indeterminate(
m_outcome));
   195   m_failureCb(m_interest, error);
   196   BOOST_ASSERT(boost::logic::indeterminate(
m_outcome));
 ValidationState()
Create validation state. 
 
DataValidationState(const Data &data, const DataValidationSuccessCallback &successCb, const DataValidationFailureCallback &failureCb)
Create validation state for data. 
 
const Name & getName() const 
 
Copyright (c) 2011-2015 Regents of the University of California. 
 
The certificate following the certificate format naming convention. 
 
void fail(const ValidationError &error) final
Call the failure callback. 
 
function< void(const Data &data)> DataValidationSuccessCallback
Callback to report a successful Data validation. 
 
bool hasSeenCertificateName(const Name &certName)
Check if certName has been previously seen and record the supplied name. 
 
Copyright (c) 2013-2017 Regents of the University of California. 
 
void addCertificate(const Certificate &cert)
Add cert to the top of the certificate chain. 
 
represents an Interest packet 
 
#define NDN_LOG_DEBUG_DEPTH(x)
 
function< void(const Data &data, const ValidationError &error)> DataValidationFailureCallback
Callback to report a failed Data validation. 
 
#define NDN_LOG_TRACE_DEPTH(x)
 
Catch-all error for security policy errors that don't fit in other categories. 
 
std::string toUri() const 
Get URI representation of the name. 
 
#define NDN_LOG_INIT(name)
declare a log module 
 
virtual ~ValidationState()
 
util::Signal< InterestValidationState, Interest > afterSuccess
 
Represents an absolute name. 
 
~InterestValidationState() final
Destructor. 
 
void fail(const ValidationError &error) final
Call the failure callback. 
 
function< void(const Interest &interest, const ValidationError &error)> InterestValidationFailureCallback
Callback to report a failed Interest validation. 
 
bool verifySignature(const uint8_t *blob, size_t blobLen, const uint8_t *sig, size_t sigLen, const v2::PublicKey &pKey)
Verify blob using key against sig. 
 
const Name & getName() const 
Get name. 
 
InterestValidationState(const Interest &interest, const InterestValidationSuccessCallback &successCb, const InterestValidationFailureCallback &failureCb)
Create validation state for interest. 
 
const Data & getOriginalData() const 
 
Validation error code and optional detailed error message. 
 
~DataValidationState() final
Destructor. 
 
#define NDN_LOG_TRACE(expression)
 
virtual void fail(const ValidationError &error)=0
Call the failure callback. 
 
Represents a Data packet. 
 
const Interest & getOriginalInterest() const 
 
boost::logic::tribool m_outcome
 
function< void(const Interest &interest)> InterestValidationSuccessCallback
Callback to report a successful Interest validation.