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

PibMemory extends PibImpl and is used by the Pib class as an in-memory implementation of a PIB. More...

#include <pib-memory.hpp>

Inheritance diagram for ndn::PibMemory:
ndn::PibImpl

Public Member Functions

 PibMemory ()
 Create a default PibMemory with no values.
 
virtual void setTpmLocator (const std::string &tpmLocator)
 Set the corresponding TPM information to tpmLocator. More...
 
virtual std::string getTpmLocator () const
 Get the TPM Locator. More...
 
virtual bool hasIdentity (const Name &identityName) const
 Check for the existence of an identity. More...
 
virtual void addIdentity (const Name &identityName)
 Add the identity. More...
 
virtual void removeIdentity (const Name &identityName)
 Remove the identity and its related keys and certificates. More...
 
virtual void clearIdentities ()
 Erase all certificates, keys, and identities.
 
virtual std::set< NamegetIdentities () const
 Get the names of all the identities. More...
 
virtual void setDefaultIdentity (const Name &identityName)
 Set the identity with the identityName as the default identity. More...
 
virtual Name getDefaultIdentity () const
 Get the default identity. More...
 
virtual bool hasKey (const Name &keyName) const
 Check for the existence of a key with keyName. More...
 
virtual void addKey (const Name &identityName, const Name &keyName, const uint8_t *key, size_t keyLength)
 Add the key. More...
 
virtual void removeKey (const Name &keyName)
 Remove the key with keyName and its related certificates. More...
 
virtual Blob getKeyBits (const Name &keyName) const
 Get the key bits of a key with name keyName. More...
 
virtual std::set< NamegetKeysOfIdentity (const Name &identityName) const
 Get all the key names of the identity with the name identityName. More...
 
virtual void setDefaultKeyOfIdentity (const Name &identityName, const Name &keyName)
 Set the key with keyName as the default key for the identity with name identityName. More...
 
virtual Name getDefaultKeyOfIdentity (const Name &identityName) const
 Get the name of the default key for the identity with name identityName. More...
 
virtual bool hasCertificate (const Name &certificateName) const
 Check for the existence of a certificate with name certificateName. More...
 
virtual void addCertificate (const CertificateV2 &certificate)
 Add the certificate. More...
 
virtual void removeCertificate (const Name &certificateName)
 Remove the certificate with name certificateName. More...
 
virtual ptr_lib::shared_ptr
< CertificateV2
getCertificate (const Name &certificateName) const
 Get the certificate with name certificateName. More...
 
virtual std::set< NamegetCertificatesOfKey (const Name &keyName) const
 Get a list of certificate names of the key with id keyName. More...
 
virtual void setDefaultCertificateOfKey (const Name &keyName, const Name &certificateName)
 Set the cert with name certificateName as the default for the key with keyName. More...
 
virtual ptr_lib::shared_ptr
< CertificateV2
getDefaultCertificateOfKey (const Name &keyName) const
 Get the default certificate for the key with eyName. More...
 

Static Public Member Functions

static std::string getScheme ()
 

Detailed Description

PibMemory extends PibImpl and is used by the Pib class as an in-memory implementation of a PIB.

All the contents in the PIB are stored in memory and have the same lifetime as the PibMemory instance.

Member Function Documentation

void ndn::PibMemory::addCertificate ( const CertificateV2 certificate)
virtual

Add the certificate.

If a certificate with the same name (without implicit digest) already exists, then overwrite the certificate. If the key or identity does not exist, they will be created. If no default certificate for the key has been set, then set the added certificate as the default for the key. If no default key was set for the identity, it will be set as the default key for the identity. If no default identity was selected, the certificate's identity becomes the default.

Parameters
certificateThe certificate to add. This copies the object.

Implements ndn::PibImpl.

void ndn::PibMemory::addIdentity ( const Name identityName)
virtual

Add the identity.

If the identity already exists, do nothing. If no default identity has been set, set the added identity as the default.

Parameters
identityNameThe name of the identity to add. This copies the name.

Implements ndn::PibImpl.

void ndn::PibMemory::addKey ( const Name identityName,
const Name keyName,
const uint8_t *  key,
size_t  keyLength 
)
virtual

Add the key.

If a key with the same name already exists, overwrite the key. If the identity does not exist, it will be created. If no default key for the identity has been set, then set the added key as the default for the identity. If no default identity has been set, identity becomes the default.

Parameters
identityNameThe name of the identity that the key belongs to. This copies the name.
keyNameThe name of the key. This copies the name.
keyThe public key bits. This copies the array.
keyLengthThe length of the public key bits array.

Implements ndn::PibImpl.

ptr_lib::shared_ptr< CertificateV2 > ndn::PibMemory::getCertificate ( const Name certificateName) const
virtual

Get the certificate with name certificateName.

Parameters
certificateNameThe name of the certificate.
Returns
A copy of the certificate.
Exceptions
Pib::Errorif the certificate does not exist.

Implements ndn::PibImpl.

std::set< Name > ndn::PibMemory::getCertificatesOfKey ( const Name keyName) const
virtual

Get a list of certificate names of the key with id keyName.

