Validator Class¶
A Validator provides an interface for validating data and interest packets. A Validator has a trust anchor cache to save static and dynamic trust anchors, a verified certificate cache for saving certificates that are already verified, and an unverified certificate cache for saving pre-fetched but not yet verified certificates. You should create and object of one of the subclasses, then use the Validator.validate methods.
[C++]: | #include <ndn-cpp/security/v2/validator.hpp> Namespace:
ndn |
---|---|
[Python]: | Module: |
[Java]: | Package: |
Realizations: |
Validator.getFetcher Method¶
Get the CertificateFetcher given to (or created in) the constructor.
[C++]: | CertificateFetcher& getFetcher();
|
---|---|
[Python]: | # Returns CertificateFetcher
def getFetcher(self)
|
[JavaScript]: | // Returns CertificateFetcher
Validator.prototype.getFetcher = function()
|
[Java]: | public final CertificateFetcher getFetcher()
|
Returns: | The CertificateFetcher. |
Validator.getMaxDepth Method¶
Get the maximum depth of the certificate chain.
[C++]: | size_t getMaxDepth();
|
---|---|
[Python]: | # Returns int
def getMaxDepth(self)
|
[JavaScript]: | // Returns number
Validator.prototype.getMaxDepth = function()
|
[Java]: | public final int getMaxDepth()
|
Returns: | The maximum depth. |
Validator.setMaxDepth Method¶
Set the maximum depth of the certificate chain.
[C++]: | void setMaxDepth(
size_t maxDepth
);
|
---|---|
[Python]: | def setMaxDepth(self,
maxDepth # int
)
|
[JavaScript]: | Validator.prototype.setMaxDepth = function(
maxDepth // number
)
|
[Java]: | public final void setMaxDepth(
int maxDepth
)
|
Parameters: |
|
Validator.validate Methods¶
Validator.validate Method (for Data)¶
Asynchronously validate the Data packet.
[C++]: | void validate(
const Data& data,
const DataValidationSuccessCallback& successCallback,
const DataValidationFailureCallback& failureCallback
);
|
---|---|
[Python]: | def validate(self,
data, # Data
successCallback, # function object
failureCallback # function object
)
|
[JavaScript]: | Validator.prototype.validate = function(
data, // Data
successCallback, // function
failureCallback // function
)
|
[Java]: | public final void validate(
Data data,
DataValidationSuccessCallback successCallback,
DataValidationFailureCallback failureCallback
)
|
Parameters: |
|
Validator.validate Method (for Interest)¶
Asynchronously validate the Interest packet.
[C++]: | void validate(
const Interest& interest,
const InterestValidationSuccessCallback& successCallback,
const InterestValidationFailureCallback& failureCallback
);
|
---|---|
[Python]: | def validate(self,
interest, # Interest
successCallback, # function object
failureCallback # function object
)
|
[JavaScript]: | Validator.prototype.validate = function(
interest, // Interest
successCallback, // function
failureCallback // function
)
|
[Java]: | public final void validate(
Interest interest,
InterestValidationSuccessCallback successCallback,
InterestValidationFailureCallback failureCallback
)
|
Parameters: |
|
ValidatorConfig Class¶
ValidatorConfig extends Validator to implements a validator which can be set up via a configuration file.
[C++]: | #include <ndn-cpp/security/validator-config.hpp> Namespace:
ndn |
---|---|
[Python]: | Module: pyndn.security |
[Java]: | Package: net.named_data.jndn.security |
ValidatorConfig Constructors¶
ValidatorConfig Constructor (from CertificateFetcher)¶
Create a ValidatorConfig to use the given certificate fetcher.
[C++]: | ValidatorConfig(
const ptr_lib::shared_ptr<CertificateFetcher>& fetcher
);
|
---|---|
[Python]: | def __init__(self,
fetcher # CertificateFetcher
)
|
[JavaScript]: | var ValidatorConfig = function ValidatorConfig(
fetcher // CertificateFetcher
)
|
[Java]: | public ValidatorConfig(
CertificateFetcher fetcher
)
|
Parameters: |
|
ValidatorConfig Constructor (from Face)¶
Create a ValidatorConfig that uses a CertificateFetcherFromNetwork for the given Face.
[C++]: | ValidatorConfig(
Face& face
);
|
---|---|
[Python]: | def __init__(self,
face # Face
)
|
[JavaScript]: | var ValidatorConfig = function ValidatorConfig(
face // Face
)
|
[Java]: | public ValidatorConfig(
Face face
)
|
Parameters: |
|
ValidatorConfig.load Methods¶
ValidatorConfig.load Method (from file path)¶
Load the configuration from the given config file. This replaces any existing configuration.
[C++]: | void load(
const std::string& filePath
);
|
---|---|
[Python]: | def load(self,
filePath # str
)
|
[JavaScript]: | ValidatorConfig.prototype.load = function(
filePath // string
)
|
[Java]: | public final void load(
String filePath
)
|
Parameters: |
|
ValidatorConfig.load Method (from input string)¶
Load the configuration from the given input string. This replaces any existing configuration.
[C++]: | void load(
const std::string& input,
const std::string& inputName
);
|
---|---|
[Python]: | def load(self,
input, # str
inputName # str
)
|
[JavaScript]: | ValidatorConfig.prototype.load = function(
input, // string
inputName // string
)
|
[Java]: | public final void load(
String input,
String inputName
)
|
Parameters: |
|
ValidatorNull Class¶
ValidatorNull extends Validator with an “accept-all” policy and an offline certificate fetcher.
[C++]: | #include <ndn-cpp/security/validator-null.hpp> Namespace:
ndn |
---|---|
[Python]: | Module: pyndn.security |
[Java]: | Package: net.named_data.jndn.security |
ValidatorNull Constructor¶
Create a ValidatorNull object.
[C++]: | ValidatorNull();
|
---|---|
[Python]: | def __init__(self)
|
[JavaScript]: | var ValidatorNull = function ValidatorNull()
|
[Java]: | public ValidatorNull()
|