32 if (innerPolicy ==
nullptr) {
33 NDN_THROW(std::invalid_argument(
"Inner policy argument cannot be nullptr"));
36 if (m_validator !=
nullptr) {
37 innerPolicy->setValidator(*m_validator);
57 m_validator = &validator;
71 state.
fail({ValidationError::Code::INVALID_KEY_LOCATOR,
"KeyLocator is missing"});
77 state.
fail({ValidationError::Code::INVALID_KEY_LOCATOR,
"KeyLocator type is not Name"});
113 state.
fail({ValidationError::Code::INVALID_KEY_LOCATOR,
114 "Invalid signed Interest: " + std::string(e.what())});
void setInnerPolicy(unique_ptr< ValidationPolicy > innerPolicy)
Set inner policy.
Sign Interest using Packet Specification v0.3 semantics.
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
Copyright (c) 2011-2015 Regents of the University of California.
const KeyLocator & getKeyLocator() const
Get KeyLocator.
shared_ptr< T > getTag() const
get a tag item
Represents a SignatureInfo or InterestSignatureInfo TLV element.
void setValidator(Validator &validator)
Set validator to which the policy is associated.
const Name & getName() const
Get nested Name element.
int32_t getSignatureType() const noexcept
Get SignatureType.
Name extractIdentityNameFromKeyLocator(const Name &keyLocator)
Extract identity name from key, version-less certificate, or certificate name.
const size_t MIN_SIZE
minimal number of components for Signed Interest
Represents an Interest packet.
ValidationPolicy & getInnerPolicy()
Return the inner policy.
Abstraction that implements validation policy for Data and Interest packets.
unique_ptr< ValidationPolicy > m_innerPolicy
optional< SignatureInfo > getSignatureInfo() const
Get the InterestSignatureInfo.
provides a tag type for simple types
static const ssize_t KEY_COMPONENT_OFFSET
bool hasKeyLocator() const noexcept
Check if KeyLocator is present.
static Name getKeyLocatorName(const SignatureInfo &si, ValidationState &state)
static const Name & getDigestSha256Identity()
A localhost identity to indicate that the signature is generated using SHA-256.
Represents an absolute name.
size_t size() const
Returns the number of components.
const ssize_t POS_SIG_INFO
const Name & getName() const noexcept
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
static const name::Component KEY_COMPONENT
virtual void fail(const ValidationError &error)=0
Call the failure callback.
Represents a Data packet.
void wireDecode(const Block &wire, Type type=Type::Data)
Decode from wire format.
static const Name & getHmacIdentity()
A localhost identity to indicate that the signature is generated using an HMAC key.
represents an error in TLV encoding or decoding
Interface for validating data and interest packets.
const SignatureInfo & getSignatureInfo() const noexcept
Get SignatureInfo.