A frontend handle of a key instance. More...
#include <key.hpp>
Public Member Functions | |
| Key () | |
| Default Constructor. More... | |
| Key (weak_ptr< detail::KeyImpl > impl) | |
Create a Key with a backend implementation impl. More... | |
| const Name & | getName () const |
| Get key name. More... | |
| const Name & | getIdentity () const |
| Get the name of the belonging identity. More... | |
| KeyType | getKeyType () const |
| Get key type. More... | |
| span< const uint8_t > | getPublicKey () const |
| Get public key bits. More... | |
| Certificate | getCertificate (const Name &certName) const |
Get a certificate with certName. More... | |
| const CertificateContainer & | getCertificates () const |
| Get all certificates for this key. More... | |
| const Certificate & | getDefaultCertificate () const |
| Get the default certificate for this Key. More... | |
| operator bool () const | |
| Check if the Key instance is valid. More... | |
| void | removeCertificate (const Name &certName) const |
Remove a certificate with certName. More... | |
| const Certificate & | setDefaultCertificate (const Name &certName) const |
Set an existing certificate with certName as the default certificate. More... | |
| const Certificate & | setDefaultCertificate (const Certificate &certificate) const |
Add certificate and set it as the default certificate of the key. More... | |
Public Attributes | |
| NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: void addCertificate(const Certificate& certificate) const |
Friends | |
| bool | operator!= (const Key &, const Key &) |
A frontend handle of a key instance.
Key is at the second level in PIB's Identity-Key-Certificate hierarchy. A Key has a Name (identity + "KEY" + keyId), and contains one or more certificates, one of which is set as the default certificate of this key. A certificate can be directly accessed from a Key object.
|
default |
Default Constructor.
Key created using this default constructor is just a place holder. It can obtain an actual instance from Identity::getKey(...). A typical usage would be for exception handling:
Key key; try { key = identity.getKey(...); } catch (const Pib::Error&) { ... }
A Key instance created using this constructor is invalid. Calling a member method on an invalid Key instance may cause an std::domain_error.
|
explicit |
Create a Key with a backend implementation impl.
This method should only be used by KeyContainer.
| const Name & ndn::security::pib::Key::getName | ( | ) | const |
Get key name.
Definition at line 38 of file key.cpp.
Referenced by ndn::security::v2::KeyChain::addCertificate(), ndn::security::v2::KeyChain::createIdentity(), ndn::security::v2::KeyChain::createKey(), ndn::security::v2::KeyChain::deleteKey(), ndn::security::pib::detail::IdentityImpl::getDefaultKey(), ndn::security::v2::KeyChain::makeCertificate(), ndn::security::pib::operator<<(), ndn::security::v2::parseLocatorUri(), ndn::security::pib::detail::IdentityImpl::removeKey(), ndn::security::v2::KeyChain::setDefaultKey(), and ndn::security::SigningInfo::setPibKey().
| const Name & ndn::security::pib::Key::getIdentity | ( | ) | const |
Get the name of the belonging identity.
Definition at line 44 of file key.cpp.
Referenced by ndn::security::v2::KeyChain::deleteKey(), ndn::security::v2::parseLocatorUri(), and ndn::security::v2::KeyChain::setDefaultKey().
| KeyType ndn::security::pib::Key::getKeyType | ( | ) | const |
Get key type.
Definition at line 50 of file key.cpp.
Referenced by ndn::security::v2::parseLocatorUri().
| span< const uint8_t > ndn::security::pib::Key::getPublicKey | ( | ) | const |
Get public key bits.
Definition at line 56 of file key.cpp.
Referenced by ndn::security::v2::KeyChain::addCertificate(), ndn::security::v2::KeyChain::makeCertificate(), and ndn::security::verifySignature().
| Certificate ndn::security::pib::Key::getCertificate | ( | const Name & | certName | ) | const |
Get a certificate with certName.
| std::invalid_argument | certName does not match key name |
| Pib::Error | the certificate does not exist. |
| const CertificateContainer & ndn::security::pib::Key::getCertificates | ( | ) | const |
| const Certificate & ndn::security::pib::Key::getDefaultCertificate | ( | ) | const |
Get the default certificate for this Key.
| Pib::Error | the default certificate does not exist. |
Definition at line 98 of file key.cpp.
Referenced by ndn::security::v2::KeyChain::createIdentity(), and ndn::security::v2::parseLocatorUri().
|
explicit |
| void ndn::security::pib::Key::removeCertificate | ( | const Name & | certName | ) | const |
Remove a certificate with certName.
| std::invalid_argument | certName does not match key name |
Definition at line 68 of file key.cpp.
Referenced by ndn::security::v2::KeyChain::deleteCertificate().
| const Certificate & ndn::security::pib::Key::setDefaultCertificate | ( | const Name & | certName | ) | const |
Set an existing certificate with certName as the default certificate.
| std::invalid_argument | certName does not match key name |
| Pib::Error | the certificate does not exist. |
Definition at line 86 of file key.cpp.
Referenced by ndn::security::v2::KeyChain::setDefaultCertificate().
| const Certificate & ndn::security::pib::Key::setDefaultCertificate | ( | const Certificate & | certificate | ) | const |
| NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::security::pib::Key::__pad0__ |