NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::pib::PibImpl Class Referenceabstract

Abstract class of PIB implementation. More...

#include <pib-impl.hpp>

Inheritance diagram for ndn::security::pib::PibImpl:
Collaboration diagram for ndn::security::pib::PibImpl:

Classes

class  Error
 represents a non-semantic error More...
 

Public Member Functions

virtual ~PibImpl ()=default
 
virtual void setTpmLocator (const std::string &tpmLocator)=0
 Set the corresponding TPM information to tpmLocator. More...
 
virtual std::string getTpmLocator () const =0
 Get TPM Locator. More...
 
virtual bool hasIdentity (const Name &identity) const =0
 Check the existence of an identity. More...
 
virtual void addIdentity (const Name &identity)=0
 Add an identity. More...
 
virtual void removeIdentity (const Name &identity)=0
 Remove an identity and related keys and certificates. More...
 
virtual void clearIdentities ()=0
 Erasing all certificates, keys, and identities. More...
 
virtual std::set< NamegetIdentities () const =0
 Get the name of all the identities. More...
 
virtual void setDefaultIdentity (const Name &identityName)=0
 Set an identity with name identityName as the default identity. More...
 
virtual Name getDefaultIdentity () const =0
 Get the default identity. More...
 
virtual bool hasKey (const Name &keyName) const =0
 Check the existence of a key with keyName. More...
 
virtual void addKey (const Name &identity, const Name &keyName, span< const uint8_t > key)=0
 Add a key. More...
 
virtual void removeKey (const Name &keyName)=0
 Remove a key with keyName and related certificates. More...
 
virtual Buffer getKeyBits (const Name &keyName) const =0
 Get the key bits of a key with name keyName. More...
 
virtual std::set< NamegetKeysOfIdentity (const Name &identity) const =0
 Get all the key names of an identity with name identity. More...
 
virtual void setDefaultKeyOfIdentity (const Name &identity, const Name &keyName)=0
 Set an key with keyName as the default key of an identity with name identity. More...
 
virtual Name getDefaultKeyOfIdentity (const Name &identity) const =0
 
virtual bool hasCertificate (const Name &certName) const =0
 Check the existence of a certificate with name certName. More...
 
virtual void addCertificate (const Certificate &certificate)=0
 Add a certificate. More...
 
virtual void removeCertificate (const Name &certName)=0
 Remove a certificate with name certName. More...
 
virtual Certificate getCertificate (const Name &certName) const =0
 Get a certificate with name certName. More...
 
virtual std::set< NamegetCertificatesOfKey (const Name &keyName) const =0
 Get a list of certificate names of a key with id keyName. More...
 
virtual void setDefaultCertificateOfKey (const Name &keyName, const Name &certName)=0
 Set a cert with name certName as the default of a key with keyName. More...
 
virtual Certificate getDefaultCertificateOfKey (const Name &keyName) const =0
 

Detailed Description

Abstract class of PIB implementation.

This class defines the interface that an actual PIB (e.g., one based on sqlite3) implementation should provide.

Definition at line 40 of file pib-impl.hpp.

Constructor & Destructor Documentation

◆ ~PibImpl()

virtual ndn::security::pib::PibImpl::~PibImpl ( )
virtualdefault

Member Function Documentation

◆ setTpmLocator()

virtual void ndn::security::pib::PibImpl::setTpmLocator ( const std::string &  tpmLocator)
pure virtual

Set the corresponding TPM information to tpmLocator.

This method does not reset contents of the PIB

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getTpmLocator()

virtual std::string ndn::security::pib::PibImpl::getTpmLocator ( ) const
pure virtual

◆ hasIdentity()

virtual bool ndn::security::pib::PibImpl::hasIdentity ( const Name identity) const
pure virtual

Check the existence of an identity.

Parameters
identityThe name of the identity.
Returns
true if the identity exists, otherwise false.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ addIdentity()

virtual void ndn::security::pib::PibImpl::addIdentity ( const Name identity)
pure virtual

Add an identity.

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

Parameters
identityThe name of the identity to add.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ removeIdentity()

virtual void ndn::security::pib::PibImpl::removeIdentity ( const Name identity)
pure virtual

Remove an identity and 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
identityThe name of the identity to remove.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ clearIdentities()

virtual void ndn::security::pib::PibImpl::clearIdentities ( )
pure virtual

Erasing all certificates, keys, and identities.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getIdentities()

