A TrustAnchorContainer represents a container for trust anchors. More...
#include <trust-anchor-container.hpp>
Classes | |
| class | Error |
Public Member Functions | |
| void | insert (const std::string &groupId, const CertificateV2 &certificate) |
| Insert a static trust anchor. More... | |
| void | insert (const std::string &groupId, const std::string &path, Milliseconds refreshPeriod, bool isDirectory=false) |
| Insert dynamic trust anchors from the path. More... | |
| void | clear () |
| Remove all static and dynamic anchors. | |
| ptr_lib::shared_ptr < CertificateV2 > | find (const Name &keyName) const |
| Search for a certificate across all groups (longest prefix match). More... | |
| ptr_lib::shared_ptr < CertificateV2 > | find (const Interest &interest) const |
| Find a certificate for the given interest. More... | |
| TrustAnchorGroup & | getGroup (const std::string &groupId) |
| Get the trust anchor group for the groupId. More... | |
| size_t | size () const |
| Get the number of trust anchors across all groups. More... | |
A TrustAnchorContainer represents a container for trust anchors.
There are two kinds of anchors: static anchors that are permanent for the lifetime of the container, and dynamic anchors that are periodically updated.
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.
| ptr_lib::shared_ptr< CertificateV2 > ndn::TrustAnchorContainer::find | ( | const Name & | keyName | ) | const |
Search for a certificate across all groups (longest prefix match).
| keyName | The key name prefix for searching for the certificate. |
| ptr_lib::shared_ptr< CertificateV2 > ndn::TrustAnchorContainer::find | ( | const Interest & | interest | ) | const |
Find a certificate for the given interest.
| interest | The input interest packet. |
| TrustAnchorGroup & ndn::TrustAnchorContainer::getGroup | ( | const std::string & | groupId | ) |
Get the trust anchor group for the groupId.
| groupId | The group ID. |
| TrustAnchorContainer::Error | if the groupId does not exist. |
| void ndn::TrustAnchorContainer::insert | ( | const std::string & | groupId, |
| const CertificateV2 & | certificate | ||
| ) |
Insert a static trust anchor.
If the certificate (having the same name without considering implicit digest) already exists in the group with groupId, then do nothing.
| groupId | The certificate group id. |
| certificate | The certificate to insert, which is copied. |
| TrustAnchorContainer::Error | If groupId is a dynamic anchor group . |
| void ndn::TrustAnchorContainer::insert | ( | const std::string & | groupId, |
| const std::string & | path, | ||
| Milliseconds | refreshPeriod, | ||
| bool | isDirectory = false |
||
| ) |
Insert dynamic trust anchors from the path.
| groupId | The certificate group id, which must not be empty. |
| path | The path to load the trust anchors. |
| refreshPeriod | The refresh time in milliseconds for the anchors under path. This must be positive. The relevant trust anchors will only be updated when find is called. |
| isDirectory | (optional) If true, then path is a directory. If false or omitted, it is a single file. |
| std::invalid_argument | If refreshPeriod is not positive. |
| TrustAnchorContainer::Error | a group with groupId already exists |
|
inline |
Get the number of trust anchors across all groups.
1.8.6