A frontend handle of a key instance. More...
#include <ndn-cxx/security/pib/key.hpp>
Public Member Functions | |
Key () | |
Default Constructor. More... | |
Key (weak_ptr< detail::KeyImpl > impl) | |
Create a Key with a backend implementation impl . More... | |
v2::Certificate | getCertificate (const Name &certName) const |
Get a certificate with certName . More... | |
const CertificateContainer & | getCertificates () const |
Get all certificates for this key. More... | |
const v2::Certificate & | getDefaultCertificate () const |
Get the default certificate for this Key. More... | |
const Name & | getIdentity () const |
Get the name of the belonging identity. More... | |
KeyType | getKeyType () const |
Get key type. More... | |
const Name & | getName () const |
Get key name. More... | |
const Buffer & | getPublicKey () const |
Get public key bits. More... | |
operator bool () const | |
Check if the Key instance is valid. More... | |
Friends | |
bool | operator!= (const Key &, const Key &) |
class | v2::KeyChain |
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.
v2::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 v2::Certificate & ndn::security::pib::Key::getDefaultCertificate | ( | ) | const |
Get the default certificate for this Key.
Pib::Error | the default certificate does not exist. |
const Name & ndn::security::pib::Key::getIdentity | ( | ) | const |
KeyType ndn::security::pib::Key::getKeyType | ( | ) | const |
const Name & ndn::security::pib::Key::getName | ( | ) | const |
const Buffer & ndn::security::pib::Key::getPublicKey | ( | ) | const |
|
explicit |
|
friend |