33 : m_container(nullptr)
40 , m_container(&container)
47 BOOST_ASSERT(m_container !=
nullptr);
48 return m_container->get(*m_it);
61 BOOST_ASSERT(m_container !=
nullptr);
70 bool isThisEnd = m_container ==
nullptr || m_it == m_container->m_certNames.end();
71 bool isOtherEnd = other.m_container ==
nullptr || other.m_it == other.m_container->m_certNames.end();
72 return ((isThisEnd || isOtherEnd) ?
73 (isThisEnd == isOtherEnd) :
74 m_container->m_pib == other.m_container->m_pib && m_it == other.m_it);
80 return !(*
this == other);
83 CertificateContainer::CertificateContainer(
const Name& keyName, shared_ptr<PibImpl>
pibImpl)
87 BOOST_ASSERT(m_pib !=
nullptr);
88 m_certNames = m_pib->getCertificatesOfKey(keyName);
112 return m_certNames.size();
119 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Certificate name `" + certificate.
getKeyName().
toUri() +
"` " 120 "does not match key name"));
123 m_certNames.insert(certName);
124 m_certs[certName] = certificate;
125 m_pib->addCertificate(certificate);
133 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 134 "is invalid or does not match key name"));
137 m_certNames.erase(certName);
138 m_certs.erase(certName);
139 m_pib->removeCertificate(certName);
145 auto it = m_certs.find(certName);
147 if (it != m_certs.end())
152 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` " 153 "is invalid or does not match key name"));
156 m_certs[certName] = m_pib->getCertificate(certName);
157 return m_certs[certName];
163 return m_certNames == m_pib->getCertificatesOfKey(m_keyName);
Copyright (c) 2011-2015 Regents of the University of California.
std::string toUri() const
Get URI representation of the name.
The certificate following the certificate format naming convention.
void remove(const Name &certName)
Remove a certificate with certName from the container.
const Name & getName() const
Get name.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE shared_ptr< PibImpl > pibImpl
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
bool isConsistent() const
Check if the container is consistent with the backend storage.
v2::Certificate get(const Name &certName) const
Get a certificate with certName from the container.
bool operator!=(const const_iterator &other) const
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator)
const_iterator end() const
Container of certificates of a key.
Name getKeyName() const
Get key name.
v2::Certificate operator*()
Represents an absolute name.
bool operator==(const const_iterator &other) const
void add(const v2::Certificate &certificate)
Add certificate into the container.
static bool isValidName(const Name &certName)
Check if the specified name follows the naming convention for the certificate.
const_iterator & operator++()
const_iterator find(const Name &certName) const
const_iterator begin() const