30 : m_hasDefaultCertificate(false)
31 , m_needRefreshCerts(false)
41 , m_hasDefaultCertificate(
false)
42 , m_needRefreshCerts(
true)
50 m_impl->addIdentity(m_id);
51 m_impl->addKey(m_id, m_keyId, publicKey);
55 shared_ptr<PibImpl> impl)
58 , m_hasDefaultCertificate(false)
59 , m_needRefreshCerts(true)
67 m_key = m_impl->getKeyBits(m_id, m_keyId);
107 if (!m_needRefreshCerts &&
108 m_certificates.
find(certificate.
getName()) == m_certificates.
end()) {
111 m_needRefreshCerts =
true;
114 m_impl->addCertificate(certificate);
122 if (m_hasDefaultCertificate && m_defaultCertificate.
getName() == certName)
123 m_hasDefaultCertificate =
false;
125 m_impl->removeCertificate(certName);
126 m_needRefreshCerts =
true;
134 return m_impl->getCertificate(certName);
142 if (m_needRefreshCerts) {
145 m_needRefreshCerts =
false;
148 return m_certificates;
156 m_defaultCertificate = m_impl->getCertificate(certName);
157 m_impl->setDefaultCertificateOfKey(m_id, m_keyId, certName);
158 m_hasDefaultCertificate =
true;
159 return m_defaultCertificate;
165 addCertificate(certificate);
174 if (!m_hasDefaultCertificate) {
175 m_defaultCertificate = m_impl->getDefaultCertificateOfKey(m_id, m_keyId);
176 m_hasDefaultCertificate =
true;
179 return m_defaultCertificate;
182 Key::operator bool()
const 190 return (m_impl ==
nullptr);
196 if (m_impl ==
nullptr)
197 BOOST_THROW_EXCEPTION(std::domain_error(
"Invalid Key instance"));
void validityCheck() const
Check the validity of this instance.
const Name & getIdentity() const
Get the name of the belonging identity.
Copyright (c) 2011-2015 Regents of the University of California.
IdentityCertificate getCertificate(const Name &certName) const
Get a certificate.
const IdentityCertificate & getDefaultCertificate() const
Get the default certificate for this Key.
A handler to search or enumerate certificates of a key.
Key()
Default Constructor.
const_iterator end() const
const Name & getName() const
Get the name of the key.
const Name & getName() const
Get name of the Data packet.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const name::Component const PublicKey shared_ptr< PibImpl > impl
bool operator!() const
Check if the Key instance is invalid.
const CertificateContainer & getCertificates() const
Get all the certificates for this key.
Name abstraction to represent an absolute name.
const IdentityCertificate & setDefaultCertificate(const Name &certName)
Set the default certificate.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const name::Component const PublicKey & publicKey
Component holds a read-only name component value.
const_iterator find(const Name &certName) const
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const name::Component & keyId
Name & append(const uint8_t *value, size_t valueLength)
Append a new component, copying from value of length valueLength.
const name::Component & getKeyId() const
Get the key id of the key.
void removeCertificate(const Name &certName)
Remove a certificate.
const PublicKey & getPublicKey() const
Get public key.