9 #ifndef NDN_SECURITY_VALIDATOR_HPP
10 #define NDN_SECURITY_VALIDATOR_HPP
12 #include "../common.hpp"
14 #include "../data.hpp"
15 #include "../face.hpp"
30 class Error :
public std::runtime_error
35 : std::runtime_error(what)
57 validate(data, onValidated, onValidationFailed, 0);
72 validate(interest, onValidated, onValidationFailed, 0);
199 std::vector<shared_ptr<ValidationRequest> >& nextSteps) = 0;
219 std::vector<shared_ptr<ValidationRequest> >& nextSteps) = 0;
222 typedef function<void(const std::string&)> OnFailure;
228 const shared_ptr<ValidationRequest>& nextStep);
234 const OnFailure& onFailure,
235 const shared_ptr<ValidationRequest>& nextStep);
256 #endif //NDN_SECURITY_VALIDATOR_HPP
Representing of SHA256-with-RSA signature in a data packet.
Error(const std::string &what)
const Name & getName() const
Name getPrefix(int nComponents) const
Return a new Name with the first nComponents components of this Name.
static bool verifySignature(const Data &data, const SignatureSha256 &sig)
Verify the data against the SHA256 signature.
Representing of SHA256 signature in a data packet.
An Interest holds a Name and other fields for an interest.
const Block & getValue() const
size_t wireEncode(EncodingImpl< T > &block, bool unsignedPortion=false) const
Fast encoding or block size estimation.
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.
uint8_t * buf()
Get pointer to the first byte of the buffer (alternative version)
static bool verifySignature(const Interest &interest, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
Verify the interest using the publicKey against the SHA256-RSA signature.
function< void(const shared_ptr< const Data > &, const std::string &)> OnDataValidationFailed
Callback to report a failed Data validation.
Abstraction to communicate with local or remote NDN forwarder.
size_t size() const
Get the number of components.
A Name holds an array of Name::Component and represents an NDN name.
static bool verifySignature(const Buffer &blob, const SignatureSha256 &sig)
Verify the blob against the SHA256 signature.
static bool verifySignature(const Buffer &blob, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
Verify the blob using the publicKey against the SHA256-RSA signature.
size_t wireEncode(EncodingImpl< T > &block) const
Fast encoding or block size estimation.
const Signature & getSignature() const
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.
static bool verifySignature(const Interest &interest, const SignatureSha256 &sig)
Verify the interest against the SHA256 signature.
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.
static bool verifySignature(const Data &data, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
Verify the data using the publicKey against the SHA256-RSA signature.
A Signature is storage for the signature-related information (info and value) in a Data packet...