virtual std::set<Name> ndn::security::pib::PibImpl::getIdentities ( ) const
pure virtual

Get the name of all the identities.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ setDefaultIdentity()

virtual void ndn::security::pib::PibImpl::setDefaultIdentity ( const Name identityName)
pure virtual

Set an identity with name identityName as the default identity.

Parameters
identityNameThe name for the default identity.
Exceptions
ErrorIf identityName identity does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getDefaultIdentity()

virtual Name ndn::security::pib::PibImpl::getDefaultIdentity ( ) const
pure virtual

Get the default identity.

Returns
The name for the default identity.
Exceptions
Pib::Errorno default identity.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ hasKey()

virtual bool ndn::security::pib::PibImpl::hasKey ( const Name keyName) const
pure virtual

Check the existence of a key with keyName.

Returns
true if the key exists, otherwise false. Return false if the identity does not exist

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ addKey()

virtual void ndn::security::pib::PibImpl::addKey ( const Name identity,
const Name keyName,
span< const uint8_t >  key 
)
pure virtual

Add a 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 of the identity has been set, set the added one as default key of the identity. If no default identity has been set, identity becomes the default.

Parameters
identityThe name of the identity that will own the added key.
keyNameThe key name.
keyThe public key bits.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ removeKey()

virtual void ndn::security::pib::PibImpl::removeKey ( const Name keyName)
pure virtual

Remove a key with keyName and related certificates.

If the key does not exist, do nothing.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getKeyBits()

virtual Buffer ndn::security::pib::PibImpl::getKeyBits ( const Name keyName) const
pure virtual

Get the key bits of a key with name keyName.

Returns
key bits
Exceptions
Pib::Errorthe key does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getKeysOfIdentity()

virtual std::set<Name> ndn::security::pib::PibImpl::getKeysOfIdentity ( const Name identity) const
pure virtual

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

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

Returns
the key name component set. If the identity does not exist, return an empty set.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ setDefaultKeyOfIdentity()

virtual void ndn::security::pib::PibImpl::setDefaultKeyOfIdentity ( const Name identity,
const Name keyName 
)
pure virtual

Set an key with keyName as the default key of an identity with name identity.

Exceptions
Pib::Errorthe key does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getDefaultKeyOfIdentity()

virtual Name ndn::security::pib::PibImpl::getDefaultKeyOfIdentity ( const Name identity) const
pure virtual
Returns
The name of the default key of an identity with name identity.
Exceptions
Pib::Errorno default key or the identity does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ hasCertificate()

virtual bool ndn::security::pib::PibImpl::hasCertificate ( const Name certName) const
pure virtual

Check the existence of a certificate with name certName.

Parameters
certNameThe name of the certificate.
Returns
true if the certificate exists, otherwise false.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ addCertificate()

virtual void ndn::security::pib::PibImpl::addCertificate ( const Certificate &  certificate)
pure virtual

Add a certificate.

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

Parameters
certificateThe certificate to add.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ removeCertificate()

virtual void ndn::security::pib::PibImpl::removeCertificate ( const Name certName)
pure virtual

Remove a certificate with name certName.

If the certificate does not exist, do nothing.

Parameters
certNameThe name of the certificate.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getCertificate()

virtual Certificate ndn::security::pib::PibImpl::getCertificate ( const Name certName) const
pure virtual

Get a certificate with name certName.

Parameters
certNameThe name of the certificate.
Returns
the certificate.
Exceptions
Pib::Errorthe certificate does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getCertificatesOfKey()

virtual std::set<Name> ndn::security::pib::PibImpl::getCertificatesOfKey ( const Name keyName) const
pure virtual

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

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

Returns
The certificate name set. If the key does not exist, return an empty set.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ setDefaultCertificateOfKey()

virtual void ndn::security::pib::PibImpl::setDefaultCertificateOfKey ( const Name keyName,
const Name certName 
)
pure virtual

Set a cert with name certName as the default of a key with keyName.

Exceptions
Pib::Errorthe certificate with name certName does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.

◆ getDefaultCertificateOfKey()

virtual Certificate ndn::security::pib::PibImpl::getDefaultCertificateOfKey ( const Name keyName) const
pure virtual
Returns
Get the default certificate of a key with keyName.
Exceptions
Pib::Errorthe default certificate does not exist.

Implemented in ndn::security::pib::PibSqlite3, ndn::security::DummyPib, and ndn::security::pib::PibMemory.


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