PibSqlite3 extends PibImpl and is used by the Pib class as an implementation of a PIB based on an SQLite3 database. More...
#include <pib-sqlite3.hpp>
Public Member Functions | |
| PibSqlite3 (const std::string &databaseDirectoryPath="", const std::string &databaseFilename="pib.db") | |
| Create a new PibSqlite3 to work with an SQLite3 file. More... | |
| virtual | ~PibSqlite3 () |
| Destroy and clean up the internal state. | |
| 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< Name > | getIdentities () 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< Name > | getKeysOfIdentity (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< Name > | getCertificatesOfKey (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 () |
| static std::string | getDefaultDatabaseDirectoryPath () |
| Get the default that the constructor uses if databaseDirectoryPath is omitted. More... | |
| static std::string | getDefaultDatabaseFilePath () |
| Get the default database file path that the constructor uses if databaseDirectoryPath and databaseFilename are omitted. More... | |
PibSqlite3 extends PibImpl and is used by the Pib class as an implementation of a PIB based on an SQLite3 database.
All the contents in the PIB are stored in an SQLite3 database file. This provides more persistent storage than PibMemory.
| ndn::PibSqlite3::PibSqlite3 | ( | const std::string & | databaseDirectoryPath = "", |
| const std::string & | databaseFilename = "pib.db" |
||
| ) |
Create a new PibSqlite3 to work with an SQLite3 file.
This assumes that the database directory does not contain a PIB database of an older version.
| databaseDirectoryPath | (optional) The directory where the database file is located. If omitted, use $HOME/.ndn . If the directory does not exist, create it. |
| databaseFilename | (optional) The name if the database file in the databaseDirectoryPath. If omitted, use "pib.db". |
| PibImpl::Error | if initialization fails. |
|
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.
| certificate | The certificate to add. This copies the object. |
Implements ndn::PibImpl.
|
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.
| identityName | The name of the identity to add. This copies the name. |
Implements ndn::PibImpl.
|
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.
| identityName | The name of the identity that the key belongs to. This copies the name. |
| keyName | The name of the key. This copies the name. |
| key | The public key bits. This copies the array. |
| keyLength | The length of the public key bits array. |
Implements ndn::PibImpl.
|
virtual |
Get the certificate with name certificateName.
| certificateName | The name of the certificate. |
| Pib::Error | if the certificate does not exist. |
Implements ndn::PibImpl.
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.
| keyName | The name of the key. |
Implements ndn::PibImpl.
|
virtual |
Get the default certificate for the key with eyName.
| keyName | The name of the key. |
| Pib::Error | if the default certificate does not exist. |
Implements ndn::PibImpl.
|
static |
Get the default that the constructor uses if databaseDirectoryPath is omitted.
This does not try to create the directory.
|
inlinestatic |
Get the default database file path that the constructor uses if databaseDirectoryPath and databaseFilename are omitted.
|
virtual |
Get the default identity.
| Pib::Error | for no default identity. |
Implements ndn::PibImpl.
Get the name of the default key for the identity with name identityName.
| identityName | The name of the identity. |
| Pib::Error | if there is no default key or if the identity does not exist. |
Implements ndn::PibImpl.
|
virtual |
Get the names of all the identities.
Implements ndn::PibImpl.
Get the key bits of a key with name keyName.
| keyName | The name of the key. |
| Pib::Error | if the key does not exist. |
Implements ndn::PibImpl.
|
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.
| identityName | The name of the identity. |
Implements ndn::PibImpl.
|
virtual |
|
virtual |
Check for the existence of a certificate with name certificateName.
| certificateName | The name of the certificate. |
Implements ndn::PibImpl.
|
virtual |
Check for the existence of an identity.
| identityName | The name of the identity. |
Implements ndn::PibImpl.
|
virtual |
Check for the existence of a key with keyName.
| keyName | The name of the key. |
Implements ndn::PibImpl.
|
virtual |
Remove the certificate with name certificateName.
If the certificate does not exist, do nothing.
| certificateName | The name of the certificate. |
Implements ndn::PibImpl.
|
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.
| identityName | The name of the identity to remove. |
Implements ndn::PibImpl.
|
virtual |
Remove the key with keyName and its related certificates.
If the key does not exist, do nothing.
| keyName | The name of the key. |
Implements ndn::PibImpl.
|
virtual |
Set the cert with name certificateName as the default for the key with keyName.
| keyName | The name of the key. |
| certificateName | The name of the certificate. This copies the name. |
| Pib::Error | if the certificate with name certificateName does not exist. |
Implements ndn::PibImpl.
|
virtual |
Set the identity with the identityName as the default identity.
If the identity with identityName does not exist, then it will be created.
| identityName | The name for the default identity. This copies the name. |
Implements ndn::PibImpl.
|
virtual |
Set the key with keyName as the default key for the identity with name identityName.
| identityName | The name of the identity. |
| keyName | The name of the key. This copies the name. |
| Pib::Error | if the key does not exist. |
Implements ndn::PibImpl.
|
virtual |
Set the corresponding TPM information to tpmLocator.
This method does not reset the contents of the PIB.
| tpmLocator | The TPM locator string. |
Implements ndn::PibImpl.
1.8.6