32 if (innerPolicy ==
nullptr) {
33 NDN_THROW(std::invalid_argument(
"Inner policy argument cannot be nullptr"));
99 "Interest name too short `" + name.
toUri() +
"`"});
108 "Malformed SignatureInfo in `" + name.
toUri() +
"`: " + e.what()});
122 auto len =
static_cast<ssize_t
>(keyLocator.
size());
125 for (ssize_t i = len - 1; i >= lowerBound; --i) {
132 "` does not respect the naming conventions"));
Represents an Interest packet.
const Name & getName() const noexcept
optional< SignatureInfo > getSignatureInfo() const
Get the InterestSignatureInfo element.
const Name & getName() const
Get nested Name element.
Represents an absolute name.
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
size_t size() const noexcept
Returns the number of components.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
int32_t getSignatureType() const noexcept
Get the SignatureType.
bool hasKeyLocator() const noexcept
Check if KeyLocator is present.
const KeyLocator & getKeyLocator() const
Get the KeyLocator element.
Provides a tag type for simple types.
shared_ptr< T > getTag() const
Get a tag item.
static const Name & getDigestSha256Identity()
A localhost identity to indicate that the signature is generated using SHA-256.
static const Name & getHmacIdentity()
A localhost identity to indicate that the signature is generated using an HMAC key.
static const name::Component KEY_COMPONENT
static const ssize_t KEY_COMPONENT_OFFSET
@ MALFORMED_SIGNATURE
The signature (e.g., SignatureInfo element) is missing or malformed.
@ INVALID_KEY_LOCATOR
The KeyLocator element is missing or has an invalid format.
Abstraction that implements a validation policy for Interest and Data packets.
ValidationPolicy & getInnerPolicy()
Return the inner policy.
void setValidator(Validator &validator)
Set validator to which the policy is associated.
unique_ptr< ValidationPolicy > m_innerPolicy
void setInnerPolicy(unique_ptr< ValidationPolicy > innerPolicy)
Set inner policy.
virtual void fail(const ValidationError &error)=0
Call the failure callback.
Interface for validating data and interest packets.
Represents an error in TLV encoding or decoding.
Name getKeyLocatorName(const SignatureInfo &si, ValidationState &state)
Extract the KeyLocator name from a SignatureInfo element.
SignatureInfo getSignatureInfo(const Interest &interest, ValidationState &state)
Extract SignatureInfo from a signed Interest.
Name extractIdentityNameFromKeyLocator(const Name &keyLocator)
Extract identity name from key, version-less certificate, or certificate name.
@ V03
Sign Interest using Packet Specification v0.3 semantics.
const size_t MIN_SIZE
Minimum number of name components for an old-style Signed Interest.
const ssize_t POS_SIG_INFO