ValidityPeriod Class¶
A ValidityPeriod is used in a Data packet’s SignatureInfo and represents the’ begin and end times of a certificate’s validity period.
[C++]: | #include <ndn-cpp/security/validity-period.hpp> Namespace:
ndn |
---|---|
[Python]: | Module: pyndn |
[Java]: | Package: net.named_data.jndn.security |
ValidityPeriod Constructors¶
ValidityPeriod Constructor (default)¶
Create a default ValidityPeriod where the period is not specified.
[C++]: | ValidityPeriod();
|
---|---|
[Python]: | def __init__(self)
|
[JavaScript]: | var ValidityPeriod = function ValidityPeriod()
|
[Java]: | public ValidityPeriod()
|
ValidityPeriod Constructor (copy)¶
Create a new ValidityPeriod as a copy of the given validity period.
[C++]: | ValidityPeriod(
const ValidityPeriod& validityPeriod
);
|
---|---|
[Python]: | def __init__(self,
validityPeriod # ValidityPeriod
)
|
[JavaScript]: | var ValidityPeriod = function ValidityPeriod(
validityPeriod // ValidityPeriod
)
|
[Java]: | public ValidityPeriod(
ValidityPeriod validityPeriod
)
|
Parameters: |
|
ValidityPeriod Constructor (from values)¶
Create a ValidityPeriod with the given period.
[C++]: | ValidityPeriod(
MillisecondsSince1970 notBefore,
MillisecondsSince1970 notAfter
);
|
---|---|
[Python]: | def __init__(self,
notBefore, # float
notAfter # float
)
|
[JavaScript]: | var ValidityPeriod = function ValidityPeriod(
notBefore, // number
notAfter // number
)
|
[Java]: | public ValidityPeriod(
double notBefore,
double notAfter
)
|
Parameters: |
|
ValidityPeriod.clear Method¶
Reset to a default ValidityPeriod where the period is not specified.
[C++]: | void clear();
|
---|---|
[Python]: | def clear(self)
|
[JavaScript]: | Exclude.prototype.clear = function()
|
[Java]: | public final void clear()
|
ValidityPeriod.equals Method¶
Check if this name has the same component count and components as the given name.
[C++]: | bool equals(
const ValidityPeriod& other
) const;
|
---|---|
[Python]: | # Returns bool
def equals(self,
other # ValidityPeriod
)
|
[JavaScript]: | // Returns boolean
ValidityPeriod.prototype.equals = function(
other // ValidityPeriod
)
|
[Java]: | public boolean equals(
ValidityPeriod other
)
|
Parameters: |
|
Returns: | True if the validity periods are equal, otherwise false. |
ValidityPeriod.getNotBefore Method¶
Get the beginning of the validity period range.
[C++]: | MillisecondsSince1970 getNotBefore() const;
|
---|---|
[Python]: | # Returns float
def getNotBefore(self)
|
[JavaScript]: | // Returns number
ValidityPeriod.prototype.getNotBefore = function()
|
[Java]: | public final double getNotBefore()
|
Returns: | The time as milliseconds since Jan 1, 1970 UTC. If not specified, return
|
ValidityPeriod.getNotAfter Method¶
Get the end of the validity period range.
[C++]: | MillisecondsSince1970 getNotAfter() const;
|
---|---|
[Python]: | # Returns float
def getNotAfter(self)
|
[JavaScript]: | // Returns number
ValidityPeriod.prototype.getNotAfter = function()
|
[Java]: | public final double getNotAfter()
|
Returns: | The time as milliseconds since Jan 1, 1970 UTC. If not specified, return
|
ValidityPeriod.hasPeriod Method¶
Check if the period has been set.
[C++]: | bool hasPeriod() const;
|
---|---|
[Python]: | # Returns bool
def hasPeriod(self)
|
[JavaScript]: | // Returns boolean
ValidityPeriod.prototype.hasPeriod = function()
|
[Java]: | public final boolean hasPeriod()
|
Returns: | True if the period has been set, false if the period is not specified (after calling the default constructor or clear). |
ValidityPeriod.isValid Method¶
Check if the time falls within the validity period.
[C++]: | bool isValid(
[MillisecondsSince1970 time]
) const;
|
---|---|
[Python]: | # Returns bool
def isValid(self
[, time # float]
)
|
[JavaScript]: | // Returns boolean
ValidityPeriod.prototype.isValid = function(
[time // number]
)
|
[Java]: | public final boolean isValid(
[double time]
)
|
Parameters: |
|
Returns: | True if the beginning of the validity period is less than or equal to time and time is less than or equal to the end of the validity period. |
ValidityPeriod.setPeriod Method¶
Set the validity period.
[C++]: | ValidityPeriod& setPeriod(
MillisecondsSince1970 notBefore,
MillisecondsSince1970 notAfter
);
|
---|---|
[Python]: | # Returns ValidityPeriod
def setPeriod(self,
notBefore, # float
notAfter # float
)
|
[JavaScript]: | // Returns ValidityPeriod
ValidityPeriod.prototype.setPeriod = function(
notBefore, // number
notAfter // number
)
|
[Java]: | public final ValidityPeriod setPeriod(
double notBefore,
double notAfter
)
|
Parameters: |
|
Returns: | This ValidityPeriod so that you can chain calls to update values. |