The returned certificate names can be used to create a PibCertificateContainer. With a certificate name and a backend implementation, one can obtain the certificate.

Parameters
keyNameThe name of the key.
Returns
The set of certificate names. The Name objects are fresh copies. If the key does not exist, return an empty set.

Implements ndn::PibImpl.

ptr_lib::shared_ptr< CertificateV2 > ndn::PibMemory::getDefaultCertificateOfKey ( const Name keyName) const
virtual

Get the default certificate for the key with eyName.

Parameters
keyNameThe name of the key.
Returns
A copy of the default certificate.
Exceptions
Pib::Errorif the default certificate does not exist.

Implements ndn::PibImpl.

Name ndn::PibMemory::getDefaultIdentity ( ) const
virtual

Get the default identity.

Returns
The name of the default identity, as a fresh copy.
Exceptions
Pib::Errorfor no default identity.

Implements ndn::PibImpl.

Name ndn::PibMemory::getDefaultKeyOfIdentity ( const Name identityName) const
virtual

Get the name of the default key for the identity with name identityName.

Parameters
identityNameThe name of the identity.
Returns
The name of the default key, as a fresh copy.
Exceptions
Pib::Errorif there is no default key or if the identity does not exist.

Implements ndn::PibImpl.

set< Name > ndn::PibMemory::getIdentities ( ) const
virtual

Get the names of all the identities.

Returns
The set of identity names. The Name objects are fresh copies.

Implements ndn::PibImpl.

Blob ndn::PibMemory::getKeyBits ( const Name keyName) const
virtual

Get the key bits of a key with name keyName.

Parameters
keyNameThe name of the key.
Returns
The key bits.
Exceptions
Pib::Errorif the key does not exist.

Implements ndn::PibImpl.

set< Name > ndn::PibMemory::getKeysOfIdentity ( const Name identityName) const
virtual

Get all the key names of the identity with the name identityName.

The returned key names can be used to create a KeyContainer. With a key name and a backend implementation, one can create a Key front end instance.

Parameters
identityNameThe name of the identity.
Returns
The set of key names. The Name objects are fresh copies. If the identity does not exist, return an empty set.

Implements ndn::PibImpl.

string ndn::PibMemory::getTpmLocator ( ) const
virtual

Get the TPM Locator.

Returns
The TPM locator string.

Implements ndn::PibImpl.

bool ndn::PibMemory::hasCertificate ( const Name certificateName) const
virtual

Check for the existence of a certificate with name certificateName.

Parameters
certificateNameThe name of the certificate.
Returns
True if the certificate exists, otherwise false.

Implements ndn::PibImpl.

bool ndn::PibMemory::hasIdentity ( const Name identityName) const
virtual

Check for the existence of an identity.

Parameters
identityNameThe name of the identity.
Returns
True if the identity exists, otherwise false.

Implements ndn::PibImpl.

bool ndn::PibMemory::hasKey ( const Name keyName) const
virtual

Check for the existence of a key with keyName.

Parameters
keyNameThe name of the key.
Returns
True if the key exists, otherwise false. Return false if the identity does not exist.

Implements ndn::PibImpl.

void ndn::PibMemory::removeCertificate ( const Name certificateName)
virtual

Remove the certificate with name certificateName.

If the certificate does not exist, do nothing.

Parameters
certificateNameThe name of the certificate.

Implements ndn::PibImpl.

void ndn::PibMemory::removeIdentity ( const Name identityName)
virtual

Remove the identity and its related keys and certificates.

If the default identity is being removed, no default identity will be selected. If the identity does not exist, do nothing.

Parameters
identityNameThe name of the identity to remove.

Implements ndn::PibImpl.

void ndn::PibMemory::removeKey ( const Name keyName)
virtual

Remove the key with keyName and its related certificates.

If the key does not exist, do nothing.

Parameters
keyNameThe name of the key.

Implements ndn::PibImpl.

void ndn::PibMemory::setDefaultCertificateOfKey ( const Name keyName,
const Name certificateName 
)
virtual

Set the cert with name certificateName as the default for the key with keyName.

Parameters
keyNameThe name of the key.
certificateNameThe name of the certificate. This copies the name.
Exceptions
Pib::Errorif the certificate with name certificateName does not exist.

Implements ndn::PibImpl.

void ndn::PibMemory::setDefaultIdentity ( const Name identityName)
virtual

Set the identity with the identityName as the default identity.

If the identity with identityName does not exist, then it will be created.

Parameters
identityNameThe name for the default identity. This copies the name.

Implements ndn::PibImpl.

void ndn::PibMemory::setDefaultKeyOfIdentity ( const Name identityName,
const Name keyName 
)
virtual

Set the key with keyName as the default key for the identity with name identityName.

Parameters
identityNameThe name of the identity.
keyNameThe name of the key. This copies the name.
Exceptions
Pib::Errorif the key does not exist.

Implements ndn::PibImpl.

void ndn::PibMemory::setTpmLocator ( const std::string &  tpmLocator)
virtual

Set the corresponding TPM information to tpmLocator.

This method does not reset the contents of the PIB.

Parameters
tpmLocatorThe TPM locator string.

Implements ndn::PibImpl.


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