The DynamicTrustAnchorGroup class extends TrustAnchorGroup to implement a dynamic trust anchor group. More...
#include <trust-anchor-group.hpp>
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 | |
| CertificateContainerInterface & | certificates_ |
| std::set< Name > | anchorNames_ |
The DynamicTrustAnchorGroup class extends TrustAnchorGroup to implement a dynamic trust anchor group.
| 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.
| certificateContainer | A certificate container into which trust anchors from the group will be added. |
| id | The group id. |
| path | The 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. |
| refreshPeriod | The 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. |
| std::invalid_argument | If refreshPeriod is not positive. |
1.8.6