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

#include <command-interest-validator.hpp>

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

Public Types

enum  {
  POS_SIG_VALUE = -1, POS_SIG_INFO = -2, POS_RANDOM_VAL = -3, POS_TIMESTAMP = -4,
  MIN_LENGTH = 4, GRACE_INTERVAL = 3000
}
 

Public Member Functions

 CommandInterestValidator (const time::milliseconds &graceInterval=time::milliseconds(static_cast< int >(GRACE_INTERVAL)))
 
virtual ~CommandInterestValidator ()
 
void addInterestRule (const std::string &regex, const IdentityCertificate &certificate)
 
void addInterestRule (const std::string &regex, const Name &keyName, const PublicKey &publicKey)
 
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 stepCount, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest > > &nextSteps)
 Check the Data against policy and return the next validation step if necessary. More...
 
virtual void checkPolicy (const Interest &interest, int stepCount, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed, std::vector< shared_ptr< ValidationRequest > > &nextSteps)
 Check the Interest against validation policy and return the next validation step if necessary. More...
 

Protected Attributes

bool m_hasFace
 
Facem_face
 

Detailed Description

Definition at line 16 of file command-interest-validator.hpp.

Member Enumeration Documentation

anonymous enum
Enumerator
POS_SIG_VALUE 
POS_SIG_INFO 
POS_RANDOM_VAL 
POS_TIMESTAMP 
MIN_LENGTH 
GRACE_INTERVAL 

Definition at line 19 of file command-interest-validator.hpp.

Constructor & Destructor Documentation

ndn::CommandInterestValidator::CommandInterestValidator ( const time::milliseconds &  graceInterval = time::milliseconds(static_cast<int>(GRACE_INTERVAL)))
inline

Definition at line 30 of file command-interest-validator.hpp.

virtual ndn::CommandInterestValidator::~CommandInterestValidator ( )
inlinevirtual

Definition at line 38 of file command-interest-validator.hpp.

Member Function Documentation

void ndn::CommandInterestValidator::addInterestRule ( const std::string &  regex,
const IdentityCertificate certificate 
)
inline

Definition at line 75 of file command-interest-validator.hpp.

void ndn::CommandInterestValidator::addInterestRule ( const std::string &  regex,
const Name keyName,
const PublicKey publicKey 
)
inline

Definition at line 83 of file command-interest-validator.hpp.

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

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.

Implements ndn::Validator.

Definition at line 50 of file command-interest-validator.hpp.

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

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.

Implements ndn::Validator.

Definition at line 94 of file command-interest-validator.hpp.

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

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 
)
inlineinherited

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 
)
staticinherited

Verify the data using the publicKey.

Definition at line 128 of file validator.cpp.

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

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 
)
staticinherited

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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 
)
staticinherited

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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 
)
inlinestaticinherited

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 
)
staticinherited

Verify the blob against the SHA256 signature.

Definition at line 247 of file validator.cpp.

Field Documentation

Face& ndn::Validator::m_face
protectedinherited

Definition at line 251 of file validator.hpp.

bool ndn::Validator::m_hasFace
protectedinherited

Definition at line 250 of file validator.hpp.