#include <sec-public-info-sqlite3.hpp>
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 PublicKey &publicKeyDer) |
Add a public key to the identity storage. More... | |
virtual shared_ptr< PublicKey > | getPublicKey (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 IdentityCertificate &certificate) |
Add a certificate to the identity storage. More... | |
virtual shared_ptr< IdentityCertificate > | getCertificate (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::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 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 IdentityCertificate &certificate) |
Add a certificate and set the certificate as the default one of its corresponding key. More... | |
void | addCertificateAsIdentityDefault (const 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 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< IdentityCertificate > defaultCertificate()) | |
Get cached default certificate of the default identity. More... | |
shared_ptr< IdentityCertificate > | getDefaultCertificate () |
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::SecPublicInfo | |
shared_ptr< IdentityCertificate > | m_defaultCertificate |
std::string | m_location |
Definition at line 35 of file sec-public-info-sqlite3.hpp.
|
explicit |
Definition at line 112 of file sec-public-info-sqlite3.cpp.
References ndn::INIT_CERT_TABLE, ndn::INIT_ID_TABLE, ndn::INIT_KEY_TABLE, and ndn::INIT_TPM_INFO_TABLE.
|
virtual |
Definition at line 144 of file sec-public-info-sqlite3.cpp.
|
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::SecPublicInfo.
Definition at line 199 of file sec-public-info-sqlite3.cpp.
References getTpmLocator().
|
virtual |
Get TPM Locator.
SecPublicInfo::Error | if the TPM info does not exist |
Implements ndn::SecPublicInfo.
Definition at line 217 of file sec-public-info-sqlite3.cpp.
References ndn::sqlite3_column_string().
Referenced by setTpmLocator().
|
virtual |
Definition at line 265 of file sec-public-info-sqlite3.cpp.
References ndn::SecPublicInfo::m_location.
|
virtual |
Check if the specified identity already exists.
identityName | The identity name |
Implements ndn::SecPublicInfo.
Definition at line 271 of file sec-public-info-sqlite3.cpp.
References ndn::sqlite3_bind_string(), and ndn::Name::toUri().
Referenced by addIdentity().
|
virtual |
Add a new identity.
if identity already exist, do not add it again
identityName | The identity name to be added |
Implements ndn::SecPublicInfo.
Definition at line 295 of file sec-public-info-sqlite3.cpp.
References doesIdentityExist(), ndn::sqlite3_bind_string(), and ndn::Name::toUri().
Referenced by addKey().
|
virtual |
Revoke the identity.
Implements ndn::SecPublicInfo.
Definition at line 314 of file sec-public-info-sqlite3.cpp.
|
virtual |
Check if the specified key already exists.
keyName | The name of the key |
Implements ndn::SecPublicInfo.
Definition at line 321 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
Referenced by addKey().
|
virtual |
Add a public key to the identity storage.
keyName | The name of the public key to be added |
publicKey | Reference to the PublicKey object |
Implements ndn::SecPublicInfo.
Definition at line 352 of file sec-public-info-sqlite3.cpp.
References addIdentity(), ndn::Buffer::buf(), doesPublicKeyExist(), ndn::Name::empty(), ndn::PublicKey::get(), ndn::Name::get(), ndn::PublicKey::getKeyType(), ndn::Name::getPrefix(), ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
Referenced by addCertificate().
Get shared pointer to PublicKey object from the identity storage.
keyName | The name of the requested public key |
SecPublicInfo::Error | if public key does not exist |
Implements ndn::SecPublicInfo.
Definition at line 387 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
Get the type of the queried public key.
keyName | The name of the requested public key |
Implements ndn::SecPublicInfo.
Definition at line 419 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::KEY_TYPE_NULL, ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
|
virtual |
Check if the specified certificate already exists.
certificateName | The name of the certificate |
Implements ndn::SecPublicInfo.
Definition at line 449 of file sec-public-info-sqlite3.cpp.
References ndn::sqlite3_bind_string(), and ndn::Name::toUri().
Referenced by addCertificate().
|
virtual |
Add a certificate to the identity storage.
It will add the corresponding public key and identity if they do not exist
certificate | The certificate to be added |
Implements ndn::SecPublicInfo.
Definition at line 473 of file sec-public-info-sqlite3.cpp.
References addKey(), ndn::IdentityCertificate::certificateNameToPublicKeyName(), doesCertificateExist(), ndn::Name::get(), ndn::Signature::getKeyLocator(), ndn::KeyLocator::getName(), ndn::Data::getName(), ndn::Certificate::getNotAfter(), ndn::Certificate::getNotBefore(), ndn::Name::getPrefix(), ndn::Certificate::getPublicKeyInfo(), ndn::Data::getSignature(), ndn::sqlite3_bind_string(), ndn::time::toUnixTimestamp(), ndn::name::Component::toUri(), ndn::Name::toUri(), and ndn::Data::wireEncode().
|
virtual |
Get a shared pointer to identity certificate object from the identity storage.
certificateName | The name of the requested certificate |
SecPublicInfo::Error | if the certificate does not exist |
Implements ndn::SecPublicInfo.
Definition at line 528 of file sec-public-info-sqlite3.cpp.
References ndn::sqlite3_bind_string(), and ndn::Name::toUri().
|
virtual |
Get name of the default identity.
SecPublicInfo::Error | if there is no default. |
Implements ndn::SecPublicInfo.
Definition at line 564 of file sec-public-info-sqlite3.cpp.
References ndn::sqlite3_column_string().
Get name of the default key name for the specified identity.
identityName | The identity name |
SecPublicInfo::Error | if there is no default |
Implements ndn::SecPublicInfo.
Definition at line 614 of file sec-public-info-sqlite3.cpp.
References ndn::Name::append(), ndn::sqlite3_bind_string(), and ndn::Name::toUri().
Get name of the default certificate name for the specified key.
keyName | The key name. |
SecPublicInfo::Error | if there is no default. |
Implements ndn::SecPublicInfo.
Definition at line 676 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
|
virtual |
Get all the identities from public info.
[out] | nameList | On return, the identity list |
isDefault | If specified, only the default identity is returned |
Implements ndn::SecPublicInfo.
Definition at line 749 of file sec-public-info-sqlite3.cpp.
References ns3::ndn::Name.
|
virtual |
Get all the key names from public info.
[out] | nameList | On return, the key name list. |
isDefault | If specified, only the default keys are returned |
Implements ndn::SecPublicInfo.
Definition at line 769 of file sec-public-info-sqlite3.cpp.
References ndn::Name::append().
|
virtual |
Get all the key names of a particular identity.
identity | The specified identity name | |
[out] | nameList | On return, the key name list |
isDefault | If specified, only the default key is returned |
Implements ndn::SecPublicInfo.
Definition at line 793 of file sec-public-info-sqlite3.cpp.
References ndn::Name::append(), ndn::sqlite3_bind_string(), and ndn::Name::toUri().
|
virtual |
Get all the certificate name in public info.
[out] | nameList | On return, the certificate name list |
isDefault | If specified, only the default certificates are returned |
Implements ndn::SecPublicInfo.
Definition at line 820 of file sec-public-info-sqlite3.cpp.
|
virtual |
Get all the certificate name of a particular key name.
keyName | The specified key name | |
[out] | nameList | On return, the certificate name list |
isDefault | If specified, only the default certificate is returned |
Implements ndn::SecPublicInfo.
Definition at line 841 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
|
virtual |
Delete a certificate.
certificateName | The certificate name |
Implements ndn::SecPublicInfo.
Definition at line 874 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::sqlite3_bind_string(), and ndn::Name::toUri().
|
virtual |
Delete a public key and related certificates.
keyName | The key name |
Implements ndn::SecPublicInfo.
Definition at line 887 of file sec-public-info-sqlite3.cpp.
References ndn::Name::empty(), ndn::Name::get(), ndn::Name::getPrefix(), ndn::sqlite3_bind_string(), ndn::name::Component::toUri(), and ndn::Name::toUri().
|
virtual |
Delete an identity and related public keys and certificates.
identity | The identity name |
Implements ndn::SecPublicInfo.
Definition at line 914 of file sec-public-info-sqlite3.cpp.
References ndn::sqlite3_bind_string(), and ndn::Name::toUri().
|
static |
Definition at line 159 of file sec-public-info-sqlite3.hpp.