NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::CommandInterestValidator Class Reference

a validator for stop-and-wait command Interests More...

#include <command-interest-validator.hpp>

Inheritance diagram for ndn::security::CommandInterestValidator:
Collaboration diagram for ndn::security::CommandInterestValidator:

Classes

class  Options
 

Public Types

enum  ErrorCode {
  ErrorCode::NONE = 0, ErrorCode::NAME_TOO_SHORT, ErrorCode::BAD_TIMESTAMP, ErrorCode::BAD_SIG_INFO,
  ErrorCode::MISSING_KEY_LOCATOR, ErrorCode::BAD_KEY_LOCATOR_TYPE, ErrorCode::BAD_CERT_NAME, ErrorCode::TIMESTAMP_OUT_OF_GRACE,
  ErrorCode::TIMESTAMP_REORDER
}
 error codes More...
 

Public Member Functions

 CommandInterestValidator (unique_ptr< Validator > inner, const Options &options=Options())
 constructor More...
 
- Public Member Functions inherited from ndn::security::Validator
 Validator (Face *face=nullptr)
 Validator constructor. More...
 
 Validator (Face &face)
 
virtual ~Validator ()
 
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...
 

Protected Member Functions

virtual void checkPolicy (const Interest &interest, int nSteps, const OnInterestValidated &accept, const OnInterestValidationFailed &reject, std::vector< shared_ptr< ValidationRequest >> &nextSteps) override
 validate command Interest More...
 
virtual void checkPolicy (const Data &data, int nSteps, const OnDataValidated &accept, const OnDataValidationFailed &reject, std::vector< shared_ptr< ValidationRequest >> &nextSteps) override
 validate Data More...
 
- Protected Member Functions inherited from ndn::security::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 DatapreCertificateValidation (const Data &data)
 Hooks. More...
 
virtual void onNack (const Interest &interest, const lp::Nack &nack, int nRemainingRetries, const OnFailure &onFailure, const shared_ptr< ValidationRequest > &validationRequest)
 trigger when interest retrieves a Nack. 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ndn::security::Validator
static bool verifySignature (const Data &data, const v1::PublicKey &publicKey)
 Verify the data using the publicKey. More...
 
static bool verifySignature (const Interest &interest, const v1::PublicKey &publicKey)
 Verify the signed Interest using the publicKey. More...
 
static bool verifySignature (const Buffer &blob, const Signature &sig, const v1::PublicKey &publicKey)
 Verify the blob using the publicKey against the signature. More...
 
static bool verifySignature (const Data &data, const Signature &sig, const v1::PublicKey &publicKey)
 Verify the data using the publicKey against the SHA256-RSA signature. More...
 
static bool verifySignature (const Interest &interest, const Signature &sig, const v1::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 v1::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...
 
- Protected Types inherited from ndn::security::Validator
typedef function< void(const std::string &)> OnFailure
 
- Protected Attributes inherited from ndn::security::Validator
Facem_face
 

Detailed Description

a validator for stop-and-wait command Interests

See also
https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest

This validator checks timestamp field of a stop-and-wait command Interest. Signed Interest validation and Data validation requests are delegated to an inner validator.

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

Member Enumeration Documentation

◆ ErrorCode

error codes

Todo:
#1872 assign numeric codes to these errors
Enumerator
NONE 
NAME_TOO_SHORT 
BAD_TIMESTAMP 
BAD_SIG_INFO 
MISSING_KEY_LOCATOR 
BAD_KEY_LOCATOR_TYPE 
BAD_CERT_NAME 
TIMESTAMP_OUT_OF_GRACE 
TIMESTAMP_REORDER 

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

Constructor & Destructor Documentation

◆ CommandInterestValidator()

ndn::security::CommandInterestValidator::CommandInterestValidator ( unique_ptr< Validator inner,
const Options options = Options() 
)
explicit

constructor

Parameters
innera Validator for signed Interest signature validation and Data validation; this must not be nullptr
optionsstop-and-wait command Interest validation options
Exceptions
std::invalidinner is nullptr

Definition at line 62 of file command-interest-validator.cpp.

References ndn::security::CommandInterestValidator::Options::gracePeriod.

Member Function Documentation

◆ checkPolicy() [1/2]

void ndn::security::CommandInterestValidator::checkPolicy ( const Interest interest,
int  nSteps,
const OnInterestValidated accept,
const OnInterestValidationFailed reject,
std::vector< shared_ptr< ValidationRequest >> &  nextSteps 
)
overrideprotectedvirtual

validate command Interest

This function executes the following validation procedure:

  1. parse the Interest as a command Interest, and extract the public key name
  2. invoke inner validation to verify the signed Interest
  3. classify the command Interest as either initial or subsequent, and check the timestamp accordingly
  4. record the timestamp as last timestamp of the public key name

The validation request is rejected if any step in this procedure fails.

Implements ndn::security::Validator.

Definition at line 77 of file command-interest-validator.cpp.

References ndn::time::abs(), BAD_CERT_NAME, BAD_KEY_LOCATOR_TYPE, BAD_SIG_INFO, BAD_TIMESTAMP, ndn::security::v1::IdentityCertificate::certificateNameToPublicKeyName(), ndn::time::fromUnixTimestamp(), ndn::SignatureInfo::getKeyLocator(), ndn::KeyLocator::getName(), ndn::Interest::getName(), ndn::KeyLocator::getType(), ndn::security::CommandInterestValidator::Options::gracePeriod, ndn::SignatureInfo::hasKeyLocator(), ndn::security::invokeReject(), ndn::name::Component::isNumber(), ndn::KeyLocator::KeyLocator_Name, ndn::security::CommandInterestValidator::Options::maxTimestamps, ndn::signed_interest::MIN_LENGTH, MISSING_KEY_LOCATOR, NAME_TOO_SHORT, NONE, ndn::time::system_clock::now(), ndn::time::steady_clock::now(), ndn::signed_interest::POS_SIG_INFO, ndn::signed_interest::POS_TIMESTAMP, ndn::Name::size(), TIMESTAMP_OUT_OF_GRACE, TIMESTAMP_REORDER, ndn::security::CommandInterestValidator::Options::timestampTtl, ndn::name::Component::toNumber(), and ndn::SignatureInfo::wireDecode().

◆ checkPolicy() [2/2]

void ndn::security::CommandInterestValidator::checkPolicy ( const Data data,
int  nSteps,
const OnDataValidated accept,
const OnDataValidationFailed reject,
std::vector< shared_ptr< ValidationRequest >> &  nextSteps 
)
overrideprotectedvirtual

validate Data

The validation request is redirected to the inner validator.

Implements ndn::security::Validator.

Definition at line 196 of file command-interest-validator.cpp.


The documentation for this class was generated from the following files: