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

#include <sec-public-info-sqlite3.hpp>

Inheritance diagram for ndn::security::SecPublicInfoSqlite3:
Collaboration diagram for ndn::security::SecPublicInfoSqlite3:

Classes

class  Error
 

Public Member Functions

 SecPublicInfoSqlite3 (const std::string &dir="")
 
virtual ~SecPublicInfoSqlite3 ()
 
virtual void setTpmLocator (const std::string &tpmLocator)
 Set the corresponding TPM information to tpmLocator. More...
 
virtual std::string getTpmLocator ()
 Get TPM Locator. More...
 
virtual std::string getPibLocator ()
 
virtual bool doesIdentityExist (const Name &identityName)
 Check if the specified identity already exists. More...
 
virtual void addIdentity (const Name &identityName)
 Add a new identity. More...
 
virtual bool revokeIdentity ()
 Revoke the identity. More...
 
virtual bool doesPublicKeyExist (const Name &keyName)
 Check if the specified key already exists. More...
 
virtual void addKey (const Name &keyName, const v1::PublicKey &publicKeyDer)
 Add a public key to the identity storage. More...
 
virtual shared_ptr< v1::PublicKeygetPublicKey (const Name &keyName)
 Get shared pointer to PublicKey object from the identity storage. More...
 
virtual KeyType getPublicKeyType (const Name &keyName)
 Get the type of the queried public key. More...
 
virtual bool doesCertificateExist (const Name &certificateName)
 Check if the specified certificate already exists. More...
 
virtual void addCertificate (const v1::IdentityCertificate &certificate)
 Add a certificate to the identity storage. More...
 
virtual shared_ptr< v1::IdentityCertificategetCertificate (const Name &certificateName)
 Get a shared pointer to identity certificate object from the identity storage. More...
 
virtual Name getDefaultIdentity ()
 Get name of the default identity. More...
 
virtual Name getDefaultKeyNameForIdentity (const Name &identityName)
 Get name of the default key name for the specified identity. More...
 
virtual Name getDefaultCertificateNameForKey (const Name &keyName)
 Get name of the default certificate name for the specified key. More...
 
virtual void getAllIdentities (std::vector< Name > &nameList, bool isDefault)
 Get all the identities from public info. More...
 
virtual void getAllKeyNames (std::vector< Name > &nameList, bool isDefault)
 Get all the key names from public info. More...
 
virtual void getAllKeyNamesOfIdentity (const Name &identity, std::vector< Name > &nameList, bool isDefault)
 Get all the key names of a particular identity. More...
 
virtual void getAllCertificateNames (std::vector< Name > &nameList, bool isDefault)
 Get all the certificate name in public info. More...
 
virtual void getAllCertificateNamesOfKey (const Name &keyName, std::vector< Name > &nameList, bool isDefault)
 Get all the certificate name of a particular key name. More...
 
virtual void deleteCertificateInfo (const Name &certificateName)
 Delete a certificate. More...
 
virtual void deletePublicKeyInfo (const Name &keyName)
 Delete a public key and related certificates. More...
 
virtual void deleteIdentityInfo (const Name &identity)
 Delete an identity and related public keys and certificates. More...
 
- Public Member Functions inherited from ndn::security::SecPublicInfo
 SecPublicInfo (const std::string &location)
 
virtual ~SecPublicInfo ()
 The virtual Destructor. More...
 
std::string getPibLocator ()
 Get PIB Locator. More...
 
 DEPRECATED (void addPublicKey(const Name &keyName, KeyType keyType, const v1::PublicKey &publicKey))
 Add a public key to the identity storage. More...
 
void setDefaultIdentity (const Name &identityName)
 Set the default identity. More...
 
void setDefaultKeyNameForIdentity (const Name &keyName)
 Set the default key name for the corresponding identity. More...
 
void setDefaultCertificateNameForKey (const Name &certificateName)
 Set the default certificate name for the corresponding key. More...
 
Name getNewKeyName (const Name &identityName, bool useKsk)
 Generate a key name for the identity. More...
 
Name getDefaultCertificateNameForIdentity (const Name &identityName)
 Get the default certificate name for the specified identity. More...
 
Name getDefaultCertificateName ()
 Get the default certificate name of the default identity. More...
 
void addCertificateAsKeyDefault (const v1::IdentityCertificate &certificate)
 Add a certificate and set the certificate as the default one of its corresponding key. More...
 
void addCertificateAsIdentityDefault (const v1::IdentityCertificate &certificate)
 Add a certificate into the public key identity storage and set the certificate as the default one of its corresponding identity. More...
 
void addCertificateAsSystemDefault (const v1::IdentityCertificate &certificate)
 Add a certificate into the public key identity storage and set the certificate as the default one of the default identity. More...
 
 DEPRECATED (shared_ptr< v1::IdentityCertificate > defaultCertificate())
 Get cached default certificate of the default identity. More...
 
shared_ptr< v1::IdentityCertificategetDefaultCertificate ()
 Get cached default certificate of the default identity. More...
 
