Public Member Functions | List of all members
ndn::BasicIdentityStorage Class Reference

BasicIdentityStorage extends IdentityStorage to implement a basic storage of identity, public keys and certificates using SQLite. More...

#include <basic-identity-storage.hpp>

Inheritance diagram for ndn::BasicIdentityStorage:
ndn::IdentityStorage

Public Member Functions

 BasicIdentityStorage (const std::string &databaseFilePath="")
 Create a new BasicIdentityStorage to work with an SQLite file. More...
 
virtual ~BasicIdentityStorage ()
 The virtual Destructor.
 
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 doesKeyExist (const Name &keyName)
 Check if the specified key already exists. More...
 
virtual void addKey (const Name &keyName, KeyType keyType, const Blob &publicKeyDer)
 Add a public key to the identity storage. More...
 
virtual Blob getKey (const Name &keyName)
 Get the public key DER blob from the identity storage. More...
 
virtual void activateKey (const Name &keyName)
 Activate a key. More...
 
virtual void deactivateKey (const Name &keyName)
 Deactivate a key. More...
 
virtual bool doesCertificateExist (const Name &certificateName)
 Check if the specified certificate already exists. More...
 
virtual void addCertificate (const IdentityCertificate &certificate)
 Add a certificate to the identity storage. More...
 
virtual ptr_lib::shared_ptr< IdentityCertificategetCertificate (const Name &certificateName)
 Get a certificate from the identity storage. More...
 
virtual Name getDefaultIdentity ()
 Get the default identity. More...
 
virtual Name getDefaultKeyNameForIdentity (const Name &identityName)
 Get the default key name for the specified identity. More...
 
virtual Name getDefaultCertificateNameForKey (const Name &keyName)
 Get the default certificate name for the specified key. More...
 
virtual void getAllIdentities (std::vector< Name > &nameList, bool isDefault)
 Append all the identity names to the nameList. More...
 
virtual void getAllKeyNamesOfIdentity (const Name &identityName, std::vector< Name > &nameList, bool isDefault)
 Append all the key names of a particular identity to the nameList. More...
 
virtual void getAllCertificateNamesOfKey (const Name &keyName, std::vector< Name > &nameList, bool isDefault)
 Append all the certificate names of a particular key name to the nameList. More...
 
virtual void setDefaultIdentity (const Name &identityName)
 Set the default identity. More...
 
virtual void setDefaultKeyNameForIdentity (const Name &keyName, const Name &identityNameCheck=Name())
 Set a key as the default key of an identity. More...
 
virtual void setDefaultCertificateNameForKey (const Name &keyName, const Name &certificateName)
 Set the default key name for the specified identity. 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::IdentityStorage
virtual ~IdentityStorage ()
 The virtual Destructor.
 
Name getNewKeyName (const Name &identityName, bool useKsk)
 Generate a name for a new key belonging to the identity. More...
 
Name getDefaultCertificateNameForIdentity (const Name &identityName)
 Get the default certificate name for the specified identity. More...
 
virtual ptr_lib::shared_ptr< IdentityCertificategetDefaultCertificate ()
 Get the certificate of the default identity. More...
 

Detailed Description

BasicIdentityStorage extends IdentityStorage to implement a basic storage of identity, public keys and certificates using SQLite.

Constructor & Destructor Documentation

ndn::BasicIdentityStorage::BasicIdentityStorage ( const std::string &  databaseFilePath = "")

Create a new BasicIdentityStorage to work with an SQLite file.

Parameters
databaseFilePath(optional) The path of the SQLite file. If empty or omitted, use the default location.

Member Function Documentation

virtual void ndn::BasicIdentityStorage::activateKey ( const Name keyName)
virtual

Activate a key.

If a key is marked as inactive, its private part will not be used in packet signing.

Parameters
keyNamename of the key

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::addCertificate ( const IdentityCertificate certificate)
virtual

Add a certificate to the identity storage.

Also call addKey to ensure that the certificate key exists. If the certificate is already installed, don't replace it.

Parameters
certificateThe certificate to be added. This makes a copy of the certificate.

Implements ndn::IdentityStorage.

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

Add a new identity.

Do nothing if the identity already exists.

Parameters
identityNameThe identity name to be added.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::addKey ( const Name keyName,
KeyType  keyType,
const Blob publicKeyDer 
)
virtual

Add a public key to the identity storage.

Also call addIdentity to ensure that the identityName for the key exists. However, if the key already exists, do nothing.

