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

Abstract class of PIB implementation. More...

#include <pib-impl.hpp>

Inheritance diagram for ndn::security::PibImpl:

Classes

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

Public Member Functions

virtual ~PibImpl ()
 
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. 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 &identity, const name::Component &keyId) const =0
 Check the existence of a key. More...
 
virtual void addKey (const Name &identity, const name::Component &keyId, const v1::PublicKey &publicKey)=0
 Add a key. More...
 
virtual void removeKey (const Name &identity, const name::Component &keyId)=0
 Remove a key. More...
 
virtual v1::PublicKey getKeyBits (const Name &identity, const name::Component &keyId) const =0
 Get the key bits of a key. More...
 
virtual std::set< name::ComponentgetKeysOfIdentity (const Name &identity) const =0
 Get all the key ids of an identity with name identity. More...
 
virtual void setDefaultKeyOfIdentity (const Name &identity, const name::Component &keyId)=0
 Set an key with id keyId as the default key of an identity with name identity. More...
 
virtual name::Component getDefaultKeyOfIdentity (const Name &identity) const =0
 Get the id of the default key of an identity with name identity. More...
 
virtual bool hasCertificate (const Name &certName) const =0
 Check the existence of a certificate with name certName. More...
 
virtual void addCertificate (const v1::IdentityCertificate &certificate)=0
 Add a certificate. More...
 
virtual void removeCertificate (const Name &certName)=0
 Remove a certificate with name certName. More...
 
virtual v1::IdentityCertificate getCertificate (const Name &certName) const =0
 Get a certificate with name certName. More...
 
virtual std::set< NamegetCertificatesOfKey (const Name &identity, const name::Component &keyId) const =0
 Get a list of certificate names of a key with id keyId of identity. More...
 
virtual void setDefaultCertificateOfKey (const Name &identity, const name::Component &keyId, const Name &certName)=0
 Set a cert with name certName as the default of a key with id keyId of identity. More...
 
virtual v1::IdentityCertificate getDefaultCertificateOfKey (const Name &identity, const name::Component &keyId) const =0
 Get the default certificate of a key with id keyId of identity. More...
 

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 37 of file pib-impl.hpp.

Constructor & Destructor Documentation

◆ ~PibImpl()

Member Function Documentation

◆ setTpmLocator()

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

Set the corresponding TPM information to tpmLocator.

If the provided tpmLocator is different from the existing one, the content in PIB will be cleaned up, otherwise nothing will be changed.

Parameters
tpmLocatorThe name for the new TPM locator

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

Referenced by ~PibImpl().

◆ getTpmLocator()

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

Get TPM Locator.

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

Referenced by ~PibImpl().

◆ hasIdentity()

virtual bool ndn::security::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::PibSqlite3, and ndn::security::PibMemory.

Referenced by ~PibImpl().

◆ addIdentity()

virtual void ndn::security::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::PibSqlite3, and ndn::security::PibMemory.

Referenced by ~PibImpl().

◆ removeIdentity()

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

Remove an identity.

If the identity does not exist, do nothing. Remove related keys and certificates as well.

Parameters
identityThe name of the identity to remove.

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

Referenced by ~PibImpl().

◆ getIdentities()

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

Get the name of all the identities.

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

Referenced by ~PibImpl().

◆ setDefaultIdentity()

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

Set an identity with name identityName as the default identity.

Since adding an identity only requires the identity name, create the identity if it does not exist.

Parameters
identityNameThe name for the default identity.

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

Referenced by ~PibImpl().

◆ getDefaultIdentity()

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

Get the default identity.

Returns
The name for the default identity.
Exceptions
Pib::Errorif no default identity.

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

Referenced by ~PibImpl().

◆ hasKey()

virtual bool ndn::security::PibImpl::hasKey ( const Name identity,
const name::Component keyId 
) const
pure virtual

Check the existence of a key.

Parameters
identityThe name of the belonged identity.
keyIdThe key id component.
Returns
true if the key exists, otherwise false. Return false if the identity does not exist

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

Referenced by ~PibImpl().

◆ addKey()

virtual void ndn::security::PibImpl::addKey ( const Name identity,
const name::Component keyId,
const v1::PublicKey publicKey 
)
pure virtual

