ndn::security::DynamicTrustAnchorGroup Class Reference

Dynamic trust anchor group. More...

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

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

Public Member Functions

 DynamicTrustAnchorGroup (CertContainerInterface &certContainer, const std::string &id, const std::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 118 of file trust-anchor-group.hpp.

Constructor & Destructor Documentation

◆ DynamicTrustAnchorGroup()

ndn::security::DynamicTrustAnchorGroup::DynamicTrustAnchorGroup ( CertContainerInterface certContainer,
const std::string &  id,
const std::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 81 of file trust-anchor-group.cpp.

Member Function Documentation

◆ getId()

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

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

◆ refresh()

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

Request certificate refresh.

Reimplemented from ndn::security::TrustAnchorGroup.

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

◆ size()

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

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

Member Data Documentation

◆ m_anchorNames

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

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

◆ m_certs

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

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