All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | List of all members
ndn::TrustAnchorContainer Class Reference

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...
 
TrustAnchorGroupgetGroup (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...
 

Detailed Description

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.

Member Function Documentation

ptr_lib::shared_ptr< CertificateV2 > ndn::TrustAnchorContainer::find ( const Name keyName) const

Search for a certificate across all groups (longest prefix match).

Parameters
keyNameThe key name prefix for searching for the certificate.
Returns
The found certificate, or null if not found.
ptr_lib::shared_ptr< CertificateV2 > ndn::TrustAnchorContainer::find ( const Interest interest) const

Find a certificate for the given interest.

Parameters
interestThe input interest packet.
Returns
The found certificate, or null if not found.
Note
Interest with implicit digest is not supported.
ChildSelector is not supported.
TrustAnchorGroup & ndn::TrustAnchorContainer::getGroup ( const std::string &  groupId)

Get the trust anchor group for the groupId.

Parameters
groupIdThe group ID.
Returns
The trust anchor group.
Exceptions
TrustAnchorContainer::Errorif 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.

Parameters
groupIdThe certificate group id.
certificateThe certificate to insert, which is copied.
Exceptions
TrustAnchorContainer::ErrorIf 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.

Parameters
groupIdThe certificate group id, which must not be empty.
pathThe path to load the trust anchors.
refreshPeriodThe 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.
Exceptions
std::invalid_argumentIf refreshPeriod is not positive.
TrustAnchorContainer::Errora group with groupId already exists
size_t ndn::TrustAnchorContainer::size ( ) const
inline

Get the number of trust anchors across all groups.

Returns
The number of trust anchors.

The documentation for this class was generated from the following files: