represents a container for trust anchors. More...
#include <ndn-cxx/security/trust-anchor-container.hpp>
Classes | |
class | Error |
Public Member Functions | |
void | clear () |
Remove all static or dynamic anchors. More... | |
const Certificate * | find (const Name &keyName) const |
Search for certificate across all groups (longest prefix match) More... | |
const Certificate * | find (const Interest &interest) const |
Find certificate given interest. More... | |
TrustAnchorGroup & | getGroup (const std::string &groupId) const |
Get trusted anchor group. More... | |
void | insert (const std::string &groupId, Certificate &&cert) |
Insert a static trust anchor. More... | |
void | insert (const std::string &groupId, const boost::filesystem::path &path, time::nanoseconds refreshPeriod, bool isDir=false) |
Insert dynamic trust anchors from path. More... | |
size_t | size () const |
Get number of trust anchors across all groups. More... | |
represents a container for trust anchors.
There are two kinds of anchors:
Trust anchors are organized in groups. Each group has a unique group id. The same anchor certificate (same name without considering the implicit digest) can be inserted into multiple groups, but no more than once into each.
Dynamic groups are created using the appropriate TrustAnchorContainer::insert method. Once created, the dynamic anchor group cannot be updated.
The returned pointer to Certificate from find
methods is only guaranteed to be valid until the next invocation of find
and may be invalidated afterwards.
Definition at line 55 of file trust-anchor-container.hpp.
void ndn::security::v2::TrustAnchorContainer::clear | ( | ) |
Remove all static or dynamic anchors.
Definition at line 76 of file trust-anchor-container.cpp.
const Certificate * ndn::security::v2::TrustAnchorContainer::find | ( | const Name & | keyName | ) | const |
Search for certificate across all groups (longest prefix match)
keyName | Key name prefix for searching the certificate. |
find
methods. Definition at line 83 of file trust-anchor-container.cpp.
const Certificate * ndn::security::v2::TrustAnchorContainer::find | ( | const Interest & | interest | ) | const |
Find certificate given interest.
interest | The input interest packet. |
find
methods.Definition at line 95 of file trust-anchor-container.cpp.
TrustAnchorGroup & ndn::security::v2::TrustAnchorContainer::getGroup | ( | const std::string & | groupId | ) | const |
Get trusted anchor group.
Error | groupId does not exist |
Definition at line 110 of file trust-anchor-container.cpp.
void ndn::security::v2::TrustAnchorContainer::insert | ( | const std::string & | groupId, |
Certificate && | cert | ||
) |
Insert a static trust anchor.
groupId | Certificate group id. |
cert | Certificate to insert. |
If cert
(same name without considering implicit digest) already exists in the group groupId
, this method has no effect.
Error | groupId is a dynamic anchor group . |
Definition at line 49 of file trust-anchor-container.cpp.
void ndn::security::v2::TrustAnchorContainer::insert | ( | const std::string & | groupId, |
const boost::filesystem::path & | path, | ||
time::nanoseconds | refreshPeriod, | ||
bool | isDir = false |
||
) |
Insert dynamic trust anchors from path.
groupId | Certificate group id, must not be empty. |
path | Specifies the path to load the trust anchors. |
refreshPeriod | Refresh period for the trust anchors, must be positive. Relevant trust anchors will only be updated when find is called |
isDir | Tells whether the path is a directory or a single file. |
std::invalid_argument | refreshPeriod is not positive |
Error | a group with groupId already exists |
Definition at line 64 of file trust-anchor-container.cpp.
size_t ndn::security::v2::TrustAnchorContainer::size | ( | ) | const |
Get number of trust anchors across all groups.
Definition at line 120 of file trust-anchor-container.cpp.