32 : m_name(identityName)
34 , m_keys(identityName, m_pib)
35 , m_isDefaultKeyLoaded(false)
37 BOOST_ASSERT(m_pib !=
nullptr);
40 m_pib->addIdentity(m_name);
42 else if (!m_pib->hasIdentity(m_name)) {
51 return m_keys.
add(key, keyName);
59 if (m_isDefaultKeyLoaded && m_defaultKey.
getName() == keyName)
60 m_isDefaultKeyLoaded =
false;
69 return m_keys.
get(keyName);
84 m_defaultKey = m_keys.
get(keyName);
85 m_isDefaultKeyLoaded =
true;
86 m_pib->setDefaultKeyOfIdentity(m_name, keyName);
102 if (!m_isDefaultKeyLoaded) {
103 m_defaultKey = m_keys.
get(m_pib->getDefaultKeyOfIdentity(m_name));
104 m_isDefaultKeyLoaded =
true;
106 BOOST_ASSERT(m_pib->getDefaultKeyOfIdentity(m_name) == m_defaultKey.
getName());
Copyright (c) 2011-2015 Regents of the University of California.
represents a semantic error
void remove(const Name &keyName)
Remove a key with keyName from the container.
const Key & setDefaultKey(const Name &keyName)
Set the key with id keyName.
const KeyContainer & getKeys() const
Get all keys for this Identity.
Key add(span< const uint8_t > key, const Name &keyName)
Add key with name keyName into the container.
Container of keys of an identity.
A frontend handle of a key instance.
Key get(const Name &keyName) const
Get a key with keyName from the container.
IdentityImpl(const Name &identityName, shared_ptr< PibImpl > pibImpl, bool needInit=false)
Create an Identity with identityName.
bool isConsistent() const
Check if the container is consistent with the backend storage.
Represents an absolute name.
const Name & getName() const
Get key name.
Key addKey(span< const uint8_t > key, const Name &keyName)
Add key with name keyName (in PKCS #8 format).
void removeKey(const Name &keyName)
Remove a key with keyName.
Key getKey(const Name &keyName) const
Get a key with id keyName.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
const Key & getDefaultKey() const
Get the default key for this Identity.