28 #include "ndn-cxx/security/impl/openssl.hpp" 46 ParseResult() =
default;
48 ParseResult(InputBuffers
bufs,
const uint8_t*
sig,
size_t sigLen)
49 : bufs(
std::move(bufs))
57 const uint8_t*
sig =
nullptr;
69 using namespace transform;
89 const uint8_t* key,
size_t keyLen)
104 const uint8_t* key,
size_t keyLen)
118 return ParseResult();
139 return ParseResult();
144 return ParseResult({{nameBlock.
value(),
151 return ParseResult();
158 return !params.bufs.empty() &&
verifySignature(params.bufs, params.sig, params.sigLen, key);
165 return !params.bufs.empty() && bool(tpm.
verify(params.bufs, params.sig, params.sigLen, keyName, digestAlgorithm));
171 return !params.bufs.empty() &&
verifySignature(params.bufs, params.sig, params.sigLen, key, keyLen);
242 using namespace transform;
253 if (result->size() != digestLen) {
258 return CRYPTO_memcmp(result->data(), digest, digestLen) == 0;
262 verifyDigest(
const uint8_t* blob,
size_t blobLen,
const uint8_t* digest,
size_t digestLen,
265 return verifyDigest({{blob, blobLen}}, digest, digestLen, algorithm);
271 ParseResult parseResult =
parse(data);
272 return !parseResult.bufs.empty() &&
verifyDigest(parseResult.bufs, parseResult.sig,
273 parseResult.sigLen, algorithm);
279 ParseResult parseResult =
parse(interest);
280 return !parseResult.bufs.empty() &&
verifyDigest(parseResult.bufs, parseResult.sig,
281 parseResult.sigLen, algorithm);
The certificate following the certificate format naming convention.
size_t value_size() const noexcept
Return the size of TLV-VALUE, aka 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.
boost::logic::tribool verify(const InputBuffers &bufs, const uint8_t *sig, size_t sigLen, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Verify discontiguous ranges using the key with name keyName and using the digest digestAlgorithm.
InputBuffers extractSignedRanges() const
Extract ranges of Data covered by the signature.
A frontend handle of a key instance.
bool verifyDigest(const InputBuffers &bufs, const uint8_t *digest, size_t digestLen, DigestAlgorithm algorithm)
Verify blobs against digest using algorithm.
Use the SHA-256 hash of the public key as key id.
Represents an absolute name.
const ssize_t POS_SIG_VALUE
bool verifySignature(const InputBuffers &blobs, const uint8_t *sig, size_t sigLen, const transform::PublicKey &key)
Verify blobs using key against sig.
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.
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
const Block & getContent() const noexcept
Get the Content element.
const Name & getName() const noexcept
const Buffer & getPublicKey() const
Get public key bits.
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
shared_ptr< const Buffer > ConstBufferPtr