35 , m_key(key.begin(), key.end())
37 , m_certificates(keyName, m_pib)
38 , m_isDefaultCertificateLoaded(false)
40 BOOST_ASSERT(m_pib !=
nullptr);
51 m_pib->addKey(m_identity, m_keyName, key);
58 , m_certificates(keyName, m_pib)
59 , m_isDefaultCertificateLoaded(false)
61 BOOST_ASSERT(m_pib !=
nullptr);
63 m_key = m_pib->getKeyBits(m_keyName);
74 m_certificates.
add(certificate);
82 if (m_isDefaultCertificateLoaded && m_defaultCertificate.getName() == certName)
83 m_isDefaultCertificateLoaded =
false;
85 m_certificates.
remove(certName);
92 return m_certificates.
get(certName);
99 return m_certificates;
107 m_defaultCertificate = m_certificates.
get(certName);
108 m_pib->setDefaultCertificateOfKey(m_keyName, certName);
109 m_isDefaultCertificateLoaded =
true;
110 return m_defaultCertificate;
125 if (!m_isDefaultCertificateLoaded) {
126 m_defaultCertificate = m_pib->getDefaultCertificateOfKey(m_keyName);
127 m_isDefaultCertificateLoaded =
true;
129 BOOST_ASSERT(m_pib->getDefaultCertificateOfKey(m_keyName).wireEncode() == m_defaultCertificate.wireEncode());
131 return m_defaultCertificate;
#define NDN_THROW_NESTED(e)
const Certificate & setDefaultCertificate(const Name &certName)
Set an existing certificate with name certName as the default certificate.
Copyright (c) 2011-2015 Regents of the University of California.
void remove(const Name &certName)
Remove a certificate with certName from the container.
bool isConsistent() const
Check if the container is consistent with the backend storage.
const Certificate & getDefaultCertificate() const
Get the default certificate for this key.
Container of certificates of a key.
Certificate get(const Name &certName) const
Get a certificate with certName from the container.
void add(const Certificate &certificate)
Add certificate into the container.
void addCertificate(const Certificate &certificate)
Add certificate.
Represents an absolute name.
Certificate getCertificate(const Name &certName) const
Get a certificate with certName.
void removeCertificate(const Name &certName)
Remove a certificate with certName.
KeyImpl(const Name &keyName, span< const uint8_t > key, shared_ptr< PibImpl > pibImpl)
Create a KeyImpl with keyName.
Name extractIdentityFromKeyName(const Name &keyName)
Extract identity namespace from the key name keyName.
const CertificateContainer & getCertificates() const
Get all the certificates for this key.