9 #ifndef NDN_SECURITY_SEC_PUBLIC_INFO_HPP 
   10 #define NDN_SECURITY_SEC_PUBLIC_INFO_HPP 
   12 #include "../name.hpp" 
   29   class Error : 
public std::runtime_error
 
   34       : std::runtime_error(what)
 
   98   virtual shared_ptr<PublicKey>
 
  127   virtual shared_ptr<IdentityCertificate>
 
  367   inline shared_ptr<IdentityCertificate>
 
  410   std::ostringstream oss;
 
  419   Name keyName = 
Name(identityName).append(oss.str());
 
  422     throw Error(
"Key name already exists: " + keyName.
toUri());
 
  434     throw Error(
"No default certificate is set");
 
  470 inline shared_ptr<IdentityCertificate>
 
  493 #endif //NDN_SECURITY_SEC_PUBLIC_INFO_HPP 
Name getDefaultCertificateNameForIdentity(const Name &identityName)
Get the default certificate name for the specified identity. 
virtual void addIdentity(const Name &identityName)=0
Add a new identity. 
virtual void getAllKeyNames(std::vector< Name > &nameList, bool isDefault)=0
Get all the key name in public info. 
virtual void addCertificate(const IdentityCertificate &certificate)=0
Add a certificate to the identity storage. 
virtual Name getDefaultCertificateNameForKey(const Name &keyName)=0
Get the default certificate name for the specified key. 
Name getPrefix(int nComponents) const 
Return a new Name with the first nComponents components of this Name. 
virtual ~SecPublicInfo()
The virtual Destructor. 
void setDefaultKeyNameForIdentity(const Name &keyName)
Set the default key name for the corresponding identity. 
static Name certificateNameToPublicKeyName(const Name &certificateName)
Get the public key name from the full certificate name. 
virtual void deleteCertificateInfo(const Name &certificateName)=0
Delete a certificate. 
virtual void getAllCertificateNames(std::vector< Name > &nameList, bool isDefault)=0
Get all the certificate name in public info. 
virtual void setDefaultIdentityInternal(const Name &identityName)=0
Set the default identity. 
virtual bool doesIdentityExist(const Name &identityName)=0
Check if the specified identity already exists. 
void setDefaultCertificateNameForKey(const Name &certificateName)
Set the default certificate name for the corresponding key. 
Name getNewKeyName(const Name &identityName, bool useKsk)
Generate a key name for the identity. 
const Name & getName() const 
void addCertificateAsIdentityDefault(const IdentityCertificate &certificate)
Add a certificate into the public key identity storage and set the certificate as the default one of ...
std::string toUri() const 
Encode this name as a URI. 
void addCertificateAsSystemDefault(const IdentityCertificate &certificate)
Add a certificate into the public key identity storage and set the certificate as the default one of ...
virtual void getAllKeyNamesOfIdentity(const Name &identity, std::vector< Name > &nameList, bool isDefault)=0
Get all the key name of a particular identity. 
virtual bool doesPublicKeyExist(const Name &keyName)=0
Check if the specified key already exists. 
virtual void setDefaultKeyNameForIdentityInternal(const Name &keyName)=0
Set the default key name for the corresponding identity. 
virtual shared_ptr< IdentityCertificate > getCertificate(const Name &certificateName)=0
Get a certificate from the identity storage. 
virtual shared_ptr< PublicKey > getPublicKey(const Name &keyName)=0
Get the public key DER blob from the identity storage. 
virtual bool revokeIdentity()=0
Revoke the identity. 
A Name holds an array of Name::Component and represents an NDN name. 
virtual void getAllIdentities(std::vector< Name > &nameList, bool isDefault)=0
Get all the identities in public info. 
virtual void addPublicKey(const Name &keyName, KeyType keyType, const PublicKey &publicKeyDer)=0
Add a public key to the identity storage. 
virtual bool doesCertificateExist(const Name &certificateName)=0
Check if the specified certificate already exists. 
virtual void deletePublicKeyInfo(const Name &keyName)=0
Delete a public key and related certificates. 
shared_ptr< IdentityCertificate > m_defaultCertificate
void refreshDefaultCertificate()
try to get the default certificate of the default identity from the public info. 
void setDefaultIdentity(const Name &identityName)
Set the default identity. 
milliseconds toUnixTimestamp(const system_clock::TimePoint &point)
Convert system_clock::TimePoint to UNIX timestamp. 
virtual void getAllCertificateNamesOfKey(const Name &keyName, std::vector< Name > &nameList, bool isDefault)=0
Get all the certificate name of a particular key. 
virtual void deleteIdentityInfo(const Name &identity)=0
Delete an identity and related public keys and certificates. 
void addCertificateAsKeyDefault(const IdentityCertificate &certificate)
Add a certificate and set the certificate as the default one of its corresponding key...
shared_ptr< IdentityCertificate > defaultCertificate()
get cached default certificate of the default identity. 
Name getDefaultCertificateName()
Get the default certificate name of the default identity. 
virtual Name getDefaultKeyNameForIdentity(const Name &identityName)=0
Get the default key name for the specified identity. 
virtual Name getDefaultIdentity()=0
Get the default identity. 
Error(const std::string &what)
SecPublicInfo is a base class for the storage of public information. 
virtual void setDefaultCertificateNameForKeyInternal(const Name &certificateName)=0
Set the default certificate name for the corresponding key.