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

#include <validator-regex.hpp>

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

Data Structures

class  Error
 

Public Member Functions

 ValidatorRegex (Face &face, shared_ptr< CertificateCache > certificateCache=DEFAULT_CERTIFICATE_CACHE, const int stepLimit=3)
 
 ValidatorRegex (const shared_ptr< Face > &face, shared_ptr< CertificateCache > certificateCache=DEFAULT_CERTIFICATE_CACHE, const int stepLimit=3)
 
virtual ~ValidatorRegex ()
 
void addDataVerificationRule (shared_ptr< SecRuleRelative > rule)
 Add a rule for data verification. More...
 
void addTrustAnchor (shared_ptr< IdentityCertificate > certificate)
 Add a trust anchor. More...
 
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...
 

Static Public Attributes

static const shared_ptr
< CertificateCache
DEFAULT_CERTIFICATE_CACHE
 

Protected Types

typedef std::vector
< shared_ptr< SecRuleRelative > > 
RuleList
 
typedef std::vector
< shared_ptr< Regex > > 
RegexList
 

Protected Member Functions

virtual void checkPolicy (const Data &data, int nSteps, 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 nSteps, 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...
 
void onCertificateValidated (const shared_ptr< const Data > &signCertificate, const shared_ptr< const Data > &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed)
 
void onCertificateValidationFailed (const shared_ptr< const Data > &signCertificate, const std::string &failureInfo, const shared_ptr< const Data > &data, const OnDataValidationFailed &onValidationFailed)
 

Protected Attributes

int m_stepLimit
 
shared_ptr< CertificateCachem_certificateCache
 
RuleList m_mustFailVerify
 
RuleList m_verifyPolicies
 
std::map< Name, shared_ptr
< IdentityCertificate > > 
m_trustAnchors
 
bool m_hasFace
 
Facem_face
 

Detailed Description

Definition at line 19 of file validator-regex.hpp.

Member Typedef Documentation

typedef std::vector< shared_ptr<Regex> > ndn::ValidatorRegex::RegexList
protected

Definition at line 98 of file validator-regex.hpp.

typedef std::vector< shared_ptr<SecRuleRelative> > ndn::ValidatorRegex::RuleList
protected

Definition at line 97 of file validator-regex.hpp.

Constructor & Destructor Documentation

ndn::ValidatorRegex::ValidatorRegex ( Face face,
shared_ptr< CertificateCache certificateCache = DEFAULT_CERTIFICATE_CACHE,
const int  stepLimit = 3 
)

Definition at line 24 of file validator-regex.cpp.

ndn::ValidatorRegex::ValidatorRegex ( const shared_ptr< Face > &  face,
shared_ptr< CertificateCache certificateCache = DEFAULT_CERTIFICATE_CACHE,
const int  stepLimit = 3 
)
Deprecated:
Use the other version of the constructor

Definition at line 35 of file validator-regex.cpp.

virtual ndn::ValidatorRegex::~ValidatorRegex ( )
inlinevirtual

Definition at line 46 of file validator-regex.hpp.

Member Function Documentation

void ndn::ValidatorRegex::addDataVerificationRule ( shared_ptr< SecRuleRelative rule)
inline

Add a rule for data verification.

Parameters
policyThe verification rule

Definition at line 108 of file validator-regex.hpp.

void ndn::ValidatorRegex::addTrustAnchor ( shared_ptr< IdentityCertificate certificate)
inline

Add a trust anchor.

Parameters
certificateThe trust anchor

Definition at line 114 of file validator-regex.hpp.

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

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 86 of file validator-regex.cpp.

virtual void ndn::ValidatorRegex::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 75 of file validator-regex.hpp.

void ndn::ValidatorRegex::onCertificateValidated ( const shared_ptr< const Data > &  signCertificate,
const shared_ptr< const Data > &  data,
const OnDataValidated onValidated,
const OnDataValidationFailed onValidationFailed 
)
protected

Definition at line 47 of file validator-regex.cpp.

void ndn::ValidatorRegex::onCertificateValidationFailed ( const shared_ptr< const Data > &  signCertificate,
const std::string &  failureInfo,
const shared_ptr< const Data > &  data,
const OnDataValidationFailed onValidationFailed 
)
protected

Definition at line 77 of file validator-regex.cpp.

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

const shared_ptr< CertificateCache > ndn::ValidatorRegex::DEFAULT_CERTIFICATE_CACHE
static

Definition at line 32 of file validator-regex.hpp.

shared_ptr<CertificateCache> ndn::ValidatorRegex::m_certificateCache
protected

Definition at line 101 of file validator-regex.hpp.

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.

RuleList ndn::ValidatorRegex::m_mustFailVerify
protected

Definition at line 102 of file validator-regex.hpp.

int ndn::ValidatorRegex::m_stepLimit
protected

Definition at line 100 of file validator-regex.hpp.

std::map<Name, shared_ptr<IdentityCertificate> > ndn::ValidatorRegex::m_trustAnchors
protected

Definition at line 104 of file validator-regex.hpp.

RuleList ndn::ValidatorRegex::m_verifyPolicies
protected

Definition at line 103 of file validator-regex.hpp.