Parameters
keyNameThe name of the public key to be added.
keyTypeType of the public key to be added.
publicKeyDerA blob of the public key DER to be added.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::deactivateKey ( const Name keyName)
virtual

Deactivate a key.

If a key is marked as inactive, its private part will not be used in packet signing.

Parameters
keyNamename of the key

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::deleteCertificateInfo ( const Name certificateName)
virtual

Delete a certificate.

Parameters
certificateNameThe certificate name.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::deleteIdentityInfo ( const Name identity)
virtual

Delete an identity and related public keys and certificates.

Parameters
identityThe identity name.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::deletePublicKeyInfo ( const Name keyName)
virtual

Delete a public key and related certificates.

Parameters
keyNameThe key name.

Implements ndn::IdentityStorage.

virtual bool ndn::BasicIdentityStorage::doesCertificateExist ( const Name certificateName)
virtual

Check if the specified certificate already exists.

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

Implements ndn::IdentityStorage.

virtual bool ndn::BasicIdentityStorage::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::IdentityStorage.

virtual bool ndn::BasicIdentityStorage::doesKeyExist ( 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::IdentityStorage.

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

Append all the certificate names of a particular key name to the nameList.

Parameters
keyNameThe key name to search for.
nameListAppend result names to nameList.
isDefaultIf true, add only the default certificate name. If false, add only the non-default certificate names.

Implements ndn::IdentityStorage.

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

Append all the identity names to the nameList.

Parameters
nameListAppend result names to nameList.
isDefaultIf true, add only the default identity name. If false, add only the non-default identity names.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::getAllKeyNamesOfIdentity ( const Name identityName,
std::vector< Name > &  nameList,
bool  isDefault 
)
virtual

Append all the key names of a particular identity to the nameList.

Parameters
identityNameThe identity name to search for.
nameListAppend result names to nameList.
isDefaultIf true, add only the default key name. If false, add only the non-default key names.

Implements ndn::IdentityStorage.

virtual ptr_lib::shared_ptr<IdentityCertificate> ndn::BasicIdentityStorage::getCertificate ( const Name certificateName)
virtual

Get a certificate from the identity storage.

Parameters
certificateNameThe name of the requested certificate.
Returns
The requested certificate.
Exceptions
SecurityExceptionif the certificate doesn't exist.

Implements ndn::IdentityStorage.

virtual Name ndn::BasicIdentityStorage::getDefaultCertificateNameForKey ( const Name keyName)
virtual

Get the default certificate name for the specified key.

Parameters
keyNameThe key name.
Returns
The default certificate name.
Exceptions
SecurityExceptionif the default certificate name for the key name is not set.

Implements ndn::IdentityStorage.

virtual Name ndn::BasicIdentityStorage::getDefaultIdentity ( )
virtual

Get the default identity.

Returns
The name of default identity.
Exceptions
SecurityExceptionif the default identity is not set.

Implements ndn::IdentityStorage.

virtual Name ndn::BasicIdentityStorage::getDefaultKeyNameForIdentity ( const Name identityName)
virtual

Get the default key name for the specified identity.

Parameters
identityNameThe identity name.
Returns
The default key name.
Exceptions
SecurityExceptionif the default key name for the identity is not set.

Implements ndn::IdentityStorage.

virtual Blob ndn::BasicIdentityStorage::getKey ( const Name keyName)
virtual

Get the public key DER blob from the identity storage.

Parameters
keyNameThe name of the requested public key.
Returns
The DER Blob.
Exceptions
SecurityExceptionif the key doesn't exist.

Implements ndn::IdentityStorage.

virtual bool ndn::BasicIdentityStorage::revokeIdentity ( )
virtual

Revoke the identity.

Returns
true if the identity was revoked, false if not.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::setDefaultCertificateNameForKey ( const Name keyName,
const Name certificateName 
)
virtual

Set the default key name for the specified identity.

Parameters
keyNameThe key name.
certificateNameThe certificate name.

Implements ndn::IdentityStorage.

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

Set the default identity.

If the identityName does not exist, then clear the default identity so that getDefaultIdentity() throws an exception.

Parameters
identityNameThe default identity name.

Implements ndn::IdentityStorage.

virtual void ndn::BasicIdentityStorage::setDefaultKeyNameForIdentity ( const Name keyName,
const Name identityNameCheck = Name() 
)
virtual

Set a key as the default key of an identity.

The identity name is inferred from keyName.

Parameters
keyNameThe name of the key.
identityNameCheck(optional) The identity name to check that the keyName contains the same identity name. If an empty name, it is ignored.

Implements ndn::IdentityStorage.


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