46 ParseResult() =
default;
58 span<const uint8_t>
sig;
140 return !params.bufs.empty() &&
verifySignature(params.bufs, params.sig, key);
146 return !params.bufs.empty() &&
verifySignature(params.bufs, params.sig, key);
153 return !params.bufs.empty() && bool(tpm.
verify(params.bufs, params.sig, keyName, digestAlgorithm));
159 if (params.bufs.empty()) {
171 auto result = os.
buf();
173 if (result->size() != params.sig.size()) {
178 return CRYPTO_memcmp(result->data(), params.sig.data(), params.sig.size()) == 0;
220 auto parsed =
parse(data);
236 auto parsed =
parse(interest);
Copyright (c) 2011-2015 Regents of the University of California.
bool verifySignature(const InputBuffers &blobs, span< const uint8_t > sig, const transform::PublicKey &key)
Verify blobs using key against sig.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
NDN_CXX_NODISCARD boost::logic::tribool verify(const InputBuffers &bufs, span< const uint8_t > sig, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Verify discontiguous ranges using the key with name keyName and using the digest digestAlgorithm.
span< const uint8_t > getPublicKey() const
Get public key bits.
size_t value_size() const noexcept
Return the size of TLV-VALUE, i.e., the TLV-LENGTH.
const size_t MIN_SIZE
minimal number of components for Signed Interest
InputBuffers extractSignedRanges() const
Extract ranges of Interest covered by the signature in Packet Specification v0.3. ...
Represents a TLV element of the NDN packet format.
Represents an Interest packet.
const Block & getSignatureValue() const noexcept
Get SignatureValue.
optional< SignatureInfo > getSignatureInfo() const
Get the InterestSignatureInfo.
InputBuffers extractSignedRanges() const
Extract ranges of Data covered by the signature.
A frontend handle of a key instance.
static bool verifyDigest(const ParseResult ¶ms, DigestAlgorithm algorithm)
Use the SHA-256 hash of the public key as key id.
Represents an absolute name.
const ssize_t POS_SIG_VALUE
size_t size() const
Returns the number of components.
Block getSignatureValue() const
Get the InterestSignatureValue.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Prepend wire encoding to encoder.
bool isValid() const noexcept
Check if the Block is valid.
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE.
span< const uint8_t > value_bytes() const noexcept
Return a read-only view of TLV-VALUE as a contiguous range of bytes.
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
const ssize_t POS_SIG_INFO
const Name & getName() const noexcept
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
implements an output stream that constructs ndn::Buffer
static ParseResult parse(const Data &data)
Represents a Data packet.
represents an error in TLV encoding or decoding
const SignatureInfo & getSignatureInfo() const noexcept
Get SignatureInfo.
span< const uint8_t > sig