27 TrustAnchorContainer::AnchorContainer::add(Certificate&& cert)
29 AnchorContainerBase::insert(std::move(cert));
33 TrustAnchorContainer::AnchorContainer::remove(
const Name& certName)
35 AnchorContainerBase::erase(certName);
39 TrustAnchorContainer::AnchorContainer::clear()
41 AnchorContainerBase::clear();
47 auto group = m_groups.find(groupId);
48 if (group == m_groups.end()) {
49 std::tie(group, std::ignore) = m_groups.insert(std::make_shared<StaticTrustAnchorGroup>(m_anchors,
53 if (staticGroup ==
nullptr) {
54 NDN_THROW(
Error(
"Cannot add static anchor to a non-static anchor group " + groupId));
56 staticGroup->add(std::move(cert));
63 if (m_groups.count(groupId) != 0) {
64 NDN_THROW(
Error(
"Cannot create dynamic group, because group " + groupId +
" already exists"));
67 m_groups.insert(std::make_shared<DynamicTrustAnchorGroup>(m_anchors, groupId, path,
68 refreshPeriod, isDir));
83 auto cert = m_anchors.lower_bound(keyName);
84 if (cert == m_anchors.end() || !keyName.
isPrefixOf(cert->getName()))
95 for (
auto cert = m_anchors.lower_bound(interest.
getName());
108 auto group = m_groups.find(groupId);
109 if (group == m_groups.end()) {
110 NDN_THROW(
Error(
"Trust anchor group " + groupId +
" does not exist"));
118 return m_anchors.size();
122 TrustAnchorContainer::refresh()
124 for (
auto it = m_groups.begin(); it != m_groups.end(); ++it) {
125 m_groups.modify(it, [] (
const auto& group) { group->refresh(); });
Represents an Interest packet.
const Name & getName() const noexcept
Get the Interest name.
bool matchesData(const Data &data) const
Check if this Interest can be satisfied by data.
Represents an absolute name.
bool isPrefixOf(const Name &other) const noexcept
Check if this name is a prefix of another name.
Represents an NDN certificate.
Static trust anchor group.
A container for trust anchors.
const Certificate * find(const Name &keyName) const
Search for certificate across all groups (longest prefix match).
void insert(const std::string &groupId, Certificate &&cert)
Insert a static trust anchor.
size_t size() const
Get number of trust anchors across all groups.
TrustAnchorGroup & getGroup(const std::string &groupId) const
Get trusted anchor group.
void clear()
Remove all static or dynamic anchors.
A group of trust anchors.
Contains the ndn-cxx security framework.
::boost::chrono::nanoseconds nanoseconds