All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ndn::Validator Class Referenceabstract

Validator is one of the main classes of the security library. More...

#include <validator.hpp>

Inheritance diagram for ndn::Validator:
[legend]
Collaboration diagram for ndn::Validator:
[legend]

Data Structures

class  Error
 

Public Member Functions

 Validator ()
 
 Validator (Face &face)
 
void validate (const Data &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed)
 Validate Data and call either onValidated or onValidationFailed. More...
 
void validate (const Interest &interest, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed)
 Validate Interest and call either onValidated or onValidationFailed. More...
 

Static Public Member Functions

static bool verifySignature (const Data &data, const PublicKey &publicKey)
 Verify the data using the publicKey. More...
 
static bool verifySignature (const Interest &interest, const PublicKey &publicKey)
 Verify the signed Interest using the publicKey. More...
 
static bool verifySignature (const Buffer &blob, const Signature &sig, const PublicKey &publicKey)
 Verify the blob using the publicKey against the signature. More...
 
static bool verifySignature (const Data &data, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
 Verify the data using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const Interest &interest, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
 Verify the interest using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const Buffer &blob, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
 Verify the blob using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const uint8_t *buf, const size_t size, const SignatureSha256WithRsa &sig, const PublicKey &publicKey)
 Verify the blob using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const Data &data, const SignatureSha256 &sig)
 Verify the data against the SHA256 signature. More...
 
static bool verifySignature (const Interest &interest, const SignatureSha256 &sig)
 Verify the interest against the SHA256 signature. More...
 
static bool verifySignature (const Buffer &blob, const SignatureSha256 &sig)
 Verify the blob against the SHA256 signature. More...
 
static bool verifySignature (const uint8_t *buf, const size_t size, const SignatureSha256 &sig)
 Verify the blob against the SHA256 signature. More...
 

Protected Member Functions

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. More...
 
virtual void checkPolicy (const Interest &interest, int nSteps, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest > > &nextSteps)=0
 Check the Interest against validation policy and return the next validation step if necessary. More...
 

Protected Attributes

bool m_hasFace
 
Facem_face
 

Detailed Description

Validator is one of the main classes of the security library.

The Validator class provides the interfaces for packet validation.

Definition at line 27 of file validator.hpp.

Constructor & Destructor Documentation

ndn::Validator::Validator ( )

Definition at line 20 of file validator.cpp.

ndn::Validator::Validator ( Face face)
explicit

Definition at line 26 of file validator.cpp.

Member Function Documentation

virtual void ndn::Validator::checkPolicy ( const Data data,
int  nSteps,
const OnDataValidated onValidated,
const OnDataValidationFailed onValidationFailed,
std::vector< shared_ptr< ValidationRequest > > &  nextSteps 
)
protectedpure virtual

Check the Data against policy and return the next validation step if necessary.

If there is no next validation step, that validation MUST have been done. i.e., either onValidated or onValidationFailed callback is invoked.

Parameters
dataThe Data to check.
nStepsThe number of validation steps that have been done.
onDataValidatedIf the Data is validated, this calls onValidated(data).
onDataValidationFailedIf validation fails, this calls onValidationFailed(data).
nextStepsOn return, contains the next validation step.

Implemented in ndn::ValidatorRegex, ndn::ValidatorConfig, ndn::CommandInterestValidator, and ndn::ValidatorNull.

virtual void ndn::Validator::checkPolicy ( const Interest interest,
int  nSteps,
const OnInterestValidated onValidated,
const OnInterestValidationFailed onValidationFailed,
std::vector< shared_ptr< ValidationRequest > > &  nextSteps 
)
protectedpure virtual

Check the Interest against validation policy and return the next validation step if necessary.

If there is no next validation step, that validation MUST have been done. i.e., either onValidated or onValidationFailed callback is invoked.

Parameters
dataThe Interest to check.
nStepsThe number of validation steps that have been done.
OnInterestValidatedIf the Interest is validated, this calls onValidated(data).
OnInterestValidationFailedIf validation fails, this calls onValidationFailed(data).
Returns
the indication of next validation step, null if there is no further step.

