24 #include "../v2/certificate.hpp"
40 return lock()->getName();
46 return lock()->getIdentity();
52 return lock()->getKeyType();
58 return lock()->getPublicKey();
64 return lock()->addCertificate(certificate);
68 Key::removeCertificate(
const Name& certName)
const
70 return lock()->removeCertificate(certName);
76 return lock()->getCertificate(certName);
82 return lock()->getCertificates();
86 Key::setDefaultCertificate(
const Name& certName)
const
88 return lock()->setDefaultCertificate(certName);
94 return lock()->setDefaultCertificate(certificate);
97 const v2::Certificate&
100 return lock()->getDefaultCertificate();
103 Key::operator bool()
const
105 return !(this->operator!());
111 return m_impl.expired();
114 shared_ptr<detail::KeyImpl>
117 auto impl = m_impl.lock();
119 if (impl ==
nullptr) {
120 BOOST_THROW_EXCEPTION(std::domain_error(
"Invalid key instance"));
133 Name keyName = identity;
151 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Key name `" + keyName.
toUri() +
"` "
152 "does not follow the naming conventions"));
const Name & getName() const
Copyright (c) 2013-2016 Regents of the University of California.
The certificate following the certificate format naming convention.
static const size_t MIN_KEY_NAME_LENGTH
bool isValidKeyName(const Name &keyName)
Check if keyName follow the naming conventions for the key name.
std::string toUri() const
Encode this name as a URI.
Container of certificates of a key.
const CertificateContainer & getCertificates() const
Get all certificates for this key.
KeyType getKeyType() const
Get key type.
size_t size() const
Get the number of components.
v2::Certificate getCertificate(const Name &certName) const
Get a certificate with certName.
Name abstraction to represent an absolute name.
const Buffer & getPublicKey() const
Get public key bits.
const v2::Certificate & getDefaultCertificate() const
Get the default certificate for this Key.
Component holds a read-only name component value.
Name constructKeyName(const Name &identity, const name::Component &keyId)
Construct key name based on the appropriate naming conventions.
Name & append(const uint8_t *value, size_t valueLength)
Append a new component, copying from value of length valueLength.
static const name::Component KEY_COMPONENT
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
const Name & getIdentity() const
Get the name of the belonging identity.
bool operator!() const
Check if the Key instance is invalid.
Name extractIdentityFromKeyName(const Name &keyName)
Extract identity namespace from the key name keyName.
Class representing a general-use automatically managed/resized buffer.
Key()
Default Constructor.
const Component & get(ssize_t i) const
Get the component at the given index.