void refreshDefaultCertificate ()
 try to get the default certificate of the default identity from the public info More...
 

Static Public Attributes

static const std::string SCHEME
 

Additional Inherited Members

- Protected Attributes inherited from ndn::security::SecPublicInfo
shared_ptr< v1::IdentityCertificatem_defaultCertificate
 
std::string m_location
 

Detailed Description

Definition at line 36 of file sec-public-info-sqlite3.hpp.

Constructor & Destructor Documentation

◆ SecPublicInfoSqlite3()

ndn::security::SecPublicInfoSqlite3::SecPublicInfoSqlite3 ( const std::string &  dir = "")
explicit

◆ ~SecPublicInfoSqlite3()

ndn::security::SecPublicInfoSqlite3::~SecPublicInfoSqlite3 ( )
virtual

Member Function Documentation

◆ setTpmLocator()

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

Set the corresponding TPM information to tpmLocator.

If the provided tpmLocator is different from the existing one, the PIB will be reset, otherwise nothing will be changed.

For legacy issue, the TPM info may not exist (some old PIB content may not have this info), this method will simply set the TPM info as provided without changing anything else. Thus an ideal process of handling old PIB is to check if TPM info exists. If it does not exist, then set it to the default value according to configuration.

Implements ndn::security::SecPublicInfo.

Definition at line 213 of file sec-public-info-sqlite3.cpp.

References getTpmLocator().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getTpmLocator()

string ndn::security::SecPublicInfoSqlite3::getTpmLocator ( )
virtual

◆ getPibLocator()

std::string ndn::security::SecPublicInfoSqlite3::getPibLocator ( )
virtual

◆ doesIdentityExist()

bool ndn::security::SecPublicInfoSqlite3::doesIdentityExist ( const Name identityName)
virtual

Check if the specified identity already exists.

Parameters
identityNameThe identity name
Returns
true if the identity exists, otherwise false

Implements ndn::security::SecPublicInfo.

Definition at line 285 of file sec-public-info-sqlite3.cpp.

References ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by addIdentity(), and ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ addIdentity()

void ndn::security::SecPublicInfoSqlite3::addIdentity ( const Name identityName)
virtual

Add a new identity.

if identity already exist, do not add it again

Parameters
identityNameThe identity name to be added

Implements ndn::security::SecPublicInfo.

Definition at line 309 of file sec-public-info-sqlite3.cpp.

References doesIdentityExist(), ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by addKey(), ndn::security::SecPublicInfoSqlite3::Error::Error(), and getDefaultIdentity().

◆ revokeIdentity()

bool ndn::security::SecPublicInfoSqlite3::revokeIdentity ( )
virtual

Revoke the identity.

Returns
true if the identity was revoked, otherwise false

Implements ndn::security::SecPublicInfo.

Definition at line 328 of file sec-public-info-sqlite3.cpp.

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ doesPublicKeyExist()

bool ndn::security::SecPublicInfoSqlite3::doesPublicKeyExist ( const Name keyName)
virtual

Check if the specified key already exists.

Parameters
keyNameThe name of the key
Returns
true if the key exists, otherwise false

Implements ndn::security::SecPublicInfo.

Definition at line 335 of file sec-public-info-sqlite3.cpp.

References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::security::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().

Referenced by addKey(), ndn::security::SecPublicInfoSqlite3::Error::Error(), and getDefaultKeyNameForIdentity().

◆ addKey()

void ndn::security::SecPublicInfoSqlite3::addKey ( const Name keyName,
const v1::PublicKey publicKey 
)
virtual

◆ getPublicKey()

shared_ptr< v1::PublicKey > ndn::security::SecPublicInfoSqlite3::getPublicKey ( const Name keyName)
virtual

Get shared pointer to PublicKey object from the identity storage.

Parameters
keyNameThe name of the requested public key
Exceptions
SecPublicInfo::Errorif public key does not exist

Implements ndn::security::SecPublicInfo.

Definition at line 401 of file sec-public-info-sqlite3.cpp.

References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::security::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getPublicKeyType()

KeyType ndn::security::SecPublicInfoSqlite3::getPublicKeyType ( const Name keyName)
virtual

Get the type of the queried public key.

Note
KeyType is also available from PublicKey instance. This method is more efficient if only KeyType is needed.
Parameters
keyNameThe name of the requested public key
Returns
the type of the key. If the queried key does not exist, KeyType::NONE will be returned

Implements ndn::security::SecPublicInfo.

Definition at line 433 of file sec-public-info-sqlite3.cpp.

References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::NONE, ndn::security::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ doesCertificateExist()

bool ndn::security::SecPublicInfoSqlite3::doesCertificateExist ( const Name certificateName)
virtual

Check if the specified certificate already exists.

Parameters
certificateNameThe name of the certificate

Implements ndn::security::SecPublicInfo.

Definition at line 463 of file sec-public-info-sqlite3.cpp.

References ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by addCertificate(), ndn::security::SecPublicInfoSqlite3::Error::Error(), and getDefaultCertificateNameForKey().

