31 if (innerPolicy ==
nullptr) {
32 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Inner policy argument cannot be nullptr"));
35 if (m_validator !=
nullptr) {
36 innerPolicy->setValidator(*m_validator);
56 m_validator = &validator;
66 state.
fail({ValidationError::Code::INVALID_KEY_LOCATOR,
"KeyLocator is missing"});
72 state.
fail({ValidationError::Code::INVALID_KEY_LOCATOR,
"KeyLocator type is not Name"});
91 "Invalid signed Interest: name too short"});
100 state.
fail({ValidationError::Code::INVALID_KEY_LOCATOR,
101 "Invalid signed Interest: " + std::string(e.what())});
void setInnerPolicy(unique_ptr< ValidationPolicy > innerPolicy)
Set inner policy.
const Name & getName() const
Copyright (c) 2011-2015 Regents of the University of California.
Represents a SignatureInfo TLV element.
void setValidator(Validator &validator)
Set validator to which the policy is associated.
const Signature & getSignature() const
Get Signature.
const size_t MIN_SIZE
minimal number of components for Signed Interest
represents an Interest packet
ValidationPolicy & getInnerPolicy()
Return the inner policy.
indicates KeyLocator contains a Name
Abstraction that implements validation policy for Data and Interest packets.
const KeyLocator & getKeyLocator() const
Get KeyLocator.
unique_ptr< ValidationPolicy > m_innerPolicy
Catch-all error for security policy errors that don't fit in other categories.
const SignatureInfo & getSignatureInfo() const
Get SignatureInfo.
const Name & getName() const
get Name element
static Name getKeyLocatorName(const SignatureInfo &si, ValidationState &state)
Block blockFromValue() const
size_t size() const
Get number of components.
Represents an absolute name.
const Component & at(ssize_t i) const
Get the component at the given index.
void wireDecode(const Block &wire)
Decode from wire format.
const ssize_t POS_SIG_INFO
bool hasKeyLocator() const
Check if KeyLocator exists.
virtual void fail(const ValidationError &error)=0
Call the failure callback.
Represents a Data packet.
represents an error in TLV encoding or decoding
Interface for validating data and interest packets.