25 #ifndef NDN_SECURITY_VALIDATOR_HPP 26 #define NDN_SECURITY_VALIDATOR_HPP 28 #include "../face.hpp" 45 class Error :
public std::runtime_error
50 :
std::runtime_error(what)
85 validate(data, onValidated, onValidationFailed, 0);
100 validate(interest, onValidated, onValidationFailed, 0);
220 std::vector<shared_ptr<ValidationRequest>>& nextSteps) = 0;
240 std::vector<shared_ptr<ValidationRequest>>& nextSteps) = 0;
248 const shared_ptr<ValidationRequest>& nextStep);
277 virtual shared_ptr<const Data>
280 return data.shared_from_this();
297 int nRemainingRetries,
298 const OnFailure& onFailure,
299 const shared_ptr<ValidationRequest>& validationRequest);
313 int nRemainingRetries,
314 const OnFailure& onFailure,
315 const shared_ptr<ValidationRequest>& validationRequest);
327 afterCheckPolicy(
const std::vector<shared_ptr<ValidationRequest>>& nextSteps,
328 const OnFailure& onFailure);
340 #endif // NDN_SECURITY_VALIDATOR_HPP function< void(const shared_ptr< const Interest > &, const std::string &)> OnInterestValidationFailed
Callback to report a failed Interest validation.
void validate(const Data &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed)
Validate Data and call either onValidated or onValidationFailed.
Copyright (c) 2011-2015 Regents of the University of California.
void validate(const Interest &interest, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed)
Validate Interest and call either onValidated or onValidationFailed.
virtual shared_ptr< const Data > preCertificateValidation(const Data &data)
Hooks.
Error(const std::string &what)
virtual void checkPolicy(const Data &data, int nSteps, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest >> &nextSteps)=0
Check the Data against policy and return the next validation step if necessary.
Represent a SHA256 digest.
virtual void afterCheckPolicy(const std::vector< shared_ptr< ValidationRequest >> &nextSteps, const OnFailure &onFailure)
trigger after checkPolicy is done.
represents an Interest packet
function< void(const shared_ptr< const Data > &, const std::string &)> OnDataValidationFailed
Callback to report a failed Data validation.
static bool verifySignature(const Interest &interest, const Signature &sig, const v1::PublicKey &publicKey)
Verify the interest using the publicKey against the SHA256-RSA signature.
function< void(const shared_ptr< const Data > &)> OnDataValidated
Callback to report a successful Data validation.
represents a Network Nack
function< void(const shared_ptr< const Interest > &)> OnInterestValidated
Callback to report a successful Interest validation.
Validator(Face *face=nullptr)
Validator constructor.
static bool verifySignature(const Buffer &blob, const Signature &sig, const v1::PublicKey &publicKey)
Verify the blob using the publicKey against the signature.
const Block & getValue() const
Get SignatureValue in the wire format.
provides the interfaces for packet validation.
Provide a communication channel with local or remote NDN forwarder.
Name abstraction to represent an absolute name.
function< void(const std::string &)> OnFailure
void onData(const Interest &interest, const Data &data, const shared_ptr< ValidationRequest > &nextStep)
Process the received certificate.
size_t size() const
Get the number of components.
static bool verifySignature(const Buffer &blob, const DigestSha256 &sig)
Verify the blob against the SHA256 signature.
static bool verifySignature(const Data &data, const Signature &sig, const v1::PublicKey &publicKey)
Verify the data using the publicKey against the SHA256-RSA signature.
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Fast encoding or block size estimation.
static bool verifySignature(const Data &data, const DigestSha256 &sig)
Verify the data against the SHA256 signature.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
static bool verifySignature(const Interest &interest, const DigestSha256 &sig)
Verify the interest against the SHA256 signature.
virtual void onNack(const Interest &interest, const lp::Nack &nack, int nRemainingRetries, const OnFailure &onFailure, const shared_ptr< ValidationRequest > &validationRequest)
trigger when interest retrieves a Nack.
static bool verifySignature(const Data &data, const v1::PublicKey &publicKey)
Verify the data using the publicKey.
const Signature & getSignature() const
Class representing a general-use automatically managed/resized buffer.
const Name & getName() const
A Signature is storage for the signature-related information (info and value) in a Data packet...
virtual void onTimeout(const Interest &interest, int nRemainingRetries, const OnFailure &onFailure, const shared_ptr< ValidationRequest > &validationRequest)
trigger when interest for certificate times out.