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 `" +
118 m_data.
getName().toUri() +
"`"});
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 `" +
178 m_interest.
getName().toUri() +
"`"});
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));