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

The DynamicTrustAnchorGroup class extends TrustAnchorGroup to implement a dynamic trust anchor group. More...

#include <trust-anchor-group.hpp>

Inheritance diagram for ndn::DynamicTrustAnchorGroup:
ndn::TrustAnchorGroup

Public Member Functions

 DynamicTrustAnchorGroup (CertificateContainerInterface &certificateContainer, const std::string &id, const std::string &path, Milliseconds refreshPeriod, bool isDirectory=false)
 Create a dynamic trust anchor group. More...
 
virtual void refresh ()
 Request a certificate refresh.
 
- Public Member Functions inherited from ndn::TrustAnchorGroup
 TrustAnchorGroup (CertificateContainerInterface &certificateContainer, const std::string &id)
 Create a TrustAnchorGroup to use an existing container. More...
 
const std::string & getId () const
 Get the group id given to the constructor. More...
 
size_t size () const
 Get the number of certificates in the group. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ndn::TrustAnchorGroup
static ptr_lib::shared_ptr
< CertificateV2
readCertificate (const std::string &filePath)
 Read a base-64-encoded certificate from a file. More...
 
- Protected Attributes inherited from ndn::TrustAnchorGroup
CertificateContainerInterfacecertificates_
 
std::set< NameanchorNames_
 

Detailed Description

The DynamicTrustAnchorGroup class extends TrustAnchorGroup to implement a dynamic trust anchor group.

Constructor & Destructor Documentation

ndn::DynamicTrustAnchorGroup::DynamicTrustAnchorGroup ( CertificateContainerInterface certificateContainer,
const std::string &  id,
const std::string &  path,
Milliseconds  refreshPeriod,
bool  isDirectory = false 
)

Create a dynamic trust anchor group.

This loads all the certificates from the path and will refresh certificates every refreshPeriod milliseconds.

Note that refresh is not scheduled, but is performed upon each "find" operations.

When isDirectory is false and the path doesn't point to a valid certificate (the file doesn't exist or the content is not a valid certificate), then the dynamic anchor group will be empty until the file gets created. If the file disappears or gets corrupted, the anchor group becomes empty.

When isDirectory is true and the path doesn't point to a valid folder, the folder is empty, or it doesn't contain valid certificates, then the group will be empty until certificate files are placed in the folder. If the folder is removed, becomes empty, or no longer contains valid certificates, then the anchor group becomes empty.

Upon refresh, the existing certificates are not changed.

Parameters
certificateContainerA certificate container into which trust anchors from the group will be added.
idThe group id.
pathThe file path for trust anchor(s), which could be a directory or a file. If it is a directory, all the certificates in the directory will be loaded.
refreshPeriodThe refresh time in milliseconds for the anchors under path. This must be positive.
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.

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