ndn::security::v2::DynamicTrustAnchorGroup Class Reference

Dynamic trust anchor group. More...

#include <ndn-cxx/security/trust-anchor-group.hpp>

+ Inheritance diagram for ndn::security::v2::DynamicTrustAnchorGroup:
+ Collaboration diagram for ndn::security::v2::DynamicTrustAnchorGroup:

Public Member Functions

 DynamicTrustAnchorGroup (CertContainerInterface &certContainer, const std::string &id, const boost::filesystem::path &path, time::nanoseconds refreshPeriod, bool isDir=false)
 Create a dynamic trust anchor group. More...
 
const std::string & getId () const
 
void refresh () override
 Request certificate refresh. More...
 
size_t size () const
 

Protected Attributes

std::set< Namem_anchorNames
 
CertContainerInterfacem_certs
 

Detailed Description

Dynamic trust anchor group.

Definition at line 120 of file trust-anchor-group.hpp.

Constructor & Destructor Documentation

◆ DynamicTrustAnchorGroup()

ndn::security::v2::DynamicTrustAnchorGroup::DynamicTrustAnchorGroup ( CertContainerInterface certContainer,
const std::string &  id,
const boost::filesystem::path &  path,
time::nanoseconds  refreshPeriod,
bool  isDir = false 
)

Create a dynamic trust anchor group.

This contructor would load all the certificates from path and will be refreshing certificates every refreshPeriod time period.

Note that refresh is not scheduled, but is performed upon "find" operations.

When isDir is false and path doesn't point to a valid certificate (file doesn't exist or content is not a valid certificate), the dynamic anchor group will be empty until file gets created. If file disappears or gets corrupted, the anchor group becomes empty.

When idDir is true and path does't point to a valid folder, folder is empty, or doesn't contain valid certificates, the group will be empty until certificate files are placed in the folder. If folder is removed, becomes empty, or no longer contains valid certificates, the anchor group becomes empty.

Upon refresh, the existing certificates are not changed.

Parameters
certContainerA certificate container into which trust anchors from the group will be added
idGroup id
pathFile path for trust anchor(s), could be directory or file. If it is a directory, all the certificates in the directory will be loaded.
refreshPeriodRefresh time for the anchors under path, must be positive.
isDirTells whether the path is a directory or a single file.
Exceptions
std::invalid_argumentrefreshPeriod is negative

Definition at line 89 of file trust-anchor-group.cpp.

Member Function Documentation

◆ getId()

const std::string& ndn::security::v2::TrustAnchorGroup::getId ( ) const
inlineinherited
Returns
group id

Definition at line 66 of file trust-anchor-group.hpp.

◆ refresh()

void ndn::security::v2::DynamicTrustAnchorGroup::refresh ( )
overridevirtual

Request certificate refresh.

Reimplemented from ndn::security::v2::TrustAnchorGroup.

Definition at line 107 of file trust-anchor-group.cpp.

◆ size()

size_t ndn::security::v2::TrustAnchorGroup::size ( ) const
inherited
Returns
number of certificates in the group

Definition at line 51 of file trust-anchor-group.cpp.

Member Data Documentation

◆ m_anchorNames

std::set<Name> ndn::security::v2::TrustAnchorGroup::m_anchorNames
protectedinherited

Definition at line 85 of file trust-anchor-group.hpp.

◆ m_certs

CertContainerInterface& ndn::security::v2::TrustAnchorGroup::m_certs
protectedinherited

Definition at line 84 of file trust-anchor-group.hpp.