33 #include "../data.hpp" 34 #include "../interest.hpp" 35 #include "../encoding/buffer-stream.hpp" 41 verifySignature(
const uint8_t* blob,
size_t blobLen,
const uint8_t* sig,
size_t sigLen,
57 verifySignature(
const uint8_t* data,
size_t dataLen,
const uint8_t* sig,
size_t sigLen,
58 const uint8_t* key,
size_t keyLen)
71 static std::tuple<bool, const uint8_t*, size_t, const uint8_t*, size_t>
75 return std::make_tuple(
true,
82 return std::make_tuple(
false,
nullptr, 0,
nullptr, 0);
86 static std::tuple<bool, const uint8_t*, size_t, const uint8_t*, size_t>
92 return std::make_tuple(
false,
nullptr, 0,
nullptr, 0);
97 return std::make_tuple(
true,
103 return std::make_tuple(
false,
nullptr, 0,
nullptr, 0);
108 verifySignature(
const std::tuple<bool, const uint8_t*, size_t, const uint8_t*, size_t>& params,
111 bool isParsable =
false;
112 const uint8_t* buf =
nullptr;
114 const uint8_t* sig =
nullptr;
117 std::tie(isParsable, buf, bufLen, sig, sigLen) = params;
126 verifySignature(
const std::tuple<bool, const uint8_t*, size_t, const uint8_t*, size_t>& params,
127 const uint8_t* key,
size_t keyLen)
129 bool isParsable =
false;
130 const uint8_t* buf =
nullptr;
132 const uint8_t* sig =
nullptr;
135 std::tie(isParsable, buf, bufLen, sig, sigLen) = params;
194 verifyDigest(
const uint8_t* blob,
size_t blobLen,
const uint8_t* digest,
size_t digestLen,
208 if (result->size() != digestLen)
212 return CRYPTO_memcmp(result->data(), digest, digestLen) == 0;
218 bool isParsable =
false;
219 const uint8_t* buf =
nullptr;
221 const uint8_t* sig =
nullptr;
224 std::tie(isParsable, buf, bufLen, sig, sigLen) =
parse(data);
227 return verifyDigest(buf, bufLen, sig, sigLen, algorithm);
237 bool isParsable =
false;
238 const uint8_t* buf =
nullptr;
240 const uint8_t* sig =
nullptr;
243 std::tie(isParsable, buf, bufLen, sig, sigLen) =
parse(interest);
246 return verifyDigest(buf, bufLen, sig, sigLen, algorithm);
Copyright (c) 2011-2015 Regents of the University of California.
The certificate following the certificate format naming convention.
const Block & getContent() const
Get Content.
size_t value_size() const
Get size of TLV-VALUE aka TLV-LENGTH.
const size_t MIN_SIZE
minimal number of components for Signed Interest
Represents a TLV element of NDN packet format.
represents an Interest packet
const uint8_t * value() const
Get pointer to TLV-VALUE.
bool verifyDigest(const uint8_t *blob, size_t blobLen, const uint8_t *digest, size_t digestLen, DigestAlgorithm algorithm)
Verify blob against digest using algorithm.
size_t size() const
Get size of encoded wire, including Type-Length-Value.
const Signature & getSignature() const
Get Signature.
A frontend handle of a key instance.
const Block & getValue() const
Get SignatureValue.
Use the SHA256 hash of the public key as the key id.
Represents an absolute name.
const ssize_t POS_SIG_VALUE
size_t size() const
Get number of components.
bool verifySignature(const uint8_t *blob, size_t blobLen, const uint8_t *sig, size_t sigLen, const v2::PublicKey &pKey)
Verify blob using key against sig.
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
static std::tuple< bool, const uint8_t *, size_t, const uint8_t *, size_t > parse(const Data &data)
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Fast encoding or block size estimation.
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
Represents a Data packet.
represents an error in TLV encoding or decoding
const Name & getName() const
shared_ptr< const Buffer > ConstBufferPtr