◆ addCertificate()

◆ getCertificate()

shared_ptr< v1::IdentityCertificate > ndn::security::SecPublicInfoSqlite3::getCertificate ( const Name certificateName)
virtual

Get a shared pointer to identity certificate object from the identity storage.

Parameters
certificateNameThe name of the requested certificate
Exceptions
SecPublicInfo::Errorif the certificate does not exist

Implements ndn::security::SecPublicInfo.

Definition at line 542 of file sec-public-info-sqlite3.cpp.

References ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getDefaultIdentity()

Name ndn::security::SecPublicInfoSqlite3::getDefaultIdentity ( )
virtual

◆ getDefaultKeyNameForIdentity()

Name ndn::security::SecPublicInfoSqlite3::getDefaultKeyNameForIdentity ( const Name identityName)
virtual

Get name of the default key name for the specified identity.

Parameters
identityNameThe identity name
Exceptions
SecPublicInfo::Errorif there is no default

Implements ndn::security::SecPublicInfo.

Definition at line 628 of file sec-public-info-sqlite3.cpp.

References ndn::Name::append(), doesPublicKeyExist(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::security::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getDefaultCertificateNameForKey()

Name ndn::security::SecPublicInfoSqlite3::getDefaultCertificateNameForKey ( const Name keyName)
virtual

◆ getAllIdentities()

void ndn::security::SecPublicInfoSqlite3::getAllIdentities ( std::vector< Name > &  nameList,
bool  isDefault 
)
virtual

Get all the identities from public info.

Parameters
[out]nameListOn return, the identity list
isDefaultIf specified, only the default identity is returned

Implements ndn::security::SecPublicInfo.

Definition at line 763 of file sec-public-info-sqlite3.cpp.

References ns3::ndn::Name.

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getAllKeyNames()

void ndn::security::SecPublicInfoSqlite3::getAllKeyNames ( std::vector< Name > &  nameList,
bool  isDefault 
)
virtual

Get all the key names from public info.

Parameters
[out]nameListOn return, the key name list.
isDefaultIf specified, only the default keys are returned

Implements ndn::security::SecPublicInfo.

Definition at line 783 of file sec-public-info-sqlite3.cpp.

References ndn::Name::append().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getAllKeyNamesOfIdentity()

void ndn::security::SecPublicInfoSqlite3::getAllKeyNamesOfIdentity ( const Name identity,
std::vector< Name > &  nameList,
bool  isDefault 
)
virtual

Get all the key names of a particular identity.

Parameters
identityThe specified identity name
[out]nameListOn return, the key name list
isDefaultIf specified, only the default key is returned

Implements ndn::security::SecPublicInfo.

Definition at line 807 of file sec-public-info-sqlite3.cpp.

References ndn::Name::append(), ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getAllCertificateNames()

void ndn::security::SecPublicInfoSqlite3::getAllCertificateNames ( std::vector< Name > &  nameList,
bool  isDefault 
)
virtual

Get all the certificate name in public info.

Parameters
[out]nameListOn return, the certificate name list
isDefaultIf specified, only the default certificates are returned

Implements ndn::security::SecPublicInfo.

Definition at line 834 of file sec-public-info-sqlite3.cpp.

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ getAllCertificateNamesOfKey()

void ndn::security::SecPublicInfoSqlite3::getAllCertificateNamesOfKey ( const Name keyName,
std::vector< Name > &  nameList,
bool  isDefault 
)
virtual

Get all the certificate name of a particular key name.

Parameters
keyNameThe specified key name
[out]nameListOn return, the certificate name list
isDefaultIf specified, only the default certificate is returned

Implements ndn::security::SecPublicInfo.

Definition at line 855 of file sec-public-info-sqlite3.cpp.

References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::security::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ deleteCertificateInfo()

void ndn::security::SecPublicInfoSqlite3::deleteCertificateInfo ( const Name certificateName)
virtual

Delete a certificate.

Parameters
certificateNameThe certificate name

Implements ndn::security::SecPublicInfo.

Definition at line 888 of file sec-public-info-sqlite3.cpp.

References ndn::Name::empty(), ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

◆ deletePublicKeyInfo()

void ndn::security::SecPublicInfoSqlite3::deletePublicKeyInfo ( const Name keyName)
virtual

◆ deleteIdentityInfo()

void ndn::security::SecPublicInfoSqlite3::deleteIdentityInfo ( const Name identity)
virtual

Delete an identity and related public keys and certificates.

Parameters
identityThe identity name

Implements ndn::security::SecPublicInfo.

Definition at line 928 of file sec-public-info-sqlite3.cpp.

References SCHEME, ndn::security::sqlite3_bind_string(), and ndn::Name::toUri().

Referenced by ndn::security::SecPublicInfoSqlite3::Error::Error().

Member Data Documentation

◆ SCHEME

const std::string ndn::security::SecPublicInfoSqlite3::SCHEME
static

Definition at line 160 of file sec-public-info-sqlite3.hpp.

Referenced by deleteIdentityInfo().


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