Implemented in ndn::ValidatorRegex, ndn::ValidatorConfig, ndn::CommandInterestValidator, and ndn::ValidatorNull.

void ndn::Validator::validate ( const Data data,
const OnDataValidated onValidated,
const OnDataValidationFailed onValidationFailed 
)
inline

Validate Data and call either onValidated or onValidationFailed.

Parameters
dataThe Data with the signature to check.
onValidatedIf the Data is validated, this calls onValidated(data).
onValidationFailedIf validation fails, this calls onValidationFailed(data).

Definition at line 53 of file validator.hpp.

void ndn::Validator::validate ( const Interest interest,
const OnInterestValidated onValidated,
const OnInterestValidationFailed onValidationFailed 
)
inline

Validate Interest and call either onValidated or onValidationFailed.

Parameters
interestThe Interest with the signature to check.
onValidatedIf the Interest is validated, this calls onValidated(interest).
onValidationFailedIf validation fails, this calls onValidationFailed(interest).

Definition at line 68 of file validator.hpp.

bool ndn::Validator::verifySignature ( const Data data,
const PublicKey publicKey 
)
static

Verify the data using the publicKey.

Definition at line 128 of file validator.cpp.

bool ndn::Validator::verifySignature ( const Interest interest,
const PublicKey publicKey 
)
static

Verify the signed Interest using the publicKey.

(Note the signature covers the first n-2 name components).

Definition at line 153 of file validator.cpp.

bool ndn::Validator::verifySignature ( const Buffer blob,
const Signature sig,
const PublicKey publicKey 
)
static

Verify the blob using the publicKey against the signature.

Definition at line 195 of file validator.cpp.

static bool ndn::Validator::verifySignature ( const Data data,
const SignatureSha256WithRsa sig,
const PublicKey publicKey 
)
inlinestatic

Verify the data using the publicKey against the SHA256-RSA signature.

Definition at line 97 of file validator.hpp.

static bool ndn::Validator::verifySignature ( const Interest interest,
const SignatureSha256WithRsa sig,
const PublicKey publicKey 
)
inlinestatic

Verify the interest using the publicKey against the SHA256-RSA signature.

(Note the signature covers the first n-2 name components).

Definition at line 111 of file validator.hpp.

static bool ndn::Validator::verifySignature ( const Buffer blob,
const SignatureSha256WithRsa sig,
const PublicKey publicKey 
)
inlinestatic

Verify the blob using the publicKey against the SHA256-RSA signature.

Definition at line 127 of file validator.hpp.

bool ndn::Validator::verifySignature ( const uint8_t *  buf,
const size_t  size,
const SignatureSha256WithRsa sig,
const PublicKey publicKey 
)
static

Verify the blob using the publicKey against the SHA256-RSA signature.

Definition at line 220 of file validator.cpp.

static bool ndn::Validator::verifySignature ( const Data data,
const SignatureSha256 sig 
)
inlinestatic

Verify the data against the SHA256 signature.

Definition at line 144 of file validator.hpp.

static bool ndn::Validator::verifySignature ( const Interest interest,
const SignatureSha256 sig 
)
inlinestatic

Verify the interest against the SHA256 signature.

(Note the signature covers the first n-2 name components).

Definition at line 157 of file validator.hpp.

static bool ndn::Validator::verifySignature ( const Buffer blob,
const SignatureSha256 sig 
)
inlinestatic

Verify the blob against the SHA256 signature.

Definition at line 171 of file validator.hpp.

bool ndn::Validator::verifySignature ( const uint8_t *  buf,
const size_t  size,
const SignatureSha256 sig 
)
static

Verify the blob against the SHA256 signature.

Definition at line 247 of file validator.cpp.

Field Documentation

Face& ndn::Validator::m_face
protected

Definition at line 251 of file validator.hpp.

bool ndn::Validator::m_hasFace
protected

Definition at line 250 of file validator.hpp.