Dynamic trust anchor group. More...
#include <trust-anchor-group.hpp>
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... | |
void | refresh () override |
Request certificate refresh. More... | |
Public Member Functions inherited from ndn::security::v2::TrustAnchorGroup | |
TrustAnchorGroup (CertContainerInterface &certContainer, const std::string &id) | |
Create an anchor group. More... | |
virtual | ~TrustAnchorGroup () |
const std::string & | getId () const |
size_t | size () const |
Additional Inherited Members | |
Protected Attributes inherited from ndn::security::v2::TrustAnchorGroup | |
CertContainerInterface & | m_certs |
std::set< Name > | m_anchorNames |
Dynamic trust anchor group.
Definition at line 120 of file trust-anchor-group.hpp.
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.
certContainer | A certificate container into which trust anchors from the group will be added |
id | Group id |
path | File path for trust anchor(s), could be directory or file. If it is a directory, all the certificates in the directory will be loaded. |
refreshPeriod | Refresh time for the anchors under path , must be positive. |
isDir | Tells whether the path is a directory or a single file. |
std::invalid_argument | refreshPeriod is negative |
Definition at line 89 of file trust-anchor-group.cpp.
References NDN_LOG_TRACE, NDN_THROW, and refresh().
|
overridevirtual |
Request certificate refresh.
Reimplemented from ndn::security::v2::TrustAnchorGroup.
Definition at line 107 of file trust-anchor-group.cpp.
References ndn::security::v2::CertContainerInterface::add(), ndn::security::v2::TrustAnchorGroup::m_anchorNames, ndn::security::v2::TrustAnchorGroup::m_certs, nonstd::optional_lite::std11::move(), NDN_LOG_TRACE, ndn::time::steady_clock::now(), and ndn::security::v2::CertContainerInterface::remove().
Referenced by DynamicTrustAnchorGroup().