26#include <boost/range/adaptor/map.hpp>
27#include <boost/range/algorithm/copy.hpp>
28#include <boost/range/iterator_range.hpp>
35 : m_certs(certContainer)
82 const std::string&
id,
83 const std::filesystem::path& path,
88 , m_refreshPeriod(refreshPeriod)
90 if (refreshPeriod <= time::nanoseconds::zero()) {
91 NDN_THROW(std::runtime_error(
"Refresh period for the dynamic group must be positive"));
94 NDN_LOG_TRACE(
"Create dynamic trust anchor group " <<
id <<
" for file/dir " << path
95 <<
" with refresh time " << refreshPeriod);
110 auto loadCert = [
this, &oldAnchorNames] (
const std::filesystem::path& file) {
111 auto cert = io::load<Certificate>(file);
112 if (cert !=
nullptr) {
118 oldAnchorNames.erase(cert->getName());
126 else if (std::filesystem::exists(m_path)) {
127 for (
const auto& entry : std::filesystem::directory_iterator(m_path)) {
133 for (
const auto& oldAnchorName : oldAnchorNames) {
Represents an absolute name.
virtual void remove(const Name &certName)=0
virtual void add(Certificate &&cert)=0
Represents an NDN certificate.
DynamicTrustAnchorGroup(CertContainerInterface &certContainer, const std::string &id, const std::filesystem::path &path, time::nanoseconds refreshPeriod, bool isDir=false)
Create a dynamic trust anchor group.
void refresh() override
Request certificate refresh.
void add(Certificate &&cert)
Load static anchor cert.
void remove(const Name &certName)
Remove static anchor certName.
StaticTrustAnchorGroup(CertContainerInterface &certContainer, const std::string &id)
Create a static trust anchor group.
A group of trust anchors.
TrustAnchorGroup(CertContainerInterface &certContainer, const std::string &id)
Create an anchor group.
virtual ~TrustAnchorGroup()
CertContainerInterface & m_certs
std::set< Name > m_anchorNames
virtual void refresh()
Request certificate refresh.
static time_point now() noexcept
#define NDN_LOG_TRACE(expression)
Log at TRACE level.
#define NDN_LOG_INIT(name)
Define a non-member log module.
Contains the ndn-cxx security framework.
::boost::chrono::nanoseconds nanoseconds