Add a key.

If the key already exists, do nothing. If the identity does not exist, add the identity as well. If no default key of the identity has been set, set the added one as default key of the identity.

Parameters
identityThe name of the belonged identity.
keyIdThe key id component.
publicKeyThe public key bits.

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

Referenced by ~PibImpl().

◆ removeKey()

virtual void ndn::security::PibImpl::removeKey ( const Name identity,
const name::Component keyId 
)
pure virtual

Remove a key.

If the key does not exist, do nothing. Remove related certificates as well.

Parameters
identityThe name of the belonged identity.
keyIdThe key id component.

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

Referenced by ~PibImpl().

◆ getKeyBits()

virtual v1::PublicKey ndn::security::PibImpl::getKeyBits ( const Name identity,
const name::Component keyId 
) const
pure virtual

Get the key bits of a key.

Parameters
identityThe name of the belonged identity.
keyIdThe key id component.
Returns
key bits
Exceptions
Pib::Errorif the key does not exist.

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

Referenced by ~PibImpl().

◆ getKeysOfIdentity()

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

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

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

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

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

Referenced by ~PibImpl().

◆ setDefaultKeyOfIdentity()

virtual void ndn::security::PibImpl::setDefaultKeyOfIdentity ( const Name identity,
const name::Component keyId 
)
pure virtual

Set an key with id keyId as the default key of an identity with name identity.

Parameters
identityThe name of the belonged identity.
keyIdThe key id component.
Exceptions
Pib::Errorif the key does not exist.

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

Referenced by ~PibImpl().

◆ getDefaultKeyOfIdentity()

virtual name::Component ndn::security::PibImpl::getDefaultKeyOfIdentity ( const Name identity) const
pure virtual

Get the id of the default key of an identity with name identity.

Parameters
identityThe name of the belonged identity.
Exceptions
Pib::Errorif no default key or the identity does not exist.

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

Referenced by ~PibImpl().

◆ hasCertificate()

virtual bool ndn::security::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::PibSqlite3, and ndn::security::PibMemory.

Referenced by ~PibImpl().

◆ addCertificate()

virtual void ndn::security::PibImpl::addCertificate ( const v1::IdentityCertificate certificate)
pure virtual

Add a certificate.

If the certificate already exists, do nothing. If the key or identity do not exist, add them as well. If no default certificate of the key has been set, set the added one as default certificate of the key.

Parameters
certificateThe certificate to add.

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

Referenced by ~PibImpl().

◆ removeCertificate()

virtual void ndn::security::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::PibSqlite3, and ndn::security::PibMemory.

Referenced by ~PibImpl().

◆ getCertificate()

virtual v1::IdentityCertificate ndn::security::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::Errorif the certificate does not exist.

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

Referenced by ~PibImpl().

◆ getCertificatesOfKey()

virtual std::set<Name> ndn::security::PibImpl::getCertificatesOfKey ( const Name identity,
const name::Component keyId 
) const
pure virtual

Get a list of certificate names of a key with id keyId of identity.

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

Parameters
identityThe name of the belonging identity.
keyIdThe key id.
Returns
The certificate name set. If the key does not exist, return an empty set.

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

Referenced by ~PibImpl().

◆ setDefaultCertificateOfKey()

virtual void ndn::security::PibImpl::setDefaultCertificateOfKey ( const Name identity,
const name::Component keyId,
const Name certName 
)
pure virtual

Set a cert with name certName as the default of a key with id keyId of identity.

Parameters
identityThe name of the belonging identity.
keyIdThe key id.
certNameThe name of the certificate.
Exceptions
Pib::Errorif the certificate with name certName does not exist.

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

Referenced by ~PibImpl().

◆ getDefaultCertificateOfKey()

virtual v1::IdentityCertificate ndn::security::PibImpl::getDefaultCertificateOfKey ( const Name identity,
const name::Component keyId 
) const
pure virtual

Get the default certificate of a key with id keyId of identity.

Parameters
identityThe name of the belonging identity.
keyIdThe key id.
Returns
a pointer to the certificate, null if no default certificate for the key.
Exceptions
Pib::Errorif the default certificate does not exist.

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

Referenced by ~PibImpl().


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