30 if (innerPolicy ==
nullptr) {
31 NDN_THROW(std::invalid_argument(
"Inner policy argument cannot be nullptr"));
97 "Interest name too short `" + name.
toUri() +
"`"});
106 "Malformed SignatureInfo in `" + name.
toUri() +
"`: " + e.what()});
120 auto len =
static_cast<ssize_t
>(keyLocator.
size());
123 for (ssize_t i = len - 1; i >= lowerBound; --i) {
130 "` does not respect the naming conventions"));
Represents an Interest packet.
std::optional< SignatureInfo > getSignatureInfo() const
Get the InterestSignatureInfo element.
const Name & getName() const noexcept
Get the Interest name.
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.
std::shared_ptr< T > getTag() const
Get a tag item.
static constexpr ssize_t KEY_COMPONENT_OFFSET
static const name::Component KEY_COMPONENT
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.
@ INVALID_KEY_LOCATOR
The KeyLocator element is missing or has an invalid format.
@ MALFORMED_SIGNATURE
The signature (e.g., SignatureInfo element) is missing or malformed.
Abstraction that implements a validation policy for Interest and Data packets.
void setValidator(Validator &validator)
Set validator to which the policy is associated.
ValidationPolicy & getInnerPolicy()
Return the inner policy.
void setInnerPolicy(unique_ptr< ValidationPolicy > innerPolicy)
Set inner policy.
unique_ptr< ValidationPolicy > m_innerPolicy
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.
Contains the ndn-cxx security framework.
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.
SignatureInfo getSignatureInfo(const Interest &interest, ValidationState &state)
Extract SignatureInfo from a signed Interest.
Name getKeyLocatorName(const SignatureInfo &si, ValidationState &state)
Extract the KeyLocator name from a SignatureInfo element.
constexpr size_t MIN_SIZE
Minimum number of name components for an old-style Signed Interest.
constexpr ssize_t POS_SIG_INFO