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

The CertificateStorage class stores trusted anchors and has a verified certificate cache, and an unverified certificate cache. More...

#include <certificate-storage.hpp>

Inheritance diagram for ndn::CertificateStorage:
ndn::Validator ndn::ValidatorConfig ndn::ValidatorNull

Public Member Functions

ptr_lib::shared_ptr
< CertificateV2
findTrustedCertificate (const Interest &interestForCertificate)
 Find a trusted certificate in the trust anchor container or in the verified cache. More...
 
bool isCertificateKnown (const Name &certificatePrefix)
 Check if the certificate with the given name prefix exists in the verified cache, the unverified cache, or in the set of trust anchors. More...
 
void cacheUnverifiedCertificate (const CertificateV2 &certificate)
 Cache the unverified certificate for a period of time (5 minutes). More...
 
const TrustAnchorContainergetTrustAnchors () const
 Get the trust anchor container. More...
 
const CertificateCacheV2getVerifiedCertificateCache () const
 Get the verified certificate cache. More...
 
const CertificateCacheV2getUnverifiedCertificateCache () const
 Get the unverified certificate cache. More...
 
void loadAnchor (const std::string &groupId, const CertificateV2 &certificate)
 Load a static trust anchor. More...
 
void loadAnchor (const std::string &groupId, const std::string &path, Milliseconds refreshPeriod, bool isDirectory=false)
 Load dynamic trust anchors. More...
 
void resetAnchors ()
 Remove any previously loaded static or dynamic trust anchors.
 
void cacheVerifiedCertificate (const CertificateV2 &certificate)
 Cache the verified certificate a period of time (1 hour). More...
 
void resetVerifiedCertificates ()
 Remove any cached verified certificates.
 
void setCacheNowOffsetMilliseconds_ (Milliseconds nowOffsetMilliseconds)
 Set the offset when the cache insert() and refresh() get the current time, which should only be used for testing. More...
 

Protected Attributes

TrustAnchorContainer trustAnchors_
 
CertificateCacheV2 verifiedCertificateCache_
 
CertificateCacheV2 unverifiedCertificateCache_
 

Detailed Description

The CertificateStorage class stores trusted anchors and has a verified certificate cache, and an unverified certificate cache.

Member Function Documentation

void ndn::CertificateStorage::cacheUnverifiedCertificate ( const CertificateV2 certificate)
inline

Cache the unverified certificate for a period of time (5 minutes).

Parameters
certificateThe certificate packet, which is copied.
void ndn::CertificateStorage::cacheVerifiedCertificate ( const CertificateV2 certificate)
inline

Cache the verified certificate a period of time (1 hour).

Parameters
certificateThe certificate object, which is copied.
ptr_lib::shared_ptr< CertificateV2 > ndn::CertificateStorage::findTrustedCertificate ( const Interest interestForCertificate)

Find a trusted certificate in the trust anchor container or in the verified cache.

Parameters
interestForCertificateThe Interest for the certificate.
Returns
The found certificate, or null if not found.
const TrustAnchorContainer& ndn::CertificateStorage::getTrustAnchors ( ) const
inline

Get the trust anchor container.

Returns
The trust anchor container.
const CertificateCacheV2& ndn::CertificateStorage::getUnverifiedCertificateCache ( ) const
inline

Get the unverified certificate cache.

Returns
The unverified certificate cache.
const CertificateCacheV2& ndn::CertificateStorage::getVerifiedCertificateCache ( ) const
inline

Get the verified certificate cache.

Returns
The verified certificate cache.
bool ndn::CertificateStorage::isCertificateKnown ( const Name certificatePrefix)

Check if the certificate with the given name prefix exists in the verified cache, the unverified cache, or in the set of trust anchors.

Parameters
certificatePrefixThe certificate name prefix.
Returns
True if the certificate is known.
void ndn::CertificateStorage::loadAnchor ( const std::string &  groupId,
const CertificateV2 certificate 
)
inline

Load a static trust anchor.

Static trust anchors are permanently associated with the validator and never expire.

Parameters
groupIdThe certificate group id.
certificateThe certificate to load as a trust anchor, which is copied.
void ndn::CertificateStorage::loadAnchor ( const std::string &  groupId,
const std::string &  path,
Milliseconds  refreshPeriod,
bool  isDirectory = false 
)
inline

Load dynamic trust anchors.

Dynamic trust anchors are associated with the validator for as long as the underlying trust anchor file (or set of files) exists.

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
void ndn::CertificateStorage::setCacheNowOffsetMilliseconds_ ( Milliseconds  nowOffsetMilliseconds)
inline

Set the offset when the cache insert() and refresh() get the current time, which should only be used for testing.

Parameters
nowOffsetMillisecondsThe offset in milliseconds.

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