25 #ifndef NDN_SECURITY_VALIDATOR_HPP 26 #define NDN_SECURITY_VALIDATOR_HPP 28 #include "../common.hpp" 30 #include "../data.hpp" 31 #include "../face.hpp" 49 class Error :
public std::runtime_error
54 :
std::runtime_error(what)
86 validate(data, onValidated, onValidationFailed, 0);
101 validate(interest, onValidated, onValidationFailed, 0);
221 std::vector<shared_ptr<ValidationRequest> >& nextSteps) = 0;
241 std::vector<shared_ptr<ValidationRequest> >& nextSteps) = 0;
249 const shared_ptr<ValidationRequest>& nextStep);
278 virtual shared_ptr<const Data>
281 return data.shared_from_this();
297 int nRemainingRetries,
298 const OnFailure& onFailure,
299 const shared_ptr<ValidationRequest>& validationRequest);
311 afterCheckPolicy(
const std::vector<shared_ptr<ValidationRequest> >& nextSteps,
312 const OnFailure& onFailure);
320 #endif // NDN_SECURITY_VALIDATOR_HPP Error(const std::string &what)
Copyright (c) 2011-2015 Regents of the University of California.
static bool verifySignature(const Interest &interest, const DigestSha256 &sig)
Verify the interest against the SHA256 signature.
virtual void afterCheckPolicy(const std::vector< shared_ptr< ValidationRequest > > &nextSteps, const OnFailure &onFailure)
trigger after checkPolicy is done.
void onData(const Interest &interest, const Data &data, const shared_ptr< ValidationRequest > &nextStep)
Process the received certificate.
static bool verifySignature(const Data &data, const DigestSha256 &sig)
Verify the data against the SHA256 signature.
static bool verifySignature(const Buffer &blob, const DigestSha256 &sig)
Verify the blob against the SHA256 signature.
Validator(Face *face=nullptr)
Validator constructor.
Represent a SHA256 digest.
static bool verifySignature(const Buffer &blob, const Signature &sig, const PublicKey &publicKey)
Verify the blob using the publicKey against the signature.
static bool verifySignature(const Interest &interest, const Signature &sig, const PublicKey &publicKey)
Verify the interest using the publicKey against the SHA256-RSA signature.
represents an Interest packet
virtual void onTimeout(const Interest &interest, int nRemainingRetries, const OnFailure &onFailure, const shared_ptr< ValidationRequest > &validationRequest)
trigger when interest for certificate times out.
void validate(const Interest &interest, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed)
Validate Interest and call either onValidated or onValidationFailed.
function< void(const shared_ptr< const Data > &)> OnDataValidated
Callback to report a successful Data validation.
void validate(const Data &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed)
Validate Data and call either onValidated or onValidationFailed.
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.
function< void(const shared_ptr< const Data > &, const std::string &)> OnDataValidationFailed
Callback to report a failed Data validation.
const Block & getValue() const
Get SignatureValue in the wire format.
Abstraction to communicate with local or remote NDN forwarder.
Name abstraction to represent an absolute name.
static bool verifySignature(const Data &data, const Signature &sig, const PublicKey &publicKey)
Verify the data using the publicKey against the SHA256-RSA signature.
size_t size() const
Get the number of components.
function< void(const shared_ptr< const Interest > &, const std::string &)> OnInterestValidationFailed
Callback to report a failed Interest validation.
static bool verifySignature(const Data &data, const PublicKey &publicKey)
Verify the data using the publicKey.
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Fast encoding or block size estimation.
function< void(const std::string &)> OnFailure
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
const Signature & getSignature() const
virtual shared_ptr< const Data > preCertificateValidation(const Data &data)
Hooks.
Class representing a general-use automatically managed/resized buffer.
Validator is one of the main classes of the security library.
function< void(const shared_ptr< const Interest > &)> OnInterestValidated
Callback to report a successful Interest validation.
const Name & getName() const
A Signature is storage for the signature-related information (info and value) in a Data packet...