#include <validator-regex.hpp>
Classes | |
class | Error |
Public Member Functions | |
ValidatorRegex (Face *face=nullptr, shared_ptr< CertificateCache > certificateCache=DEFAULT_CERTIFICATE_CACHE, const int stepLimit=3) | |
ValidatorRegex (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... | |
Public Member Functions inherited from ndn::Validator | |
Validator (Face *face=nullptr) | |
Validator constructor. More... | |
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 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 Types inherited from ndn::Validator | |
typedef function< void(const std::string &)> | OnFailure |
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 Member Functions inherited from ndn::Validator | |
void | onData (const Interest &interest, const Data &data, const shared_ptr< ValidationRequest > &nextStep) |
Process the received certificate. More... | |
void | validate (const Data &data, const OnDataValidated &onValidated, const OnDataValidationFailed &onValidationFailed, int nSteps) |
void | validate (const Interest &interest, const OnInterestValidated &onValidated, const OnInterestValidationFailed &onValidationFailed, int nSteps) |
virtual shared_ptr< const Data > | preCertificateValidation (const Data &data) |
Hooks. More... | |
virtual void | onTimeout (const Interest &interest, int nRemainingRetries, const OnFailure &onFailure, const shared_ptr< ValidationRequest > &validationRequest) |
trigger when interest for certificate times out. More... | |
virtual void | afterCheckPolicy (const std::vector< shared_ptr< ValidationRequest > > &nextSteps, const OnFailure &onFailure) |
trigger after checkPolicy is done. More... | |
Protected Attributes | |
int | m_stepLimit |
shared_ptr< CertificateCache > | m_certificateCache |
RuleList | m_mustFailVerify |
RuleList | m_verifyPolicies |
std::map< Name, shared_ptr< IdentityCertificate > > | m_trustAnchors |
Protected Attributes inherited from ndn::Validator | |
Face * | m_face |
Additional Inherited Members | |
Static Public Member Functions inherited from ndn::Validator | |
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 Signature &sig, const PublicKey &publicKey) |
Verify the data using the publicKey against the SHA256-RSA signature. More... | |
static bool | verifySignature (const Interest &interest, const Signature &sig, const PublicKey &publicKey) |
Verify the interest using the publicKey against the SHA256-RSA signature. More... | |
static bool | verifySignature (const uint8_t *buf, const size_t size, const Signature &sig, const PublicKey &publicKey) |
Verify the blob using the publicKey against the SHA256-RSA signature. More... | |
static bool | verifySignature (const Data &data, const DigestSha256 &sig) |
Verify the data against the SHA256 signature. More... | |
static bool | verifySignature (const Interest &interest, const DigestSha256 &sig) |
Verify the interest against the SHA256 signature. More... | |
static bool | verifySignature (const Buffer &blob, const DigestSha256 &sig) |
Verify the blob against the SHA256 signature. More... | |
static bool | verifySignature (const uint8_t *buf, const size_t size, const DigestSha256 &sig) |
Verify the blob against the SHA256 signature. More... | |
Definition at line 35 of file validator-regex.hpp.
|
protected |
Definition at line 118 of file validator-regex.hpp.
|
protected |
Definition at line 119 of file validator-regex.hpp.
|
explicit |
Definition at line 34 of file validator-regex.cpp.
References ndn::Face::getIoService(), and m_certificateCache.
Referenced by ndn::ValidatorRegex::Error::Error().
|
explicit |
Definition at line 45 of file validator-regex.cpp.
References ndn::Face::getIoService(), and m_certificateCache.
|
inlinevirtual |
Definition at line 64 of file validator-regex.hpp.
References addDataVerificationRule(), addTrustAnchor(), and checkPolicy().
void ndn::ValidatorRegex::addDataVerificationRule | ( | shared_ptr< SecRuleRelative > | rule | ) |
Add a rule for data verification.
rule | The verification rule |
Definition at line 57 of file validator-regex.cpp.
References m_mustFailVerify, and m_verifyPolicies.
Referenced by ~ValidatorRegex().
void ndn::ValidatorRegex::addTrustAnchor | ( | shared_ptr< IdentityCertificate > | certificate | ) |
Add a trust anchor.
certificate | The trust anchor |
Definition at line 63 of file validator-regex.cpp.
References m_trustAnchors.
Referenced by ~ValidatorRegex().
|
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.
data | The Data to check. |
nSteps | The number of validation steps that have been done. |
onValidated | If the Data is validated, this calls onValidated(data) |
onValidationFailed | If validation fails, this calls onValidationFailed(data) |
nextSteps | On return, contains the next validation step |
Implements ndn::Validator.
Definition at line 108 of file validator-regex.cpp.
References ndn::Signature::getKeyLocator(), ndn::KeyLocator::getName(), ndn::Data::getName(), ndn::Data::getSignature(), ndn::KeyLocator::getType(), ndn::Signature::hasKeyLocator(), ndn::KeyLocator::KeyLocator_Name, m_certificateCache, m_mustFailVerify, m_stepLimit, m_trustAnchors, m_verifyPolicies, onCertificateValidated(), onCertificateValidationFailed(), ndn::Name::toUri(), and ndn::Validator::verifySignature().
Referenced by ~ValidatorRegex().
|
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.
interest | The Interest to check. |
nSteps | The number of validation steps that have been done. |
onValidated | If the Interest is validated, this calls onValidated(data) |
onValidationFailed | If validation fails, this calls onValidationFailed(data) |
nextSteps | On return, contains the next validation step |
Implements ndn::Validator.
Definition at line 93 of file validator-regex.hpp.
References onCertificateValidated(), and onCertificateValidationFailed().
|
protected |
Definition at line 69 of file validator-regex.cpp.
References m_certificateCache, and ndn::Validator::verifySignature().
Referenced by checkPolicy().
|
protected |
Definition at line 99 of file validator-regex.cpp.
Referenced by checkPolicy().
|
static |
Definition at line 115 of file validator-regex.hpp.
Referenced by ndn::ValidatorRegex::Error::Error().
|
protected |
Definition at line 121 of file validator-regex.hpp.
Referenced by checkPolicy().
|
protected |
Definition at line 122 of file validator-regex.hpp.
Referenced by checkPolicy(), onCertificateValidated(), and ValidatorRegex().
|
protected |
Definition at line 123 of file validator-regex.hpp.
Referenced by addDataVerificationRule(), and checkPolicy().
|
protected |
Definition at line 124 of file validator-regex.hpp.
Referenced by addDataVerificationRule(), and checkPolicy().
|
protected |
Definition at line 125 of file validator-regex.hpp.
Referenced by addTrustAnchor(), and checkPolicy().